Formidable Forms – Form Builder for WordPress - Version 4.08

Version Description

  • New: Added confirmation before forms are deleted in bulk.
  • Allow a value to pass validation if the entered value matches the placeholder setting.
  • Fix: Email addresses were not being sent to Akismet for logged out users, and resulting in some false positive spam.
  • Fix: Some sites have been getting duplicate entries days apart. This issue should be fixed.
  • Fix: Searching when switching between forms no longer triggers the confirmation message when leaving the page.
Download this release

Release Info

Developer sswells
Plugin Icon 128x128 Formidable Forms – Form Builder for WordPress
Version 4.08
Comparing to
See all releases

Code changes from version 4.07.01 to 4.08

classes/controllers/FrmAddonsController.php CHANGED
@@ -25,6 +25,9 @@ class FrmAddonsController {
25
  'formidable-pro-upgrade',
26
  'FrmAddonsController::upgrade_to_pro'
27
  );
 
 
 
28
  }
29
  }
30
 
@@ -86,7 +89,7 @@ class FrmAddonsController {
86
  * @return array
87
  */
88
  private static function fallback_plugin_list() {
89
- return array(
90
  'formidable-pro' => array(
91
  'title' => 'Formidable Forms',
92
  'link' => 'pricing/',
@@ -156,6 +159,16 @@ class FrmAddonsController {
156
  'excerpt' => 'Allow users to text their votes for polls created by Formidable Forms, or send SMS notifications when entries are submitted or updated.',
157
  ),
158
  );
 
 
 
 
 
 
 
 
 
 
159
  }
160
 
161
  /**
@@ -165,6 +178,18 @@ class FrmAddonsController {
165
  * @return string
166
  */
167
  public static function get_pro_download_url() {
 
 
 
 
 
 
 
 
 
 
 
 
168
  $pro_cred_store = 'frmpro-credentials';
169
  $pro_wpmu_store = 'frmpro-wpmu-sitewide';
170
  if ( is_multisite() && get_site_option( $pro_wpmu_store ) ) {
@@ -186,12 +211,14 @@ class FrmAddonsController {
186
  // this is a fix for licenses saved in the past
187
  $license = strtoupper( $license );
188
  }
 
 
189
 
190
- $api = new FrmFormApi( $license );
191
- $downloads = $api->get_api_info();
192
- $pro = isset( $downloads['93790'] ) ? $downloads['93790'] : array();
193
-
194
- return isset( $pro['url'] ) ? $pro['url'] : '';
195
  }
196
 
197
  /**
@@ -209,7 +236,7 @@ class FrmAddonsController {
209
  $type = isset( $addons['error']['type'] ) ? $addons['error']['type'] : $type;
210
  }
211
 
212
- $pro = isset( $addons['93790'] ) ? $addons['93790'] : array();
213
  if ( $type === 'free' ) {
214
  $type = isset( $pro['type'] ) ? $pro['type'] : $type;
215
  if ( $type === 'free' ) {
@@ -230,6 +257,44 @@ class FrmAddonsController {
230
  * @since 4.0.01
231
  */
232
  public static function is_license_expired() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  $installed_addons = apply_filters( 'frm_installed_addons', array() );
234
  if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
235
  return false;
@@ -238,12 +303,7 @@ class FrmAddonsController {
238
  'formidable_pro' => $installed_addons['formidable_pro'],
239
  );
240
 
241
- $version_info = self::fill_update_addon_info( $installed_addons );
242
- if ( ! isset( $version_info['error'] ) ) {
243
- return false;
244
- }
245
-
246
- return $version_info['error'];
247
  }
248
 
249
  /**
@@ -759,7 +819,8 @@ class FrmAddonsController {
759
  // The plugin was installed, but not active. Download it now.
760
  self::ajax_install_addon();
761
  } else {
762
- $response['active'] = true;
 
763
  }
764
 
765
  echo json_encode( $response );
@@ -773,24 +834,40 @@ class FrmAddonsController {
773
 
774
  self::install_addon_permissions();
775
 
 
 
 
 
 
 
 
 
 
 
 
776
  // Set the current screen to avoid undefined notices.
777
- global $hook_suffix;
778
- set_current_screen();
 
 
779
 
780
  self::maybe_show_cred_form();
781
 
782
  $installed = self::install_addon();
 
 
 
783
  self::maybe_activate_addon( $installed );
784
-
785
- // Send back a response.
786
- echo json_encode( __( 'Your plugin has been installed. Please reload the page to see more options.', 'formidable' ) );
787
- wp_die();
788
  }
789
 
790
  /**
791
  * @since 3.04.02
792
  */
793
  private static function maybe_show_cred_form() {
 
 
 
 
794
  // Start output bufferring to catch the filesystem form if credentials are needed.
795
  ob_start();
796
 
@@ -808,10 +885,15 @@ class FrmAddonsController {
808
  }
809
 
810
  if ( $show_form ) {
811
- //$form = ob_get_clean();
812
- //TODO: test this: echo json_encode( array( 'form' => $form ) );
813
- echo json_encode( array( 'form' => __( 'Sorry, you\'re site requires FTP authentication. Please install plugins manaully.', 'formidable' ) ) );
814
- wp_die();
 
 
 
 
 
815
  }
816
 
817
  ob_end_clean();
@@ -835,7 +917,14 @@ class FrmAddonsController {
835
  // Flush the cache and return the newly installed plugin basename.
836
  wp_cache_flush();
837
 
838
- return $installer->plugin_info();
 
 
 
 
 
 
 
839
  }
840
 
841
  /**
@@ -903,8 +992,14 @@ class FrmAddonsController {
903
  if ( is_wp_error( $activate ) ) {
904
  // Ignore the invalid header message that shows with nested plugins.
905
  if ( $activate->get_error_code() !== 'no_plugin_header' ) {
906
- echo json_encode( array( 'error' => $activate->get_error_message() ) );
907
- wp_die();
 
 
 
 
 
 
908
  }
909
  }
910
  }
@@ -923,6 +1018,100 @@ class FrmAddonsController {
923
  }
924
  }
925
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
926
  /**
927
  * @since 3.04.03
928
  * @deprecated 3.06
25
  'formidable-pro-upgrade',
26
  'FrmAddonsController::upgrade_to_pro'
27
  );
28
+ } elseif ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) ) {
29
+ wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
30
+ exit;
31
  }
32
  }
33
 
89
  * @return array
90
  */
91
  private static function fallback_plugin_list() {
92
+ $list = array(
93
  'formidable-pro' => array(
94
  'title' => 'Formidable Forms',
95
  'link' => 'pricing/',
159
  'excerpt' => 'Allow users to text their votes for polls created by Formidable Forms, or send SMS notifications when entries are submitted or updated.',
160
  ),
161
  );
162
+
163
+ $defaults = array(
164
+ 'released' => '',
165
+ );
166
+
167
+ foreach ( $list as $k => $info ) {
168
+ $info['slug'] = $k;
169
+ $list[ $k ] = array_merge( $defaults, $info );
170
+ }
171
+ return $list;
172
  }
173
 
174
  /**
178
  * @return string
179
  */
180
  public static function get_pro_download_url() {
181
+ $license = self::get_pro_license();
182
+ $api = new FrmFormApi( $license );
183
+ $downloads = $api->get_api_info();
184
+ $pro = self::get_pro_from_addons( $downloads );
185
+
186
+ return isset( $pro['url'] ) ? $pro['url'] : '';
187
+ }
188
+
189
+ /**
190
+ * @since 4.08
191
+ */
192
+ public static function get_pro_license() {
193
  $pro_cred_store = 'frmpro-credentials';
194
  $pro_wpmu_store = 'frmpro-wpmu-sitewide';
195
  if ( is_multisite() && get_site_option( $pro_wpmu_store ) ) {
211
  // this is a fix for licenses saved in the past
212
  $license = strtoupper( $license );
213
  }
214
+ return $license;
215
+ }
216
 
217
+ /**
218
+ * @since 4.08
219
+ */
220
+ private static function get_pro_from_addons( $addons ) {
221
+ return isset( $addons['93790'] ) ? $addons['93790'] : array();
222
  }
223
 
224
  /**
236
  $type = isset( $addons['error']['type'] ) ? $addons['error']['type'] : $type;
237
  }
238
 
239
+ $pro = self::get_pro_from_addons( $addons );
240
  if ( $type === 'free' ) {
241
  $type = isset( $pro['type'] ) ? $pro['type'] : $type;
242
  if ( $type === 'free' ) {
257
  * @since 4.0.01
258
  */
259
  public static function is_license_expired() {
260
+ $version_info = self::get_primary_license_info();
261
+ if ( ! isset( $version_info['error'] ) ) {
262
+ return false;
263
+ }
264
+
265
+ return $version_info['error'];
266
+ }
267
+
268
+ /**
269
+ * @since 4.08
270
+ *
271
+ * @return boolean|int false or the number of days until expiration.
272
+ */
273
+ public static function is_license_expiring() {
274
+ $version_info = self::get_primary_license_info();
275
+ if ( ! isset( $version_info['active_sub'] ) || $version_info['active_sub'] !== 'no' ) {
276
+ // Check for a subscription first.
277
+ return false;
278
+ }
279
+
280
+ if ( ! isset( $version_info['error'] ) || empty( $version_info['expires'] ) ) {
281
+ // It's either invalid or already expired.
282
+ return false;
283
+ }
284
+
285
+ $expiration = $version_info['expires'];
286
+ $days_left = ( $expiration - time() ) / DAY_IN_SECONDS;
287
+ if ( $days_left > 30 ) {
288
+ return false;
289
+ }
290
+
291
+ return $days_left;
292
+ }
293
+
294
+ /**
295
+ * @since 4.08
296
+ */
297
+ private static function get_primary_license_info() {
298
  $installed_addons = apply_filters( 'frm_installed_addons', array() );
299
  if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
300
  return false;
303
  'formidable_pro' => $installed_addons['formidable_pro'],
304
  );
305
 
306
+ return self::fill_update_addon_info( $installed_addons );
 
 
 
 
 
307
  }
308
 
309
  /**
819
  // The plugin was installed, but not active. Download it now.
820
  self::ajax_install_addon();
821
  } else {
822
+ $response['active'] = true;
823
+ $response['success'] = true;
824
  }
825
 
826
  echo json_encode( $response );
834
 
835
  self::install_addon_permissions();
836
 
837
+ self::download_and_activate();
838
+
839
+ // Send back a response.
840
+ echo json_encode( __( 'Your plugin has been installed. Please reload the page to see more options.', 'formidable' ) );
841
+ wp_die();
842
+ }
843
+
844
+ /**
845
+ * @since 4.08
846
+ */
847
+ private static function download_and_activate() {
848
  // Set the current screen to avoid undefined notices.
849
+ if ( is_admin() ) {
850
+ global $hook_suffix;
851
+ set_current_screen();
852
+ }
853
 
854
  self::maybe_show_cred_form();
855
 
856
  $installed = self::install_addon();
857
+ if ( is_array( $installed ) && isset( $installed['message'] ) ) {
858
+ return $installed;
859
+ }
860
  self::maybe_activate_addon( $installed );
 
 
 
 
861
  }
862
 
863
  /**
864
  * @since 3.04.02
865
  */
866
  private static function maybe_show_cred_form() {
867
+ if ( ! function_exists( 'request_filesystem_credentials' ) ) {
868
+ include_once( ABSPATH . 'wp-admin/includes/file.php' );
869
+ }
870
+
871
  // Start output bufferring to catch the filesystem form if credentials are needed.
872
  ob_start();
873
 
885
  }
886
 
887
  if ( $show_form ) {
888
+ $form = ob_get_clean();
889
+ $message = __( 'Sorry, your site requires FTP authentication. Please download plugins from FormidableForms.com and install them manually.', 'formidable' );
890
+ $data = $form;
891
+ $response = array(
892
+ 'success' => false,
893
+ 'message' => $message,
894
+ 'form' => $form,
895
+ );
896
+ wp_send_json( $response );
897
  }
898
 
899
  ob_end_clean();
917
  // Flush the cache and return the newly installed plugin basename.
918
  wp_cache_flush();
919
 
920
+ $plugin = $installer->plugin_info();
921
+ if ( empty( $plugin ) ) {
922
+ return array(
923
+ 'message' => 'Plugin was not installed. ' . $installer->result,
924
+ 'success' => false,
925
+ );
926
+ }
927
+ return $plugin;
928
  }
929
 
930
  /**
992
  if ( is_wp_error( $activate ) ) {
993
  // Ignore the invalid header message that shows with nested plugins.
994
  if ( $activate->get_error_code() !== 'no_plugin_header' ) {
995
+ if ( wp_doing_ajax() ) {
996
+ echo json_encode( array( 'error' => $activate->get_error_message() ) );
997
+ wp_die();
998
+ }
999
+ return array(
1000
+ 'message' => $activate->get_error_message(),
1001
+ 'success' => false,
1002
+ );
1003
  }
1004
  }
1005
  }
1018
  }
1019
  }
1020
 
1021
+ /**
1022
+ * @since 4.08
1023
+ */
1024
+ public static function connect_link() {
1025
+ $auth = get_option( 'frm_connect_token' );
1026
+ if ( empty( $auth ) ) {
1027
+ $auth = hash( 'sha512', wp_rand() );
1028
+ update_option( 'frm_connect_token', $auth );
1029
+ }
1030
+ $link = FrmAppHelper::admin_upgrade_link( 'connect', 'api-connect' );
1031
+ $args = array(
1032
+ 'v' => 2,
1033
+ 'siteurl' => FrmAppHelper::site_url(),
1034
+ 'url' => get_rest_url(),
1035
+ 'token' => $auth,
1036
+ 'l' => self::get_pro_license(),
1037
+ );
1038
+
1039
+ return add_query_arg( $args, $link );
1040
+ }
1041
+
1042
+ /**
1043
+ * Check the auth value for install permission.
1044
+ *
1045
+ * @since 4.08
1046
+ *
1047
+ * @return bool
1048
+ */
1049
+ public static function can_install_addon_api() {
1050
+ // Verify params present (auth & download link).
1051
+ $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1052
+ $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1053
+
1054
+ if ( empty( $post_auth ) || empty( $post_url ) ) {
1055
+ return false;
1056
+ }
1057
+
1058
+ // Verify auth.
1059
+ $auth = get_option( 'frm_connect_token' );
1060
+ if ( empty( $auth ) || ! hash_equals( $auth, $post_auth ) ) {
1061
+ return false;
1062
+ }
1063
+
1064
+ return true;
1065
+ }
1066
+
1067
+ /**
1068
+ * Install and/or activate the add-on file.
1069
+ *
1070
+ * @since 4.08
1071
+ */
1072
+ public static function install_addon_api() {
1073
+ // Sanitize when it's used to prevent double sanitizing.
1074
+ // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
1075
+ $_POST['plugin'] = isset( $_REQUEST['file_url'] ) ? $_REQUEST['file_url'] : ''; // Set for later use
1076
+
1077
+ $error = esc_html__( 'Could not install an upgrade. Please download from formidableforms.com and install manually.', 'formidable' );
1078
+
1079
+ // Delete so cannot replay.
1080
+ delete_option( 'frm_connect_token' );
1081
+
1082
+ // It's already installed and active.
1083
+ $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1084
+ if ( is_wp_error( $active ) ) {
1085
+ // Download plugin now.
1086
+ $response = self::download_and_activate();
1087
+ if ( is_array( $response ) && isset( $response['success'] ) ) {
1088
+ return $response;
1089
+ }
1090
+ }
1091
+
1092
+ // If empty license, save it now.
1093
+ if ( empty( self::get_pro_license() ) && function_exists( 'load_formidable_pro' ) ) {
1094
+ load_formidable_pro();
1095
+ $license = stripslashes( FrmAppHelper::get_param( 'key', '', 'request', 'sanitize_text_field' ) );
1096
+ if ( empty( $license ) ) {
1097
+ return array(
1098
+ 'success' => false,
1099
+ 'error' => 'That site does not have a valid license key.',
1100
+ );
1101
+ }
1102
+
1103
+ $response = FrmAddon::activate_license_for_plugin( $license, 'formidable_pro' );
1104
+ if ( ! $response['success'] ) {
1105
+ // Could not activate license.
1106
+ return $response;
1107
+ }
1108
+ }
1109
+
1110
+ return array(
1111
+ 'success' => true,
1112
+ );
1113
+ }
1114
+
1115
  /**
1116
  * @since 3.04.03
1117
  * @deprecated 3.06
classes/controllers/FrmAppController.php CHANGED
@@ -461,6 +461,14 @@ class FrmAppController {
461
  );
462
 
463
  register_rest_route( 'frm-admin/v1', '/install', $args );
 
 
 
 
 
 
 
 
464
  }
465
 
466
  /**
461
  );
462
 
463
  register_rest_route( 'frm-admin/v1', '/install', $args );
464
+
465
+ $args = array(
466
+ 'methods' => 'GET',
467
+ 'callback' => 'FrmAddonsController::install_addon_api',
468
+ 'permission_callback' => 'FrmAddonsController::can_install_addon_api',
469
+ );
470
+
471
+ register_rest_route( 'frm-admin/v1', '/install-addon', $args );
472
  }
473
 
474
  /**
classes/controllers/FrmFormActionsController.php CHANGED
@@ -54,6 +54,7 @@ class FrmFormActionsController {
54
  'constantcontact' => 'FrmDefConstContactAction',
55
  'getresponse' => 'FrmDefGetResponseAction',
56
  'hubspot' => 'FrmDefHubspotAction',
 
57
  'twilio' => 'FrmDefTwilioAction',
58
  'highrise' => 'FrmDefHighriseAction',
59
  'mailpoet' => 'FrmDefMailpoetAction',
54
  'constantcontact' => 'FrmDefConstContactAction',
55
  'getresponse' => 'FrmDefGetResponseAction',
56
  'hubspot' => 'FrmDefHubspotAction',
57
+ 'zapier' => 'FrmDefZapierAction',
58
  'twilio' => 'FrmDefTwilioAction',
59
  'highrise' => 'FrmDefHighriseAction',
60
  'mailpoet' => 'FrmDefMailpoetAction',
classes/controllers/FrmFormsController.php CHANGED
@@ -983,6 +983,7 @@ class FrmFormsController {
983
  'data' => array(
984
  'medium' => 'permissions',
985
  'upgrade' => __( 'Form Permissions', 'formidable' ),
 
986
  ),
987
  ),
988
  'scheduling' => array(
983
  'data' => array(
984
  'medium' => 'permissions',
985
  'upgrade' => __( 'Form Permissions', 'formidable' ),
986
+ 'message' => __( 'Allow editing, protect forms and files, limit entries, and save drafts. Upgrade to get form and entry permissions.', 'formidable' ),
987
  ),
988
  ),
989
  'scheduling' => array(
classes/controllers/FrmStylesController.php CHANGED
@@ -416,7 +416,7 @@ class FrmStylesController {
416
  }
417
 
418
  public static function include_style_section( $atts, $sec ) {
419
- extract( $atts );
420
  $style = $atts['style'];
421
  FrmStylesHelper::prepare_color_output( $style->post_content, false );
422
 
416
  }
417
 
418
  public static function include_style_section( $atts, $sec ) {
419
+ extract( $atts ); // phpcs:ignore WordPress.PHP.DontExtract
420
  $style = $atts['style'];
421
  FrmStylesHelper::prepare_color_output( $style->post_content, false );
422
 
classes/controllers/FrmXMLController.php CHANGED
@@ -618,7 +618,7 @@ class FrmXMLController {
618
  $csv_fields = FrmField::get_all_for_form( $form_id, '', 'include', 'include' );
619
  $no_export_fields = FrmField::no_save_fields();
620
  foreach ( $csv_fields as $k => $f ) {
621
- if ( in_array( $f->type, $no_export_fields ) ) {
622
  unset( $csv_fields[ $k ] );
623
  }
624
  }
618
  $csv_fields = FrmField::get_all_for_form( $form_id, '', 'include', 'include' );
619
  $no_export_fields = FrmField::no_save_fields();
620
  foreach ( $csv_fields as $k => $f ) {
621
+ if ( in_array( $f->type, $no_export_fields, true ) ) {
622
  unset( $csv_fields[ $k ] );
623
  }
624
  }
classes/helpers/FrmAppHelper.php CHANGED
@@ -11,7 +11,7 @@ class FrmAppHelper {
11
  /**
12
  * @since 2.0
13
  */
14
- public static $plug_version = '4.07.01';
15
 
16
  /**
17
  * @since 1.07.02
@@ -120,13 +120,50 @@ class FrmAppHelper {
120
  */
121
  public static function renewal_message() {
122
  if ( ! FrmAddonsController::is_license_expired() ) {
 
123
  return;
124
  }
125
  ?>
126
  <div class="frm_error_style" style="text-align:left">
127
  <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
128
  &nbsp;
129
- <?php esc_attr_e( 'Your account has expired', 'formidable' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  <div style="float:right">
131
  <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-renew', 'account/downloads/' ) ); ?>">
132
  Renew Now
@@ -1547,7 +1584,7 @@ class FrmAppHelper {
1547
  return false;
1548
  }
1549
 
1550
- extract( $atts );
1551
  ob_start();
1552
  include( $filename );
1553
  $contents = ob_get_contents();
11
  /**
12
  * @since 2.0
13
  */
14
+ public static $plug_version = '4.08';
15
 
16
  /**
17
  * @since 1.07.02
120
  */
121
  public static function renewal_message() {
122
  if ( ! FrmAddonsController::is_license_expired() ) {
123
+ self::expiring_message();
124
  return;
125
  }
126
  ?>
127
  <div class="frm_error_style" style="text-align:left">
128
  <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
129
  &nbsp;
130
+ <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
131
+ <div style="float:right">
132
+ <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-renew', 'account/downloads/' ) ); ?>">
133
+ Renew Now
134
+ </a>
135
+ </div>
136
+ </div>
137
+ <?php
138
+ }
139
+
140
+ /**
141
+ * @since 4.08
142
+ */
143
+ public static function expiring_message() {
144
+ $expiring = FrmAddonsController::is_license_expiring();
145
+ if ( ! $expiring ) {
146
+ return;
147
+ }
148
+ ?>
149
+ <div class="frm_warning_style" style="text-align:left">
150
+ <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
151
+ &nbsp;
152
+ <?php
153
+ printf(
154
+ esc_html(
155
+ /* translators: %1$s: start HTML tag, %2$s: end HTML tag */
156
+ _n(
157
+ 'Your form subscription expires in %1$s day%2$s.',
158
+ 'Your form subscription expires in %1$s days%2$s.',
159
+ $expiring,
160
+ 'formidable'
161
+ )
162
+ ),
163
+ '<strong>' . esc_html( number_format_i18n( $expiring ) ),
164
+ '</strong>'
165
+ );
166
+ ?>
167
  <div style="float:right">
168
  <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-renew', 'account/downloads/' ) ); ?>">
169
  Renew Now
1584
  return false;
1585
  }
1586
 
1587
+ extract( $atts ); // phpcs:ignore WordPress.PHP.DontExtract
1588
  ob_start();
1589
  include( $filename );
1590
  $contents = ob_get_contents();
classes/helpers/FrmCSVExportHelper.php CHANGED
@@ -5,16 +5,16 @@ if ( ! defined( 'ABSPATH' ) ) {
5
 
6
  class FrmCSVExportHelper {
7
 
8
- protected static $separator = ', ';
9
  protected static $column_separator = ',';
10
- protected static $line_break = 'return';
11
- protected static $charset = 'UTF-8';
12
- protected static $to_encoding = 'UTF-8';
13
- protected static $wp_date_format = 'Y-m-d H:i:s';
14
- protected static $comment_count = 0;
15
- protected static $form_id = 0;
16
- protected static $headings = array();
17
- protected static $fields = array();
18
  protected static $entry;
19
  protected static $has_parent_id;
20
 
@@ -119,24 +119,89 @@ class FrmCSVExportHelper {
119
  self::print_csv_row( $headings );
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  private static function csv_headings( &$headings ) {
 
 
 
123
  foreach ( self::$fields as $col ) {
124
- $field_headings = array();
125
- $separate_values = array( 'user_id', 'file', 'data', 'date' );
126
- if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, $separate_values, true ) ) {
127
- $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
 
 
129
 
130
- $field_headings[ $col->id ] = strip_tags( $col->name );
131
- $field_headings = apply_filters(
132
- 'frm_csv_field_columns',
133
- $field_headings,
134
- array(
135
- 'field' => $col,
136
- )
137
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
- $headings += $field_headings;
 
140
  }
141
 
142
  if ( self::$comment_count ) {
@@ -250,7 +315,7 @@ class FrmCSVExportHelper {
250
  )
251
  );
252
 
253
- if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) {
254
  $sep_value = FrmEntriesHelper::display_value(
255
  $field_value,
256
  $col,
@@ -306,7 +371,24 @@ class FrmCSVExportHelper {
306
  $sep = '';
307
 
308
  foreach ( self::$headings as $k => $heading ) {
309
- $row = isset( $rows[ $k ] ) ? $rows[ $k ] : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  if ( is_array( $row ) ) {
311
  // implode the repeated field values
312
  $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) );
5
 
6
  class FrmCSVExportHelper {
7
 
8
+ protected static $separator = ', ';
9
  protected static $column_separator = ',';
10
+ protected static $line_break = 'return';
11
+ protected static $charset = 'UTF-8';
12
+ protected static $to_encoding = 'UTF-8';
13
+ protected static $wp_date_format = 'Y-m-d H:i:s';
14
+ protected static $comment_count = 0;
15
+ protected static $form_id = 0;
16
+ protected static $headings = array();
17
+ protected static $fields = array();
18
  protected static $entry;
19
  protected static $has_parent_id;
20
 
119
  self::print_csv_row( $headings );
120
  }
121
 
122
+ private static function field_headings( $col ) {
123
+ $field_headings = array();
124
+ $separate_values = array( 'user_id', 'file', 'data', 'date' );
125
+ if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, $separate_values, true ) ) {
126
+ $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
127
+ }
128
+
129
+ $field_headings[ $col->id ] = strip_tags( $col->name );
130
+ $field_headings = apply_filters(
131
+ 'frm_csv_field_columns',
132
+ $field_headings,
133
+ array(
134
+ 'field' => $col,
135
+ )
136
+ );
137
+
138
+ return $field_headings;
139
+ }
140
+
141
  private static function csv_headings( &$headings ) {
142
+ $fields_by_repeater_id = array();
143
+ $repeater_ids = array();
144
+
145
  foreach ( self::$fields as $col ) {
146
+ if ( $col->form_id === self::$form_id || ! $col->field_options['in_section'] ) {
147
+ $headings += self::field_headings( $col );
148
+ } else {
149
+ $repeater_id = $col->field_options['in_section'];
150
+ $section = FrmField::getOne( $repeater_id );
151
+
152
+ if ( $section && FrmField::is_repeating_field( $section ) ) {
153
+ $headings[ 'repeater' . $repeater_id ] = array(); // set a placeholder to maintain order for repeater fields
154
+
155
+ if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) {
156
+ $fields_by_repeater_id[ $repeater_id ] = array();
157
+ $repeater_ids[] = $repeater_id;
158
+ }
159
+
160
+ $fields_by_repeater_id[ $repeater_id ][] = $col;
161
+ }
162
  }
163
+ }
164
+ unset( $repeater_id, $col );
165
 
166
+ if ( $repeater_ids ) {
167
+ $where = array( 'field_id' => $repeater_ids );
168
+ $repeater_meta = FrmDb::get_results( 'frm_item_metas', $where, 'field_id, meta_value' );
169
+ $max = array_fill_keys( $repeater_ids, 0 );
170
+
171
+ foreach ( $repeater_meta as $row ) {
172
+ $start = strpos( $row->meta_value, 'a:' ) + 2;
173
+ $end = strpos( $row->meta_value, ':{' );
174
+ $length = substr( $row->meta_value, $start, $end - $start );
175
+
176
+ if ( $length > $max[ $row->field_id ] ) {
177
+ $max[ $row->field_id ] = $length;
178
+ }
179
+ }
180
+ unset( $start, $end, $length, $row, $repeater_meta, $where );
181
+
182
+ $flat = array();
183
+ foreach ( $headings as $key => $heading ) {
184
+ if ( is_array( $heading ) ) {
185
+ $repeater_id = str_replace( 'repeater', '', $key );
186
+
187
+ $repeater_headings = array();
188
+ foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) {
189
+ $repeater_headings += self::field_headings( $col );
190
+ }
191
+
192
+ for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) {
193
+ foreach ( $repeater_headings as $repeater_key => $repeater_name ) {
194
+ $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name;
195
+ }
196
+ }
197
+ } else {
198
+ $flat[ $key ] = $heading;
199
+ }
200
+ }
201
+ unset( $key, $heading, $max, $repeater_headings, $repeater_id );
202
 
203
+ $headings = $flat;
204
+ unset( $flat );
205
  }
206
 
207
  if ( self::$comment_count ) {
315
  )
316
  );
317
 
318
+ if ( ! empty( $col->field_options['separate_value'] ) ) {
319
  $sep_value = FrmEntriesHelper::display_value(
320
  $field_value,
321
  $col,
371
  $sep = '';
372
 
373
  foreach ( self::$headings as $k => $heading ) {
374
+ if ( isset( $rows[ $k ] ) ) {
375
+ $row = $rows[ $k ];
376
+ } else {
377
+ $row = '';
378
+ // array indexed data is not at $rows[ $k ]
379
+ if ( $k[ strlen( $k ) - 1 ] === ']' ) {
380
+ $start = strrpos( $k, '[' );
381
+ $key = substr( $k, 0, $start ++ );
382
+ $index = substr( $k, $start, strlen( $k ) - 1 - $start );
383
+
384
+ if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) {
385
+ $row = $rows[ $key ][ $index ];
386
+ }
387
+
388
+ unset( $start, $key, $index );
389
+ }
390
+ }
391
+
392
  if ( is_array( $row ) ) {
393
  // implode the repeated field values
394
  $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) );
classes/helpers/FrmEntriesListHelper.php CHANGED
@@ -336,4 +336,11 @@ class FrmEntriesListHelper extends FrmListHelper {
336
 
337
  $val = FrmEntriesHelper::prepare_display_value( $item, $field, $atts );
338
  }
 
 
 
 
 
 
 
339
  }
336
 
337
  $val = FrmEntriesHelper::prepare_display_value( $item, $field, $atts );
338
  }
339
+
340
+ /**
341
+ * @return string
342
+ */
343
+ protected function confirm_bulk_delete() {
344
+ return __( 'ALL selected entries in this form will be permanently deleted. Want to proceed?', 'formidable' );
345
+ }
346
  }
classes/helpers/FrmFormsListHelper.php CHANGED
@@ -352,4 +352,11 @@ class FrmFormsListHelper extends FrmListHelper {
352
  $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 );
353
  }
354
  }
 
 
 
 
 
 
 
355
  }
352
  $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 );
353
  }
354
  }
355
+
356
+ /**
357
+ * @return string
358
+ */
359
+ protected function confirm_bulk_delete() {
360
+ return __( 'ALL selected forms and their entries will be permanently deleted. Want to proceed?', 'formidable' );
361
+ }
362
  }
classes/helpers/FrmListHelper.php CHANGED
@@ -398,10 +398,25 @@ class FrmListHelper {
398
 
399
  echo "</select>\n";
400
 
 
 
 
 
 
 
 
 
401
  submit_button( __( 'Apply', 'formidable' ), 'action', '', false, array( 'id' => "doaction$two" ) );
402
  echo "\n";
403
  }
404
 
 
 
 
 
 
 
 
405
  /**
406
  * Get the current action selected from the bulk actions dropdown.
407
  *
398
 
399
  echo "</select>\n";
400
 
401
+ if ( isset( $this->_actions['bulk_delete'] ) ) {
402
+ $verify = $this->confirm_bulk_delete();
403
+
404
+ if ( $verify ) {
405
+ echo "<a id='confirm-bulk-delete-" . esc_attr( $which ) . "' class='frm-hidden' href='confirm-bulk-delete' data-frmcaution='" . esc_html__( 'Heads up', 'formidable' ) . "' data-frmverify='" . esc_attr( $verify ) . "'></a>";
406
+ }
407
+ }
408
+
409
  submit_button( __( 'Apply', 'formidable' ), 'action', '', false, array( 'id' => "doaction$two" ) );
410
  echo "\n";
411
  }
412
 
413
+ /**
414
+ * @return string if empty there will be no confirmation pop up
415
+ */
416
+ protected function confirm_bulk_delete() {
417
+ return '';
418
+ }
419
+
420
  /**
421
  * Get the current action selected from the bulk actions dropdown.
422
  *
classes/helpers/FrmXMLHelper.php CHANGED
@@ -186,10 +186,13 @@ class FrmXMLHelper {
186
 
187
  // Keep track of whether this specific form was updated or not.
188
  $imported['form_status'][ $form_id ] = 'imported';
189
- self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms );
190
  }
191
  }
192
 
 
 
 
 
193
  self::import_xml_fields( $item->field, $form_id, $this_form, $form_fields, $imported );
194
 
195
  self::delete_removed_fields( $form_fields );
@@ -340,12 +343,11 @@ class FrmXMLHelper {
340
  */
341
  private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
342
  foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
343
-
344
- if ( isset( $imported_forms[ $old_parent_form_id ] ) && $imported_forms[ $old_parent_form_id ] != $old_parent_form_id ) {
345
  // Update all children with this old parent_form_id
346
  $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ];
347
-
348
  FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) );
 
349
  }
350
  }
351
  }
@@ -463,10 +465,9 @@ class FrmXMLHelper {
463
  }
464
 
465
  /**
466
- * Update the current in_section value
467
  *
468
  * @since 2.0.25
469
- *
470
  * @param int $in_section
471
  * @param array $f
472
  */
186
 
187
  // Keep track of whether this specific form was updated or not.
188
  $imported['form_status'][ $form_id ] = 'imported';
 
189
  }
190
  }
191
 
192
+ if ( $form_id ) {
193
+ self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms );
194
+ }
195
+
196
  self::import_xml_fields( $item->field, $form_id, $this_form, $form_fields, $imported );
197
 
198
  self::delete_removed_fields( $form_fields );
343
  */
344
  private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
345
  foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
346
+ if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) {
 
347
  // Update all children with this old parent_form_id
348
  $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ];
 
349
  FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) );
350
+ do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id );
351
  }
352
  }
353
  }
465
  }
466
 
467
  /**
468
+ * Update the current in_section value at the beginning of the field loop
469
  *
470
  * @since 2.0.25
 
471
  * @param int $in_section
472
  * @param array $f
473
  */
classes/models/FrmAddon.php CHANGED
@@ -475,13 +475,20 @@ class FrmAddon {
475
  }
476
 
477
  $plugin_slug = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
478
- $this_plugin = self::get_addon( $plugin_slug );
479
- $response = $this_plugin->activate_license( $license );
480
 
481
  echo json_encode( $response );
482
  wp_die();
483
  }
484
 
 
 
 
 
 
 
 
 
485
  private function activate_license( $license ) {
486
  $this->set_license( $license );
487
  $this->license = $license;
475
  }
476
 
477
  $plugin_slug = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
478
+ $response = self::activate_license_for_plugin( $license, $plugin_slug );
 
479
 
480
  echo json_encode( $response );
481
  wp_die();
482
  }
483
 
484
+ /**
485
+ * @since 4.08
486
+ */
487
+ public static function activate_license_for_plugin( $license, $plugin_slug ) {
488
+ $this_plugin = self::get_addon( $plugin_slug );
489
+ return $this_plugin->activate_license( $license );
490
+ }
491
+
492
  private function activate_license( $license ) {
493
  $this->set_license( $license );
494
  $this->license = $license;
classes/models/FrmEntryMeta.php CHANGED
@@ -332,8 +332,21 @@ class FrmEntryMeta {
332
  $query = implode( ' ', $query );
333
 
334
  $cache_key = 'ids_' . FrmAppHelper::maybe_json_encode( $where ) . $order_by . 'l' . $limit . 'u' . $unique . FrmAppHelper::maybe_json_encode( $args );
 
 
 
335
 
336
- return FrmDb::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_var' : 'get_col' ) );
 
 
 
 
 
 
 
 
 
 
337
  }
338
 
339
  /**
@@ -343,15 +356,23 @@ class FrmEntryMeta {
343
  */
344
  private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) {
345
  global $wpdb;
346
- $query[] = 'SELECT';
347
-
348
- $defaults = array( 'return_parent_id' => false );
 
 
349
  $args = array_merge( $defaults, $args );
350
 
351
- if ( $args['return_parent_id'] ) {
352
- $query[] = $unique ? 'DISTINCT(e.parent_item_id)' : 'e.parent_item_id';
 
 
 
 
 
 
353
  } else {
354
- $query[] = $unique ? 'DISTINCT(it.item_id)' : 'it.item_id';
355
  }
356
 
357
  $query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
@@ -390,8 +411,8 @@ class FrmEntryMeta {
390
 
391
  if ( strpos( $where, ' GROUP BY ' ) ) {
392
  // don't inject WHERE filtering after GROUP BY
393
- $parts = explode( ' GROUP BY ', $where );
394
- $where = $parts[0];
395
  $where .= $draft_where . $user_where;
396
  $where .= ' GROUP BY ' . $parts[1];
397
  } else {
332
  $query = implode( ' ', $query );
333
 
334
  $cache_key = 'ids_' . FrmAppHelper::maybe_json_encode( $where ) . $order_by . 'l' . $limit . 'u' . $unique . FrmAppHelper::maybe_json_encode( $args );
335
+ $type = 'get_' . ( ' LIMIT 1' === $limit ? 'var' : 'col' );
336
+ return FrmDb::check_cache( $cache_key, 'frm_entry', $query, $type );
337
+ }
338
 
339
+ /**
340
+ * Given a query including a form id and its child form ids, output an array of matching entry ids
341
+ * If a child entry id is matched, its parent will be returned in its place
342
+ *
343
+ * @param array $query
344
+ * @param array $args
345
+ * @return array
346
+ */
347
+ public static function get_top_level_entry_ids( $query, $args ) {
348
+ $args['return_parent_id_if_0_return_id'] = true;
349
+ return self::getEntryIds( $query, '', '', true, $args );
350
  }
351
 
352
  /**
356
  */
357
  private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) {
358
  global $wpdb;
359
+ $query[] = 'SELECT';
360
+ $defaults = array(
361
+ 'return_parent_id' => false,
362
+ 'return_parent_id_if_0_return_id' => false,
363
+ );
364
  $args = array_merge( $defaults, $args );
365
 
366
+ if ( $unique ) {
367
+ $query[] = 'DISTINCT';
368
+ }
369
+
370
+ if ( $args['return_parent_id_if_0_return_id'] ) {
371
+ $query[] = 'IF ( e.parent_item_id = 0, it.item_id, e.parent_item_id )';
372
+ } elseif ( $args['return_parent_id'] ) {
373
+ $query[] = 'e.parent_item_id';
374
  } else {
375
+ $query[] = 'it.item_id';
376
  }
377
 
378
  $query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
411
 
412
  if ( strpos( $where, ' GROUP BY ' ) ) {
413
  // don't inject WHERE filtering after GROUP BY
414
+ $parts = explode( ' GROUP BY ', $where );
415
+ $where = $parts[0];
416
  $where .= $draft_where . $user_where;
417
  $where .= ' GROUP BY ' . $parts[1];
418
  } else {
classes/models/FrmEntryValidate.php CHANGED
@@ -113,21 +113,19 @@ class FrmEntryValidate {
113
  $errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
114
  }
115
 
 
 
 
 
 
 
116
  private static function maybe_clear_value_for_default_blank_setting( $field, &$value ) {
117
- $placeholder = FrmField::get_option( $field, 'placeholder' );
118
- $is_default = ( ! empty( $placeholder ) && $value == $placeholder );
119
- $is_label = false;
120
-
121
- if ( ! $is_default ) {
122
- $position = FrmField::get_option( $field, 'label' );
123
- if ( empty( $position ) ) {
124
- $position = FrmStylesController::get_style_val( 'position', $field->form_id );
125
- }
126
-
127
- $is_label = ( $position == 'inside' && FrmFieldsHelper::is_placeholder_field_type( $field->type ) && $value == $field->name );
128
  }
129
 
130
- if ( $is_label || $is_default ) {
131
  $value = '';
132
  }
133
  }
@@ -389,6 +387,10 @@ class FrmEntryValidate {
389
  $datas['comment_author_email'] = '';
390
  $datas['comment_author_url'] = '';
391
 
 
 
 
 
392
  $values = array_filter( $values );
393
  foreach ( $values as $value ) {
394
  if ( ! is_array( $value ) ) {
113
  $errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
114
  }
115
 
116
+ /**
117
+ * Set $value to an empty string if it matches its label
118
+ *
119
+ * @param object $field
120
+ * @param string $value
121
+ */
122
  private static function maybe_clear_value_for_default_blank_setting( $field, &$value ) {
123
+ $position = FrmField::get_option( $field, 'label' );
124
+ if ( ! $position ) {
125
+ $position = FrmStylesController::get_style_val( 'position', $field->form_id );
 
 
 
 
 
 
 
 
126
  }
127
 
128
+ if ( $position === 'inside' && FrmFieldsHelper::is_placeholder_field_type( $field->type ) && $value === $field->name ) {
129
  $value = '';
130
  }
131
  }
387
  $datas['comment_author_email'] = '';
388
  $datas['comment_author_url'] = '';
389
 
390
+ if ( isset( $values['item_meta'] ) ) {
391
+ $values = $values['item_meta'];
392
+ }
393
+
394
  $values = array_filter( $values );
395
  foreach ( $values as $value ) {
396
  if ( ! is_array( $value ) ) {
classes/models/FrmInstallerSkin.php CHANGED
@@ -67,10 +67,22 @@ class FrmInstallerSkin extends WP_Upgrader_Skin {
67
  public function error( $errors ) {
68
  if ( ! empty( $errors ) ) {
69
  if ( ! is_string( $errors ) ) {
70
- $errors = $errors->get_error_message();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
- echo json_encode( array( 'error' => $errors ) );
73
- wp_die();
74
  }
75
  }
76
 
67
  public function error( $errors ) {
68
  if ( ! empty( $errors ) ) {
69
  if ( ! is_string( $errors ) ) {
70
+ $error = $errors->get_error_message();
71
+ $message = $errors->get_error_data();
72
+ $errors = $error . ' ' . $message;
73
+ }
74
+ echo json_encode(
75
+ array(
76
+ 'error' => $errors,
77
+ 'message' => $errors,
78
+ 'success' => false,
79
+ )
80
+ );
81
+ if ( wp_doing_ajax() ) {
82
+ wp_die();
83
+ } else {
84
+ die();
85
  }
 
 
86
  }
87
  }
88
 
classes/views/frm-fields/back-end/field-captcha.php CHANGED
@@ -8,7 +8,7 @@ if ( empty( $frm_settings->pubkey ) ) {
8
  ?>
9
  <div class="howto frm_no_captcha_text"><?php
10
  /* translators: %1$s: Link HTML, %2$s: End link */
11
- printf( esc_html__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>' );
12
  ?></div>
13
  <?php } ?>
14
  <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ); ?>" class="recaptcha_placeholder" alt="reCaptcha"/>
8
  ?>
9
  <div class="howto frm_no_captcha_text"><?php
10
  /* translators: %1$s: Link HTML, %2$s: End link */
11
+ printf( esc_html__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings" target="_blank">', '</a>' );
12
  ?></div>
13
  <?php } ?>
14
  <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ); ?>" class="recaptcha_placeholder" alt="reCaptcha"/>
classes/views/frm-form-actions/_action_inside.php CHANGED
@@ -66,6 +66,11 @@ do_action( 'frm_additional_action_settings', $form_action, $pass_args );
66
  // Show Conditional logic indicator.
67
  if ( ! FrmAppHelper::pro_is_installed() ) {
68
  ?>
 
 
 
 
 
69
  <h3>
70
  <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php esc_attr_e( 'Conditional emails', 'formidable' ); ?>" data-medium="conditional-email">
71
  <?php esc_html_e( 'Use Conditional Logic', 'formidable' ); ?>
66
  // Show Conditional logic indicator.
67
  if ( ! FrmAppHelper::pro_is_installed() ) {
68
  ?>
69
+ <h3>
70
+ <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php esc_attr_e( 'Email attachments', 'formidable' ); ?>" data-medium="email-attachment">
71
+ <?php esc_html_e( 'Attachment', 'formidable' ); ?>
72
+ </a>
73
+ </h3>
74
  <h3>
75
  <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php esc_attr_e( 'Conditional emails', 'formidable' ); ?>" data-medium="conditional-email">
76
  <?php esc_html_e( 'Use Conditional Logic', 'formidable' ); ?>
classes/views/frm-form-actions/default_actions.php CHANGED
@@ -52,6 +52,14 @@ class FrmDefMlcmpAction extends FrmFormAction {
52
  }
53
  }
54
 
 
 
 
 
 
 
 
 
55
  // add twilio action
56
  class FrmDefTwilioAction extends FrmFormAction {
57
  public function __construct() {
52
  }
53
  }
54
 
55
+ // add zapier action
56
+ class FrmDefZapierAction extends FrmFormAction {
57
+ public function __construct() {
58
+ $action_ops = FrmFormAction::default_action_opts( 'frm_zapier_icon frm_show_upgrade' );
59
+ parent::__construct( 'zapier', 'Zapier', $action_ops );
60
+ }
61
+ }
62
+
63
  // add twilio action
64
  class FrmDefTwilioAction extends FrmFormAction {
65
  public function __construct() {
classes/views/frm-form-actions/email_action.php CHANGED
@@ -20,7 +20,7 @@ class FrmEmailAction extends FrmFormAction {
20
  }
21
 
22
  public function form( $form_action, $args = array() ) {
23
- extract( $args );
24
 
25
  include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php';
26
  }
20
  }
21
 
22
  public function form( $form_action, $args = array() ) {
23
+ extract( $args ); // phpcs:ignore WordPress.PHP.DontExtract
24
 
25
  include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php';
26
  }
classes/views/frm-settings/general.php CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
6
  <div class="frm_license_box">
7
  <h3 class="frm-no-border frm_no_top_margin"><?php esc_html_e( 'License Key', 'formidable' ); ?></h3>
8
  <p class="howto">
9
- <?php esc_html_e( 'Your license key provides access to automatic updates.', 'formidable' ); ?>
10
  </p>
11
 
12
  <?php do_action( 'frm_before_settings' ); ?>
6
  <div class="frm_license_box">
7
  <h3 class="frm-no-border frm_no_top_margin"><?php esc_html_e( 'License Key', 'formidable' ); ?></h3>
8
  <p class="howto">
9
+ <?php esc_html_e( 'Your license key provides access to new features and updates.', 'formidable' ); ?>
10
  </p>
11
 
12
  <?php do_action( 'frm_before_settings' ); ?>
classes/views/frm-settings/license_box.php CHANGED
@@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
5
  ?>
6
  <div id="frm_license_top" class="frm_unauthorized_box">
7
  <p id="frm-connect-btns" class="frm-show-unauthorized">
8
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-settings' ) ); ?>" target="_blank" class="button-primary frm-button-primary" id="frm-settings-connect-btn">
9
  <?php esc_html_e( 'Connect an Account', 'formidable' ); ?>
10
  </a>
11
  or
5
  ?>
6
  <div id="frm_license_top" class="frm_unauthorized_box">
7
  <p id="frm-connect-btns" class="frm-show-unauthorized">
8
+ <a href="<?php echo esc_url( FrmAddonsController::connect_link() ); ?>" class="button-primary frm-button-primary">
9
  <?php esc_html_e( 'Connect an Account', 'formidable' ); ?>
10
  </a>
11
  or
css/_single_theme.css.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  }
5
 
6
  $settings = FrmStylesHelper::get_settings_for_output( $style );
7
- extract( $settings );
8
 
9
  $important = empty( $important_style ) ? '' : ' !important';
10
 
4
  }
5
 
6
  $settings = FrmStylesHelper::get_settings_for_output( $style );
7
+ extract( $settings ); // phpcs:ignore WordPress.PHP.DontExtract
8
 
9
  $important = empty( $important_style ) ? '' : ' !important';
10
 
css/frm_admin.css CHANGED
@@ -1731,6 +1731,10 @@ h2.frm-h2 + .howto {
1731
  }
1732
 
1733
  /* Add-on tiles */
 
 
 
 
1734
  .frm-addons .plugin-card-top {
1735
  height: 140px;
1736
  padding-top: 30px;
@@ -1783,13 +1787,11 @@ h2.frm-h2 + .howto {
1783
 
1784
  .frm-addon-error {
1785
  position: absolute;
1786
- width: 100%;
 
 
1787
  font-weight: bold;
1788
  text-align: center;
1789
- max-width: 291px;
1790
- margin: 0;
1791
- margin-top: -205px;
1792
- margin-left: -17px;
1793
  }
1794
 
1795
  /* Form Templates */
1731
  }
1732
 
1733
  /* Add-on tiles */
1734
+ .frm-addons .frm-card.frm-addon-not-installed {
1735
+ position: relative;
1736
+ }
1737
+
1738
  .frm-addons .plugin-card-top {
1739
  height: 140px;
1740
  padding-top: 30px;
1787
 
1788
  .frm-addon-error {
1789
  position: absolute;
1790
+ top: 55px;
1791
+ left: 10px;
1792
+ right: 10px;
1793
  font-weight: bold;
1794
  text-align: center;
 
 
 
 
1795
  }
1796
 
1797
  /* Form Templates */
formidable.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Formidable Forms
4
  Description: Quickly and easily create drag-and-drop forms
5
- Version: 4.07.01
6
  Plugin URI: https://formidableforms.com/
7
  Author URI: https://formidableforms.com/
8
  Author: Strategy11
2
  /*
3
  Plugin Name: Formidable Forms
4
  Description: Quickly and easily create drag-and-drop forms
5
+ Version: 4.08
6
  Plugin URI: https://formidableforms.com/
7
  Author URI: https://formidableforms.com/
8
  Author: Strategy11
js/formidable.js CHANGED
@@ -151,7 +151,7 @@ function frmFrontFormJS() {
151
  }
152
 
153
  function validateForm( object ) {
154
- var r, rl, n, nl, emailFields, fields, field, value, requiredFields,
155
  errors = [];
156
 
157
  // Make sure required text field is filled in
@@ -164,7 +164,6 @@ function frmFrontFormJS() {
164
  }
165
  }
166
 
167
- emailFields = jQuery( object ).find( 'input[type=email]' ).filter( ':visible' );
168
  fields = jQuery( object ).find( 'input,select,textarea' );
169
  if ( fields.length ) {
170
  for ( n = 0, nl = fields.length; n < nl; n++ ) {
@@ -176,7 +175,9 @@ function frmFrontFormJS() {
176
  } else if ( field.type === 'number' ) {
177
  errors = checkNumberField( field, errors );
178
  } else if ( field.type === 'email' ) {
179
- errors = checkEmailField( field, errors, emailFields );
 
 
180
  } else if ( field.type === 'url' ) {
181
  errors = checkUrlField( field, errors );
182
  } else if ( field.pattern !== null ) {
@@ -209,7 +210,7 @@ function frmFrontFormJS() {
209
  }
210
 
211
  function validateField( fieldId, field ) {
212
- var key, emailFields,
213
  errors = [];
214
 
215
  var $fieldCont = jQuery( field ).closest( '.frm_form_field' );
@@ -219,8 +220,9 @@ function frmFrontFormJS() {
219
 
220
  if ( errors.length < 1 ) {
221
  if ( field.type === 'email' ) {
222
- emailFields = jQuery( field ).closest( 'form' ).find( 'input[type=email]' );
223
- errors = checkEmailField( field, errors, emailFields );
 
224
  } else if ( field.type === 'number' ) {
225
  errors = checkNumberField( field, errors );
226
  } else if ( field.type === 'url' ) {
@@ -337,34 +339,45 @@ function frmFrontFormJS() {
337
  return errors;
338
  }
339
 
340
- function checkEmailField( field, errors, emailFields ) {
341
- var isConf, re, invalidMsg, confName, match,
342
- emailAddress = field.value,
343
- fieldID = getFieldId( field, true );
344
 
345
- if ( fieldID in errors ) {
346
- return errors;
 
347
  }
348
 
349
- isConf = ( fieldID.indexOf( 'conf_' ) === 0 );
350
- if ( emailAddress !== '' || isConf ) {
351
- re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
352
- invalidMsg = getFieldValidationMessage( field, 'data-invmsg' );
353
- if ( emailAddress !== '' && re.test( emailAddress ) === false ) {
354
- errors[ fieldID ] = invalidMsg;
355
- if ( isConf ) {
356
- errors[ fieldID.replace( 'conf_', '' ) ] = '';
357
- }
358
- } else if ( isConf ) {
359
- confName = field.name.replace( 'conf_', '' );
360
- match = emailFields.filter( '[name="' + confName + '"]' ).val();
361
- if ( match !== emailAddress ) {
362
- errors[ fieldID ] = '';
363
- errors[ fieldID.replace( 'conf_', '' ) ] = '';
364
- }
 
 
 
 
 
 
 
 
 
 
365
  }
 
 
366
  }
367
- return errors;
368
  }
369
 
370
  function checkNumberField( field, errors ) {
151
  }
152
 
153
  function validateForm( object ) {
154
+ var r, rl, n, nl, fields, field, value, requiredFields,
155
  errors = [];
156
 
157
  // Make sure required text field is filled in
164
  }
165
  }
166
 
 
167
  fields = jQuery( object ).find( 'input,select,textarea' );
168
  if ( fields.length ) {
169
  for ( n = 0, nl = fields.length; n < nl; n++ ) {
175
  } else if ( field.type === 'number' ) {
176
  errors = checkNumberField( field, errors );
177
  } else if ( field.type === 'email' ) {
178
+ errors = checkEmailField( field, errors );
179
+ } else if ( field.type === 'password' ) {
180
+ errors = checkPasswordField( field, errors );
181
  } else if ( field.type === 'url' ) {
182
  errors = checkUrlField( field, errors );
183
  } else if ( field.pattern !== null ) {
210
  }
211
 
212
  function validateField( fieldId, field ) {
213
+ var key,
214
  errors = [];
215
 
216
  var $fieldCont = jQuery( field ).closest( '.frm_form_field' );
220
 
221
  if ( errors.length < 1 ) {
222
  if ( field.type === 'email' ) {
223
+ errors = checkEmailField( field, errors );
224
+ } else if ( field.type === 'password' ) {
225
+ errors = checkPasswordField( field, errors );
226
  } else if ( field.type === 'number' ) {
227
  errors = checkNumberField( field, errors );
228
  } else if ( field.type === 'url' ) {
339
  return errors;
340
  }
341
 
342
+ function checkEmailField( field, errors ) {
343
+ var fieldID = getFieldId( field, true ),
344
+ pattern = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
 
345
 
346
+ // validate the current field we're editing first
347
+ if ( '' !== field.value && pattern.test( field.value ) === false ) {
348
+ errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
349
  }
350
 
351
+ confirmField( field, errors );
352
+ return errors;
353
+ }
354
+
355
+ function checkPasswordField( field, errors ) {
356
+ confirmField( field, errors );
357
+ return errors;
358
+ }
359
+
360
+ function confirmField( field, errors ) {
361
+ var value, confirmValue, firstField,
362
+ fieldID = getFieldId( field, true ),
363
+ strippedId = field.id.replace( 'conf_', '' ),
364
+ strippedFieldID = fieldID.replace( 'conf_', '' ),
365
+ confirmField = document.getElementById( strippedId.replace( 'field_', 'field_conf_' ) );
366
+
367
+ if ( confirmField === null || typeof errors[ 'conf_' + strippedFieldID ] !== 'undefined' ) {
368
+ return;
369
+ }
370
+
371
+ if ( fieldID !== strippedFieldID ) {
372
+ firstField = document.getElementById( strippedId );
373
+ value = firstField.value;
374
+ confirmValue = confirmField.value;
375
+ if ( '' !== value && '' !== confirmValue && value !== confirmValue ) {
376
+ errors[ 'conf_' + strippedFieldID ] = getFieldValidationMessage( confirmField, 'data-confmsg' );
377
  }
378
+ } else {
379
+ validateField( 'conf_' + strippedFieldID, confirmField );
380
  }
 
381
  }
382
 
383
  function checkNumberField( field, errors ) {
js/formidable.min.js CHANGED
@@ -2,54 +2,55 @@ var frmFrontForm;
2
  function frmFrontFormJS(){var action="";var jsErrors=[];function maybeShowLabel(){var $field=jQuery(this),$label=$field.closest(".frm_inside_container").find(".frm_primary_label"),val=$field.val();if(val!==null&&val.length>0)$label.addClass("frm_visible");else $label.removeClass("frm_visible")}function getFieldId(field,fullID){var nameParts,fieldId,isRepeating=false,fieldName="";if(field instanceof jQuery)fieldName=field.attr("name");else fieldName=field.name;if(typeof fieldName==="undefined")fieldName=
3
  "";if(fieldName===""){if(field instanceof jQuery)fieldName=field.data("name");else fieldName=field.getAttribute("data-name");if(typeof fieldName==="undefined")fieldName="";if(fieldName!==""&&fieldName)return fieldName;return 0}nameParts=fieldName.replace("item_meta[","").replace("[]","").split("]");if(nameParts.length<1)return 0;nameParts=nameParts.filter(function(n){return n!==""});fieldId=nameParts[0];if(nameParts.length===1)return fieldId;if(nameParts[1]==="[form"||nameParts[1]==="[row_ids")return 0;
4
  if(jQuery('input[name="item_meta['+fieldId+'][form]"]').length){fieldId=nameParts[2].replace("[","");isRepeating=true}if("other"===fieldId)if(isRepeating)fieldId=nameParts[3].replace("[","");else fieldId=nameParts[1].replace("[","");if(fullID===true)if(fieldId===nameParts[0])fieldId=fieldId+"-"+nameParts[1].replace("[","");else fieldId=fieldId+"-"+nameParts[0]+"-"+nameParts[1].replace("[","");return fieldId}function disableSubmitButton($form){$form.find('input[type="submit"], input[type="button"], button[type="submit"]').attr("disabled",
5
- "disabled")}function enableSubmitButton($form){$form.find('input[type="submit"], input[type="button"], button[type="submit"]').removeAttr("disabled")}function disableSaveDraft($form){$form.find("a.frm_save_draft").css("pointer-events","none")}function enableSaveDraft($form){$form.find("a.frm_save_draft").css("pointer-events","")}function validateForm(object){var r,rl,n,nl,emailFields,fields,field,value,requiredFields,errors=[];requiredFields=jQuery(object).find(".frm_required_field:visible input, .frm_required_field:visible select, .frm_required_field:visible textarea").filter(":not(.frm_optional)");
6
- if(requiredFields.length)for(r=0,rl=requiredFields.length;r<rl;r++)errors=checkRequiredField(requiredFields[r],errors);emailFields=jQuery(object).find("input[type=email]").filter(":visible");fields=jQuery(object).find("input,select,textarea");if(fields.length)for(n=0,nl=fields.length;n<nl;n++){field=fields[n];value=field.value;if(value!=="")if(field.type==="hidden");else if(field.type==="number")errors=checkNumberField(field,errors);else if(field.type==="email")errors=checkEmailField(field,errors,
7
- emailFields);else if(field.type==="url")errors=checkUrlField(field,errors);else if(field.pattern!==null)errors=checkPatternField(field,errors)}errors=validateRecaptcha(object,errors);return errors}function maybeValidateChange(fieldId,field){if(field.type==="url")maybeAddHttpToUrl(field);if(jQuery(field).closest("form").hasClass("frm_js_validate"))validateField(fieldId,field)}function maybeAddHttpToUrl(field){var url=field.value;var matches=url.match(/^(https?|ftps?|mailto|news|feed|telnet):/);if(field.value!==
8
- ""&&matches===null)field.value="http://"+url}function validateField(fieldId,field){var key,emailFields,errors=[];var $fieldCont=jQuery(field).closest(".frm_form_field");if($fieldCont.hasClass("frm_required_field")&&!jQuery(field).hasClass("frm_optional"))errors=checkRequiredField(field,errors);if(errors.length<1)if(field.type==="email"){emailFields=jQuery(field).closest("form").find("input[type=email]");errors=checkEmailField(field,errors,emailFields)}else if(field.type==="number")errors=checkNumberField(field,
9
- errors);else if(field.type==="url")errors=checkUrlField(field,errors);else if(field.pattern!==null)errors=checkPatternField(field,errors);removeFieldError($fieldCont);if(Object.keys(errors).length>0)for(key in errors)addFieldError($fieldCont,key,errors)}function checkRequiredField(field,errors){var checkGroup,fieldClasses,tempVal,i,placeholder,val="",fieldID="",fileID=field.getAttribute("data-frmfile");if(field.type==="hidden"&&fileID===null)return errors;if(field.type==="checkbox"||field.type===
10
- "radio"){checkGroup=jQuery('input[name="'+field.name+'"]').closest(".frm_required_field").find("input:checked");jQuery(checkGroup).each(function(){val=this.value})}else if(field.type==="file"||fileID){if(typeof fileID==="undefined"){fileID=getFieldId(field,true);fileID=fileID.replace("file","")}if(typeof errors[fileID]==="undefined")val=getFileVals(fileID);fieldID=fileID}else{fieldClasses=field.className;if(fieldClasses.indexOf("frm_pos_none")!==-1)return errors;val=jQuery(field).val();if(val===null)val=
11
- "";else if(typeof val!=="string"){tempVal=val;val="";for(i=0;i<tempVal.length;i++)if(tempVal[i]!=="")val=tempVal[i]}if(fieldClasses.indexOf("frm_other_input")===-1)fieldID=getFieldId(field,true);else fieldID=getFieldId(field,false);if(fieldClasses.indexOf("frm_time_select")!==-1)fieldID=fieldID.replace("-H","").replace("-m","");placeholder=field.getAttribute("data-frmplaceholder");if(placeholder!==null&&val===placeholder)val=""}if(val===""){if(fieldID==="")fieldID=getFieldId(field,true);if(!(fieldID in
12
- errors))errors[fieldID]=getFieldValidationMessage(field,"data-reqmsg")}return errors}function getFileVals(fileID){var val="",fileFields=jQuery('input[name="file'+fileID+'"], input[name="file'+fileID+'[]"], input[name^="item_meta['+fileID+']"]');fileFields.each(function(){if(val==="")val=this.value});return val}function checkUrlField(field,errors){var fieldID,url=field.value;if(url!==""&&!/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i.test(url)){fieldID=getFieldId(field,true);if(!(fieldID in
13
- errors))errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}return errors}function checkEmailField(field,errors,emailFields){var isConf,re,invalidMsg,confName,match,emailAddress=field.value,fieldID=getFieldId(field,true);if(fieldID in errors)return errors;isConf=fieldID.indexOf("conf_")===0;if(emailAddress!==""||isConf){re=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;invalidMsg=
14
- getFieldValidationMessage(field,"data-invmsg");if(emailAddress!==""&&re.test(emailAddress)===false){errors[fieldID]=invalidMsg;if(isConf)errors[fieldID.replace("conf_","")]=""}else if(isConf){confName=field.name.replace("conf_","");match=emailFields.filter('[name="'+confName+'"]').val();if(match!==emailAddress){errors[fieldID]="";errors[fieldID.replace("conf_","")]=""}}}return errors}function checkNumberField(field,errors){var fieldID,number=field.value;if(number!==""&&isNaN(number/1)!==false){fieldID=
15
- getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}return errors}function checkPatternField(field,errors){var fieldID,text=field.value,format=getFieldValidationMessage(field,"pattern");if(format!==""&&text!==""){fieldID=getFieldId(field,true);if(!(fieldID in errors)){format=new RegExp("^"+format+"$","i");if(format.test(text)===false)errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}}return errors}function hasInvisibleRecaptcha(object){var recaptcha,
16
- recaptchaID,alreadyChecked;if(isGoingToPrevPage(object))return false;recaptcha=jQuery(object).find('.frm-g-recaptcha[data-size="invisible"], .g-recaptcha[data-size="invisible"]');if(recaptcha.length){recaptchaID=recaptcha.data("rid");alreadyChecked=grecaptcha.getResponse(recaptchaID);if(alreadyChecked.length===0)return recaptcha;else return false}else return false}function executeInvisibleRecaptcha(invisibleRecaptcha){var recaptchaID=invisibleRecaptcha.data("rid");grecaptcha.reset(recaptchaID);grecaptcha.execute(recaptchaID)}
17
- function validateRecaptcha(form,errors){var recaptchaID,response,fieldContainer,fieldID,$recaptcha=jQuery(form).find(".frm-g-recaptcha");if($recaptcha.length){recaptchaID=$recaptcha.data("rid");try{response=grecaptcha.getResponse(recaptchaID)}catch(e){if(jQuery(form).find('input[name="recaptcha_checked"]').length)return errors;else response=""}if(response.length===0){fieldContainer=$recaptcha.closest(".frm_form_field");fieldID=fieldContainer.attr("id").replace("frm_field_","").replace("_container",
18
- "");errors[fieldID]=""}}return errors}function getFieldValidationMessage(field,messageType){var msg=field.getAttribute(messageType);if(msg===null)msg="";return msg}function shouldJSValidate(object){var validate=jQuery(object).hasClass("frm_js_validate");if(validate&&typeof frmProForm!=="undefined"&&(frmProForm.savingDraft(object)||frmProForm.goingToPreviousPage(object)))validate=false;return validate}function getFormErrors(object,action){var fieldset;if(typeof action==="undefined")jQuery(object).find('input[name="frm_action"]').val();
19
- fieldset=jQuery(object).find(".frm_form_field");fieldset.addClass("frm_doing_ajax");jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:jQuery(object).serialize()+"&action=frm_entries_"+action+"&nonce="+frm_js.nonce,success:function(response){var formID,replaceContent,pageOrder,formReturned,contSubmit,delay,$fieldCont,key,inCollapsedSection,frmTrigger,defaultResponse={"content":"","errors":{},"pass":false};if(response===null)response=defaultResponse;response=response.replace(/^\s+|\s+$/g,"");if(response.indexOf("{")===
20
- 0)response=jQuery.parseJSON(response);else response=defaultResponse;if(typeof response.redirect!=="undefined"){jQuery(document).trigger("frmBeforeFormRedirect",[object,response]);window.location=response.redirect}else if(response.content!==""){removeSubmitLoading(jQuery(object));if(frm_js.offset!=-1)frmFrontForm.scrollMsg(jQuery(object),false);formID=jQuery(object).find('input[name="form_id"]').val();response.content=response.content.replace(/ frm_pro_form /g," frm_pro_form frm_no_hide ");replaceContent=
21
- jQuery(object).closest(".frm_forms");removeAddedScripts(replaceContent,formID);delay=maybeSlideOut(replaceContent,response.content);setTimeout(function(){var container,input,previousInput;replaceContent.replaceWith(response.content);addUrlParam(response);if(typeof frmThemeOverride_frmAfterSubmit==="function"){pageOrder=jQuery('input[name="frm_page_order_'+formID+'"]').val();formReturned=jQuery(response.content).find('input[name="form_id"]').val();frmThemeOverride_frmAfterSubmit(formReturned,pageOrder,
22
- response.content,object)}if(typeof response.recaptcha!=="undefined"){container=jQuery("#frm_form_"+formID+"_container").find(".frm_fields_container");input='<input type="hidden" name="recaptcha_checked" value="'+response.recaptcha+'">';previousInput=container.find('input[name="recaptcha_checked"]');if(previousInput.length)previousInput.replaceWith(input);else container.append(input)}afterFormSubmitted(object,response)},delay)}else if(Object.keys(response.errors).length){removeSubmitLoading(jQuery(object),
23
- "enable");contSubmit=true;removeAllErrors();$fieldCont=null;for(key in response.errors){$fieldCont=jQuery(object).find("#frm_field_"+key+"_container");if($fieldCont.length){if(!$fieldCont.is(":visible")){inCollapsedSection=$fieldCont.closest(".frm_toggle_container");if(inCollapsedSection.length){frmTrigger=inCollapsedSection.prev();if(!frmTrigger.hasClass("frm_trigger"))frmTrigger=frmTrigger.prev(".frm_trigger");frmTrigger.click()}}if($fieldCont.is(":visible")){addFieldError($fieldCont,key,response.errors);
24
- contSubmit=false}}}jQuery(object).find(".frm-g-recaptcha, .g-recaptcha").each(function(){var $recaptcha=jQuery(this),recaptchaID=$recaptcha.data("rid");if(typeof grecaptcha!=="undefined"&&grecaptcha)if(recaptchaID)grecaptcha.reset(recaptchaID);else grecaptcha.reset()});jQuery(document).trigger("frmFormErrors",[object,response]);fieldset.removeClass("frm_doing_ajax");scrollToFirstField(object);if(contSubmit)object.submit();else jQuery(object).prepend(response.error_message)}else{showFileLoading(object);
25
- object.submit()}},error:function(){jQuery(object).find('input[type="submit"], input[type="button"]').removeAttr("disabled");object.submit()}})}function afterFormSubmitted(object,response){var formCompleted=jQuery(response.content).find(".frm_message");if(formCompleted.length)jQuery(document).trigger("frmFormComplete",[object,response]);else jQuery(document).trigger("frmPageChanged",[object,response])}function removeAddedScripts(formContainer,formID){var endReplace=jQuery(".frm_end_ajax_"+formID);
26
- if(endReplace.length){formContainer.nextUntil(".frm_end_ajax_"+formID).remove();endReplace.remove()}}function maybeSlideOut(oldContent,newContent){var c,newClass="frm_slideout";if(newContent.indexOf(" frm_slide")!==-1){c=oldContent.children();if(newContent.indexOf(" frm_going_back")!==-1)newClass+=" frm_going_back";c.removeClass("frm_going_back");c.addClass(newClass);return 300}return 0}function addUrlParam(response){var url;if(history.pushState&&typeof response.page!=="undefined"){url=addQueryVar("frm_page",
27
- response.page);window.history.pushState({"html":response.html},"","?"+url)}}function addQueryVar(key,value){var kvp,i,x;key=encodeURI(key);value=encodeURI(value);kvp=document.location.search.substr(1).split("&");i=kvp.length;while(i--){x=kvp[i].split("=");if(x[0]==key){x[1]=value;kvp[i]=x.join("=");break}}if(i<0)kvp[kvp.length]=[key,value].join("=");return kvp.join("&")}function addFieldError($fieldCont,key,jsErrors){var input,id,describedBy;if($fieldCont.length&&$fieldCont.is(":visible")){$fieldCont.addClass("frm_blank_field");
28
- input=$fieldCont.find("input, select, textarea");id="frm_error_field_"+key;describedBy=input.attr("aria-describedby");if(typeof frmThemeOverride_frmPlaceError==="function")frmThemeOverride_frmPlaceError(key,jsErrors);else{$fieldCont.append('<div class="frm_error" id="'+id+'">'+jsErrors[key]+"</div>");if(typeof describedBy==="undefined")describedBy=id;else if(describedBy.indexOf(id)===-1)describedBy=describedBy+" "+id;input.attr("aria-describedby",describedBy)}input.attr("aria-invalid",true);jQuery(document).trigger("frmAddFieldError",
29
- [$fieldCont,key,jsErrors])}}function removeFieldError($fieldCont){var errorMessage=$fieldCont.find(".frm_error"),errorId=errorMessage.attr("id"),input=$fieldCont.find("input, select, textarea"),describedBy=input.attr("aria-describedby");$fieldCont.removeClass("frm_blank_field has-error");errorMessage.remove();input.attr("aria-invalid",false);if(typeof describedBy!=="undefined"){describedBy=describedBy.replace(errorId,"");input.attr("aria-describedby",describedBy)}}function removeAllErrors(){jQuery(".form-field").removeClass("frm_blank_field has-error");
30
- jQuery(".form-field .frm_error").replaceWith("");jQuery(".frm_error_style").remove()}function scrollToFirstField(object){var field=jQuery(object).find(".frm_blank_field:first");if(field.length)frmFrontForm.scrollMsg(field,object,true)}function showSubmitLoading($object){showLoadingIndicator($object);disableSubmitButton($object);disableSaveDraft($object)}function showLoadingIndicator($object){if(!$object.hasClass("frm_loading_form")&&!$object.hasClass("frm_loading_prev")){addLoadingClass($object);
31
- $object.trigger("frmStartFormLoading")}}function addLoadingClass($object){var loadingClass=isGoingToPrevPage($object)?"frm_loading_prev":"frm_loading_form";$object.addClass(loadingClass)}function isGoingToPrevPage($object){return typeof frmProForm!=="undefined"&&frmProForm.goingToPreviousPage($object)}function removeSubmitLoading($object,enable,processesRunning){var loadingForm;if(processesRunning>0)return;loadingForm=jQuery(".frm_loading_form");loadingForm.removeClass("frm_loading_form");loadingForm.removeClass("frm_loading_prev");
32
- loadingForm.trigger("frmEndFormLoading");if(enable==="enable"){enableSubmitButton(loadingForm);enableSaveDraft(loadingForm)}}function showFileLoading(object){var fileval,loading=document.getElementById("frm_loading");if(loading!==null){fileval=jQuery(object).find("input[type=file]").val();if(typeof fileval!=="undefined"&&fileval!=="")setTimeout(function(){jQuery(loading).fadeIn("slow")},2E3)}}function clearDefault(){toggleDefault(jQuery(this),"clear")}function replaceDefault(){toggleDefault(jQuery(this),
33
- "replace")}function toggleDefault($thisField,e){var thisVal,v=$thisField.data("frmval").replace(/(\n|\r\n)/g,"\r");if(v===""||typeof v==="undefined")return false;thisVal=$thisField.val().replace(/(\n|\r\n)/g,"\r");if("replace"===e){if(thisVal==="")$thisField.addClass("frm_default").val(v)}else if(thisVal==v)$thisField.removeClass("frm_default").val("")}function resendEmail(){var $link=jQuery(this),entryId=this.getAttribute("data-eid"),formId=this.getAttribute("data-fid"),label=$link.find(".frm_link_label");
34
- if(label.length<1)label=$link;label.append('<span class="frm-wait"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:entryId,form_id:formId,nonce:frm_js.nonce},success:function(msg){var admin=document.getElementById("wpbody");if(admin===null)label.html(msg);else{label.html("");$link.after(msg)}}});return false}function confirmClick(){var message=jQuery(this).data("frmconfirm");return confirm(message)}function toggleDiv(){var div=jQuery(this).data("frmtoggle");
35
- if(jQuery(div).is(":visible"))jQuery(div).slideUp("fast");else jQuery(div).slideDown("fast");return false}function addIndexOfFallbackForIE8(){var len,from;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(elt){len=this.length>>>0;from=Number(arguments[1])||0;from=from<0?Math.ceil(from):Math.floor(from);if(from<0)from+=len;for(;from<len;from++)if(from in this&&this[from]===elt)return from;return-1}}function addTrimFallbackForIE8(){if(typeof String.prototype.trim!=="function")String.prototype.trim=
36
- function(){return this.replace(/^\s+|\s+$/g,"")}}function addFilterFallbackForIE8(){var t,len,res,thisp,i,val;if(!Array.prototype.filter)Array.prototype.filter=function(fun){if(this===void 0||this===null)throw new TypeError;t=Object(this);len=t.length>>>0;if(typeof fun!=="function")throw new TypeError;res=[];thisp=arguments[1];for(i=0;i<len;i++)if(i in t){val=t[i];if(fun.call(thisp,val,i,t))res.push(val)}return res}}function addKeysFallbackForIE8(){var keys,i;if(!Object.keys)Object.keys=function(obj){keys=
37
- [];for(i in obj)if(obj.hasOwnProperty(i))keys.push(i);return keys}}return{init:function(){jQuery(document).off("submit.formidable",".frm-show-form");jQuery(document).on("submit.formidable",".frm-show-form",frmFrontForm.submitForm);jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){if(jQuery(this).val()==="")jQuery(this).blur()});jQuery(document).on("focus",".frm_toggle_default",clearDefault);jQuery(document).on("blur",".frm_toggle_default",replaceDefault);jQuery(".frm_toggle_default").blur();
38
- jQuery(document.getElementById("frm_resend_email")).click(resendEmail);jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',frmFrontForm.fieldValueChanged);jQuery(document).on("change keyup",".frm-show-form .frm_inside_container input, .frm-show-form .frm_inside_container select, .frm-show-form .frm_inside_container textarea",maybeShowLabel);jQuery(document).on("click","a[data-frmconfirm]",confirmClick);
39
- jQuery("a[data-frmtoggle]").click(toggleDiv);addIndexOfFallbackForIE8();addTrimFallbackForIE8();addFilterFallbackForIE8();addKeysFallbackForIE8()},getFieldId:function(field,fullID){return getFieldId(field,fullID)},renderRecaptcha:function(captcha){var formID,recaptchaID,size=captcha.getAttribute("data-size"),rendered=captcha.getAttribute("data-rid")!==null,params={"sitekey":captcha.getAttribute("data-sitekey"),"size":size,"theme":captcha.getAttribute("data-theme")};if(rendered)return;if(size==="invisible"){formID=
40
- jQuery(captcha).closest("form").find('input[name="form_id"]').val();jQuery(captcha).closest(".frm_form_field .frm_primary_label").hide();params.callback=function(token){frmFrontForm.afterRecaptcha(token,formID)}}recaptchaID=grecaptcha.render(captcha.id,params);captcha.setAttribute("data-rid",recaptchaID)},afterSingleRecaptcha:function(){var object=jQuery(".frm-show-form .g-recaptcha").closest("form")[0];frmFrontForm.submitFormNow(object)},afterRecaptcha:function(token,formID){var object=jQuery("#frm_form_"+
41
- formID+"_container form")[0];frmFrontForm.submitFormNow(object)},submitForm:function(e){frmFrontForm.submitFormManual(e,this)},submitFormManual:function(e,object){var isPro,errors,invisibleRecaptcha=hasInvisibleRecaptcha(object),classList=object.className.trim().split(/\s+/gi);if(classList&&invisibleRecaptcha.length<1){isPro=classList.indexOf("frm_pro_form")>-1;if(!isPro)return}if(jQuery("body").hasClass("wp-admin")&&jQuery(object).closest(".frmapi-form").length<1)return;e.preventDefault();if(typeof frmProForm!==
42
- "undefined"&&typeof frmProForm.submitAllowed==="function")if(!frmProForm.submitAllowed(object))return;if(invisibleRecaptcha.length){showLoadingIndicator(jQuery(object));executeInvisibleRecaptcha(invisibleRecaptcha)}else{errors=frmFrontForm.validateFormSubmit(object);if(Object.keys(errors).length===0){showSubmitLoading(jQuery(object));frmFrontForm.submitFormNow(object,classList)}}},submitFormNow:function(object){var hasFileFields,classList=object.className.trim().split(/\s+/gi);if(classList.indexOf("frm_ajax_submit")>
43
- -1){hasFileFields=jQuery(object).find('input[type="file"]').filter(function(){return!!this.value}).length;if(hasFileFields<1){action=jQuery(object).find('input[name="frm_action"]').val();frmFrontForm.checkFormErrors(object,action)}else object.submit()}else object.submit()},validateFormSubmit:function(object){if(typeof tinyMCE!=="undefined"&&jQuery(object).find(".wp-editor-wrap").length)tinyMCE.triggerSave();jsErrors=[];if(shouldJSValidate(object)){frmFrontForm.getAjaxFormErrors(object);if(Object.keys(jsErrors).length)frmFrontForm.addAjaxFormErrors(object)}return jsErrors},
44
- getAjaxFormErrors:function(object){var customErrors,key;jsErrors=validateForm(object);if(typeof frmThemeOverride_jsErrors==="function"){action=jQuery(object).find('input[name="frm_action"]').val();customErrors=frmThemeOverride_jsErrors(action,object);if(Object.keys(customErrors).length)for(key in customErrors)jsErrors[key]=customErrors[key]}return jsErrors},addAjaxFormErrors:function(object){var key,$fieldCont;removeAllErrors();for(key in jsErrors){$fieldCont=jQuery(object).find("#frm_field_"+key+
45
- "_container");if($fieldCont.length)addFieldError($fieldCont,key,jsErrors);else delete jsErrors[key]}scrollToFirstField(object)},checkFormErrors:function(object,action){getFormErrors(object,action)},checkRequiredField:function(field,errors){return checkRequiredField(field,errors)},showSubmitLoading:function($object){showSubmitLoading($object)},removeSubmitLoading:function($object,enable,processesRunning){removeSubmitLoading($object,enable,processesRunning)},scrollToID:function(id){var object=jQuery(document.getElementById(id));
46
- frmFrontForm.scrollMsg(object,false)},scrollMsg:function(id,object,animate){var newPos,m,b,screenTop,screenBottom,scrollObj="";if(typeof object==="undefined"){scrollObj=jQuery(document.getElementById("frm_form_"+id+"_container"));if(scrollObj.length<1)return}else if(typeof id==="string")scrollObj=jQuery(object).find("#frm_field_"+id+"_container");else scrollObj=id;scrollObj.focus();newPos=scrollObj.offset().top;if(!newPos||frm_js.offset==="-1")return;newPos=newPos-frm_js.offset;m=jQuery("html").css("margin-top");
47
- b=jQuery("body").css("margin-top");if(m||b)newPos=newPos-parseInt(m)-parseInt(b);if(newPos&&window.innerHeight){screenTop=document.documentElement.scrollTop||document.body.scrollTop;screenBottom=screenTop+window.innerHeight;if(newPos>screenBottom||newPos<screenTop){if(typeof animate==="undefined")jQuery(window).scrollTop(newPos);else jQuery("html,body").animate({scrollTop:newPos},500);return false}}},fieldValueChanged:function(e){var fieldId=frmFrontForm.getFieldId(this,false);if(!fieldId||typeof fieldId===
48
- "undefined")return;if(e.frmTriggered&&e.frmTriggered==fieldId)return;jQuery(document).trigger("frmFieldChanged",[this,fieldId,e]);if(e.selfTriggered!==true)maybeValidateChange(fieldId,this)},savingDraft:function(object){console.warn("DEPRECATED: function frmFrontForm.savingDraft in v3.0 use frmProForm.savingDraft");if(typeof frmProForm!=="undefined")return frmProForm.savingDraft(object)},goingToPreviousPage:function(object){console.warn("DEPRECATED: function frmFrontForm.goingToPreviousPage in v3.0 use frmProForm.goingToPreviousPage");
49
- if(typeof frmProForm!=="undefined")return frmProForm.goingToPreviousPage(object)},hideOrShowFields:function(){console.warn("DEPRECATED: function frmFrontForm.hideOrShowFields in v3.0 use frmProForm.hideOrShowFields");if(typeof frmProForm!=="undefined")frmProForm.hideOrShowFields()},hidePreviouslyHiddenFields:function(){console.warn("DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields");if(typeof frmProForm!=="undefined")frmProForm.hidePreviouslyHiddenFields()},
50
- checkDependentDynamicFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentDynamicFields(ids)},checkDependentLookupFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentLookupFields(ids)},loadGoogle:function(){console.warn("DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle");
51
- frmProForm.loadGoogle()},escapeHtml:function(text){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},invisible:function(classes){jQuery(classes).css("visibility","hidden")},visible:function(classes){jQuery(classes).css("visibility","visible")}}}frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(){frmFrontForm.init()});
52
- function frmRecaptcha(){var c,cl,captchas=jQuery(".frm-g-recaptcha");for(c=0,cl=captchas.length;c<cl;c++)frmFrontForm.renderRecaptcha(captchas[c])}function frmAfterRecaptcha(token){frmFrontForm.afterSingleRecaptcha(token)}
 
53
  function frmUpdateField(entryId,fieldId,value,message,num){jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:entryId,field_id:fieldId,value:value,nonce:frm_js.nonce},success:function(){if(message.replace(/^\s+|\s+$/g,"")==="")jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).fadeOut("slow");else jQuery(document.getElementById("frm_update_field_"+
54
  entryId+"_"+fieldId+"_"+num)).replaceWith(message)}})}
55
  function frmDeleteEntry(entryId,prefix){console.warn("DEPRECATED: function frmDeleteEntry in v2.0.13 use frmFrontForm.deleteEntry");jQuery(document.getElementById("frm_delete_"+entryId)).replaceWith('<span class="frm-loading-img" id="frm_delete_'+entryId+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:entryId,nonce:frm_js.nonce},success:function(html){if(html.replace(/^\s+|\s+$/g,"")==="success")jQuery(document.getElementById(prefix+entryId)).fadeOut("slow");
2
  function frmFrontFormJS(){var action="";var jsErrors=[];function maybeShowLabel(){var $field=jQuery(this),$label=$field.closest(".frm_inside_container").find(".frm_primary_label"),val=$field.val();if(val!==null&&val.length>0)$label.addClass("frm_visible");else $label.removeClass("frm_visible")}function getFieldId(field,fullID){var nameParts,fieldId,isRepeating=false,fieldName="";if(field instanceof jQuery)fieldName=field.attr("name");else fieldName=field.name;if(typeof fieldName==="undefined")fieldName=
3
  "";if(fieldName===""){if(field instanceof jQuery)fieldName=field.data("name");else fieldName=field.getAttribute("data-name");if(typeof fieldName==="undefined")fieldName="";if(fieldName!==""&&fieldName)return fieldName;return 0}nameParts=fieldName.replace("item_meta[","").replace("[]","").split("]");if(nameParts.length<1)return 0;nameParts=nameParts.filter(function(n){return n!==""});fieldId=nameParts[0];if(nameParts.length===1)return fieldId;if(nameParts[1]==="[form"||nameParts[1]==="[row_ids")return 0;
4
  if(jQuery('input[name="item_meta['+fieldId+'][form]"]').length){fieldId=nameParts[2].replace("[","");isRepeating=true}if("other"===fieldId)if(isRepeating)fieldId=nameParts[3].replace("[","");else fieldId=nameParts[1].replace("[","");if(fullID===true)if(fieldId===nameParts[0])fieldId=fieldId+"-"+nameParts[1].replace("[","");else fieldId=fieldId+"-"+nameParts[0]+"-"+nameParts[1].replace("[","");return fieldId}function disableSubmitButton($form){$form.find('input[type="submit"], input[type="button"], button[type="submit"]').attr("disabled",
5
+ "disabled")}function enableSubmitButton($form){$form.find('input[type="submit"], input[type="button"], button[type="submit"]').removeAttr("disabled")}function disableSaveDraft($form){$form.find("a.frm_save_draft").css("pointer-events","none")}function enableSaveDraft($form){$form.find("a.frm_save_draft").css("pointer-events","")}function validateForm(object){var r,rl,n,nl,fields,field,value,requiredFields,errors=[];requiredFields=jQuery(object).find(".frm_required_field:visible input, .frm_required_field:visible select, .frm_required_field:visible textarea").filter(":not(.frm_optional)");
6
+ if(requiredFields.length)for(r=0,rl=requiredFields.length;r<rl;r++)errors=checkRequiredField(requiredFields[r],errors);fields=jQuery(object).find("input,select,textarea");if(fields.length)for(n=0,nl=fields.length;n<nl;n++){field=fields[n];value=field.value;if(value!=="")if(field.type==="hidden");else if(field.type==="number")errors=checkNumberField(field,errors);else if(field.type==="email")errors=checkEmailField(field,errors);else if(field.type==="password")errors=checkPasswordField(field,errors);
7
+ else if(field.type==="url")errors=checkUrlField(field,errors);else if(field.pattern!==null)errors=checkPatternField(field,errors)}errors=validateRecaptcha(object,errors);return errors}function maybeValidateChange(fieldId,field){if(field.type==="url")maybeAddHttpToUrl(field);if(jQuery(field).closest("form").hasClass("frm_js_validate"))validateField(fieldId,field)}function maybeAddHttpToUrl(field){var url=field.value;var matches=url.match(/^(https?|ftps?|mailto|news|feed|telnet):/);if(field.value!==
8
+ ""&&matches===null)field.value="http://"+url}function validateField(fieldId,field){var key,errors=[];var $fieldCont=jQuery(field).closest(".frm_form_field");if($fieldCont.hasClass("frm_required_field")&&!jQuery(field).hasClass("frm_optional"))errors=checkRequiredField(field,errors);if(errors.length<1)if(field.type==="email")errors=checkEmailField(field,errors);else if(field.type==="password")errors=checkPasswordField(field,errors);else if(field.type==="number")errors=checkNumberField(field,errors);
9
+ else if(field.type==="url")errors=checkUrlField(field,errors);else if(field.pattern!==null)errors=checkPatternField(field,errors);removeFieldError($fieldCont);if(Object.keys(errors).length>0)for(key in errors)addFieldError($fieldCont,key,errors)}function checkRequiredField(field,errors){var checkGroup,fieldClasses,tempVal,i,placeholder,val="",fieldID="",fileID=field.getAttribute("data-frmfile");if(field.type==="hidden"&&fileID===null)return errors;if(field.type==="checkbox"||field.type==="radio"){checkGroup=
10
+ jQuery('input[name="'+field.name+'"]').closest(".frm_required_field").find("input:checked");jQuery(checkGroup).each(function(){val=this.value})}else if(field.type==="file"||fileID){if(typeof fileID==="undefined"){fileID=getFieldId(field,true);fileID=fileID.replace("file","")}if(typeof errors[fileID]==="undefined")val=getFileVals(fileID);fieldID=fileID}else{fieldClasses=field.className;if(fieldClasses.indexOf("frm_pos_none")!==-1)return errors;val=jQuery(field).val();if(val===null)val="";else if(typeof val!==
11
+ "string"){tempVal=val;val="";for(i=0;i<tempVal.length;i++)if(tempVal[i]!=="")val=tempVal[i]}if(fieldClasses.indexOf("frm_other_input")===-1)fieldID=getFieldId(field,true);else fieldID=getFieldId(field,false);if(fieldClasses.indexOf("frm_time_select")!==-1)fieldID=fieldID.replace("-H","").replace("-m","");placeholder=field.getAttribute("data-frmplaceholder");if(placeholder!==null&&val===placeholder)val=""}if(val===""){if(fieldID==="")fieldID=getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=
12
+ getFieldValidationMessage(field,"data-reqmsg")}return errors}function getFileVals(fileID){var val="",fileFields=jQuery('input[name="file'+fileID+'"], input[name="file'+fileID+'[]"], input[name^="item_meta['+fileID+']"]');fileFields.each(function(){if(val==="")val=this.value});return val}function checkUrlField(field,errors){var fieldID,url=field.value;if(url!==""&&!/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i.test(url)){fieldID=getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=
13
+ getFieldValidationMessage(field,"data-invmsg")}return errors}function checkEmailField(field,errors){var fieldID=getFieldId(field,true),pattern=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;if(""!==field.value&&pattern.test(field.value)===false)errors[fieldID]=getFieldValidationMessage(field,"data-invmsg");confirmField(field,errors);return errors}function checkPasswordField(field,errors){confirmField(field,
14
+ errors);return errors}function confirmField(field,errors){var value,confirmValue,firstField,fieldID=getFieldId(field,true),strippedId=field.id.replace("conf_",""),strippedFieldID=fieldID.replace("conf_",""),confirmField=document.getElementById(strippedId.replace("field_","field_conf_"));if(confirmField===null||typeof errors["conf_"+strippedFieldID]!=="undefined")return;if(fieldID!==strippedFieldID){firstField=document.getElementById(strippedId);value=firstField.value;confirmValue=confirmField.value;
15
+ if(""!==value&&""!==confirmValue&&value!==confirmValue)errors["conf_"+strippedFieldID]=getFieldValidationMessage(confirmField,"data-confmsg")}else validateField("conf_"+strippedFieldID,confirmField)}function checkNumberField(field,errors){var fieldID,number=field.value;if(number!==""&&isNaN(number/1)!==false){fieldID=getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}return errors}function checkPatternField(field,errors){var fieldID,text=
16
+ field.value,format=getFieldValidationMessage(field,"pattern");if(format!==""&&text!==""){fieldID=getFieldId(field,true);if(!(fieldID in errors)){format=new RegExp("^"+format+"$","i");if(format.test(text)===false)errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}}return errors}function hasInvisibleRecaptcha(object){var recaptcha,recaptchaID,alreadyChecked;if(isGoingToPrevPage(object))return false;recaptcha=jQuery(object).find('.frm-g-recaptcha[data-size="invisible"], .g-recaptcha[data-size="invisible"]');
17
+ if(recaptcha.length){recaptchaID=recaptcha.data("rid");alreadyChecked=grecaptcha.getResponse(recaptchaID);if(alreadyChecked.length===0)return recaptcha;else return false}else return false}function executeInvisibleRecaptcha(invisibleRecaptcha){var recaptchaID=invisibleRecaptcha.data("rid");grecaptcha.reset(recaptchaID);grecaptcha.execute(recaptchaID)}function validateRecaptcha(form,errors){var recaptchaID,response,fieldContainer,fieldID,$recaptcha=jQuery(form).find(".frm-g-recaptcha");if($recaptcha.length){recaptchaID=
18
+ $recaptcha.data("rid");try{response=grecaptcha.getResponse(recaptchaID)}catch(e){if(jQuery(form).find('input[name="recaptcha_checked"]').length)return errors;else response=""}if(response.length===0){fieldContainer=$recaptcha.closest(".frm_form_field");fieldID=fieldContainer.attr("id").replace("frm_field_","").replace("_container","");errors[fieldID]=""}}return errors}function getFieldValidationMessage(field,messageType){var msg=field.getAttribute(messageType);if(msg===null)msg="";return msg}function shouldJSValidate(object){var validate=
19
+ jQuery(object).hasClass("frm_js_validate");if(validate&&typeof frmProForm!=="undefined"&&(frmProForm.savingDraft(object)||frmProForm.goingToPreviousPage(object)))validate=false;return validate}function getFormErrors(object,action){var fieldset;if(typeof action==="undefined")jQuery(object).find('input[name="frm_action"]').val();fieldset=jQuery(object).find(".frm_form_field");fieldset.addClass("frm_doing_ajax");jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:jQuery(object).serialize()+"&action=frm_entries_"+
20
+ action+"&nonce="+frm_js.nonce,success:function(response){var formID,replaceContent,pageOrder,formReturned,contSubmit,delay,$fieldCont,key,inCollapsedSection,frmTrigger,defaultResponse={"content":"","errors":{},"pass":false};if(response===null)response=defaultResponse;response=response.replace(/^\s+|\s+$/g,"");if(response.indexOf("{")===0)response=jQuery.parseJSON(response);else response=defaultResponse;if(typeof response.redirect!=="undefined"){jQuery(document).trigger("frmBeforeFormRedirect",[object,
21
+ response]);window.location=response.redirect}else if(response.content!==""){removeSubmitLoading(jQuery(object));if(frm_js.offset!=-1)frmFrontForm.scrollMsg(jQuery(object),false);formID=jQuery(object).find('input[name="form_id"]').val();response.content=response.content.replace(/ frm_pro_form /g," frm_pro_form frm_no_hide ");replaceContent=jQuery(object).closest(".frm_forms");removeAddedScripts(replaceContent,formID);delay=maybeSlideOut(replaceContent,response.content);setTimeout(function(){var container,
22
+ input,previousInput;replaceContent.replaceWith(response.content);addUrlParam(response);if(typeof frmThemeOverride_frmAfterSubmit==="function"){pageOrder=jQuery('input[name="frm_page_order_'+formID+'"]').val();formReturned=jQuery(response.content).find('input[name="form_id"]').val();frmThemeOverride_frmAfterSubmit(formReturned,pageOrder,response.content,object)}if(typeof response.recaptcha!=="undefined"){container=jQuery("#frm_form_"+formID+"_container").find(".frm_fields_container");input='<input type="hidden" name="recaptcha_checked" value="'+
23
+ response.recaptcha+'">';previousInput=container.find('input[name="recaptcha_checked"]');if(previousInput.length)previousInput.replaceWith(input);else container.append(input)}afterFormSubmitted(object,response)},delay)}else if(Object.keys(response.errors).length){removeSubmitLoading(jQuery(object),"enable");contSubmit=true;removeAllErrors();$fieldCont=null;for(key in response.errors){$fieldCont=jQuery(object).find("#frm_field_"+key+"_container");if($fieldCont.length){if(!$fieldCont.is(":visible")){inCollapsedSection=
24
+ $fieldCont.closest(".frm_toggle_container");if(inCollapsedSection.length){frmTrigger=inCollapsedSection.prev();if(!frmTrigger.hasClass("frm_trigger"))frmTrigger=frmTrigger.prev(".frm_trigger");frmTrigger.click()}}if($fieldCont.is(":visible")){addFieldError($fieldCont,key,response.errors);contSubmit=false}}}jQuery(object).find(".frm-g-recaptcha, .g-recaptcha").each(function(){var $recaptcha=jQuery(this),recaptchaID=$recaptcha.data("rid");if(typeof grecaptcha!=="undefined"&&grecaptcha)if(recaptchaID)grecaptcha.reset(recaptchaID);
25
+ else grecaptcha.reset()});jQuery(document).trigger("frmFormErrors",[object,response]);fieldset.removeClass("frm_doing_ajax");scrollToFirstField(object);if(contSubmit)object.submit();else jQuery(object).prepend(response.error_message)}else{showFileLoading(object);object.submit()}},error:function(){jQuery(object).find('input[type="submit"], input[type="button"]').removeAttr("disabled");object.submit()}})}function afterFormSubmitted(object,response){var formCompleted=jQuery(response.content).find(".frm_message");
26
+ if(formCompleted.length)jQuery(document).trigger("frmFormComplete",[object,response]);else jQuery(document).trigger("frmPageChanged",[object,response])}function removeAddedScripts(formContainer,formID){var endReplace=jQuery(".frm_end_ajax_"+formID);if(endReplace.length){formContainer.nextUntil(".frm_end_ajax_"+formID).remove();endReplace.remove()}}function maybeSlideOut(oldContent,newContent){var c,newClass="frm_slideout";if(newContent.indexOf(" frm_slide")!==-1){c=oldContent.children();if(newContent.indexOf(" frm_going_back")!==
27
+ -1)newClass+=" frm_going_back";c.removeClass("frm_going_back");c.addClass(newClass);return 300}return 0}function addUrlParam(response){var url;if(history.pushState&&typeof response.page!=="undefined"){url=addQueryVar("frm_page",response.page);window.history.pushState({"html":response.html},"","?"+url)}}function addQueryVar(key,value){var kvp,i,x;key=encodeURI(key);value=encodeURI(value);kvp=document.location.search.substr(1).split("&");i=kvp.length;while(i--){x=kvp[i].split("=");if(x[0]==key){x[1]=
28
+ value;kvp[i]=x.join("=");break}}if(i<0)kvp[kvp.length]=[key,value].join("=");return kvp.join("&")}function addFieldError($fieldCont,key,jsErrors){var input,id,describedBy;if($fieldCont.length&&$fieldCont.is(":visible")){$fieldCont.addClass("frm_blank_field");input=$fieldCont.find("input, select, textarea");id="frm_error_field_"+key;describedBy=input.attr("aria-describedby");if(typeof frmThemeOverride_frmPlaceError==="function")frmThemeOverride_frmPlaceError(key,jsErrors);else{$fieldCont.append('<div class="frm_error" id="'+
29
+ id+'">'+jsErrors[key]+"</div>");if(typeof describedBy==="undefined")describedBy=id;else if(describedBy.indexOf(id)===-1)describedBy=describedBy+" "+id;input.attr("aria-describedby",describedBy)}input.attr("aria-invalid",true);jQuery(document).trigger("frmAddFieldError",[$fieldCont,key,jsErrors])}}function removeFieldError($fieldCont){var errorMessage=$fieldCont.find(".frm_error"),errorId=errorMessage.attr("id"),input=$fieldCont.find("input, select, textarea"),describedBy=input.attr("aria-describedby");
30
+ $fieldCont.removeClass("frm_blank_field has-error");errorMessage.remove();input.attr("aria-invalid",false);if(typeof describedBy!=="undefined"){describedBy=describedBy.replace(errorId,"");input.attr("aria-describedby",describedBy)}}function removeAllErrors(){jQuery(".form-field").removeClass("frm_blank_field has-error");jQuery(".form-field .frm_error").replaceWith("");jQuery(".frm_error_style").remove()}function scrollToFirstField(object){var field=jQuery(object).find(".frm_blank_field:first");if(field.length)frmFrontForm.scrollMsg(field,
31
+ object,true)}function showSubmitLoading($object){showLoadingIndicator($object);disableSubmitButton($object);disableSaveDraft($object)}function showLoadingIndicator($object){if(!$object.hasClass("frm_loading_form")&&!$object.hasClass("frm_loading_prev")){addLoadingClass($object);$object.trigger("frmStartFormLoading")}}function addLoadingClass($object){var loadingClass=isGoingToPrevPage($object)?"frm_loading_prev":"frm_loading_form";$object.addClass(loadingClass)}function isGoingToPrevPage($object){return typeof frmProForm!==
32
+ "undefined"&&frmProForm.goingToPreviousPage($object)}function removeSubmitLoading($object,enable,processesRunning){var loadingForm;if(processesRunning>0)return;loadingForm=jQuery(".frm_loading_form");loadingForm.removeClass("frm_loading_form");loadingForm.removeClass("frm_loading_prev");loadingForm.trigger("frmEndFormLoading");if(enable==="enable"){enableSubmitButton(loadingForm);enableSaveDraft(loadingForm)}}function showFileLoading(object){var fileval,loading=document.getElementById("frm_loading");
33
+ if(loading!==null){fileval=jQuery(object).find("input[type=file]").val();if(typeof fileval!=="undefined"&&fileval!=="")setTimeout(function(){jQuery(loading).fadeIn("slow")},2E3)}}function clearDefault(){toggleDefault(jQuery(this),"clear")}function replaceDefault(){toggleDefault(jQuery(this),"replace")}function toggleDefault($thisField,e){var thisVal,v=$thisField.data("frmval").replace(/(\n|\r\n)/g,"\r");if(v===""||typeof v==="undefined")return false;thisVal=$thisField.val().replace(/(\n|\r\n)/g,"\r");
34
+ if("replace"===e){if(thisVal==="")$thisField.addClass("frm_default").val(v)}else if(thisVal==v)$thisField.removeClass("frm_default").val("")}function resendEmail(){var $link=jQuery(this),entryId=this.getAttribute("data-eid"),formId=this.getAttribute("data-fid"),label=$link.find(".frm_link_label");if(label.length<1)label=$link;label.append('<span class="frm-wait"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:entryId,form_id:formId,nonce:frm_js.nonce},
35
+ success:function(msg){var admin=document.getElementById("wpbody");if(admin===null)label.html(msg);else{label.html("");$link.after(msg)}}});return false}function confirmClick(){var message=jQuery(this).data("frmconfirm");return confirm(message)}function toggleDiv(){var div=jQuery(this).data("frmtoggle");if(jQuery(div).is(":visible"))jQuery(div).slideUp("fast");else jQuery(div).slideDown("fast");return false}function addIndexOfFallbackForIE8(){var len,from;if(!Array.prototype.indexOf)Array.prototype.indexOf=
36
+ function(elt){len=this.length>>>0;from=Number(arguments[1])||0;from=from<0?Math.ceil(from):Math.floor(from);if(from<0)from+=len;for(;from<len;from++)if(from in this&&this[from]===elt)return from;return-1}}function addTrimFallbackForIE8(){if(typeof String.prototype.trim!=="function")String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}function addFilterFallbackForIE8(){var t,len,res,thisp,i,val;if(!Array.prototype.filter)Array.prototype.filter=function(fun){if(this===void 0||this===
37
+ null)throw new TypeError;t=Object(this);len=t.length>>>0;if(typeof fun!=="function")throw new TypeError;res=[];thisp=arguments[1];for(i=0;i<len;i++)if(i in t){val=t[i];if(fun.call(thisp,val,i,t))res.push(val)}return res}}function addKeysFallbackForIE8(){var keys,i;if(!Object.keys)Object.keys=function(obj){keys=[];for(i in obj)if(obj.hasOwnProperty(i))keys.push(i);return keys}}return{init:function(){jQuery(document).off("submit.formidable",".frm-show-form");jQuery(document).on("submit.formidable",
38
+ ".frm-show-form",frmFrontForm.submitForm);jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){if(jQuery(this).val()==="")jQuery(this).blur()});jQuery(document).on("focus",".frm_toggle_default",clearDefault);jQuery(document).on("blur",".frm_toggle_default",replaceDefault);jQuery(".frm_toggle_default").blur();jQuery(document.getElementById("frm_resend_email")).click(resendEmail);jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',
39
+ frmFrontForm.fieldValueChanged);jQuery(document).on("change keyup",".frm-show-form .frm_inside_container input, .frm-show-form .frm_inside_container select, .frm-show-form .frm_inside_container textarea",maybeShowLabel);jQuery(document).on("click","a[data-frmconfirm]",confirmClick);jQuery("a[data-frmtoggle]").click(toggleDiv);addIndexOfFallbackForIE8();addTrimFallbackForIE8();addFilterFallbackForIE8();addKeysFallbackForIE8()},getFieldId:function(field,fullID){return getFieldId(field,fullID)},renderRecaptcha:function(captcha){var formID,
40
+ recaptchaID,size=captcha.getAttribute("data-size"),rendered=captcha.getAttribute("data-rid")!==null,params={"sitekey":captcha.getAttribute("data-sitekey"),"size":size,"theme":captcha.getAttribute("data-theme")};if(rendered)return;if(size==="invisible"){formID=jQuery(captcha).closest("form").find('input[name="form_id"]').val();jQuery(captcha).closest(".frm_form_field .frm_primary_label").hide();params.callback=function(token){frmFrontForm.afterRecaptcha(token,formID)}}recaptchaID=grecaptcha.render(captcha.id,
41
+ params);captcha.setAttribute("data-rid",recaptchaID)},afterSingleRecaptcha:function(){var object=jQuery(".frm-show-form .g-recaptcha").closest("form")[0];frmFrontForm.submitFormNow(object)},afterRecaptcha:function(token,formID){var object=jQuery("#frm_form_"+formID+"_container form")[0];frmFrontForm.submitFormNow(object)},submitForm:function(e){frmFrontForm.submitFormManual(e,this)},submitFormManual:function(e,object){var isPro,errors,invisibleRecaptcha=hasInvisibleRecaptcha(object),classList=object.className.trim().split(/\s+/gi);
42
+ if(classList&&invisibleRecaptcha.length<1){isPro=classList.indexOf("frm_pro_form")>-1;if(!isPro)return}if(jQuery("body").hasClass("wp-admin")&&jQuery(object).closest(".frmapi-form").length<1)return;e.preventDefault();if(typeof frmProForm!=="undefined"&&typeof frmProForm.submitAllowed==="function")if(!frmProForm.submitAllowed(object))return;if(invisibleRecaptcha.length){showLoadingIndicator(jQuery(object));executeInvisibleRecaptcha(invisibleRecaptcha)}else{errors=frmFrontForm.validateFormSubmit(object);
43
+ if(Object.keys(errors).length===0){showSubmitLoading(jQuery(object));frmFrontForm.submitFormNow(object,classList)}}},submitFormNow:function(object){var hasFileFields,classList=object.className.trim().split(/\s+/gi);if(classList.indexOf("frm_ajax_submit")>-1){hasFileFields=jQuery(object).find('input[type="file"]').filter(function(){return!!this.value}).length;if(hasFileFields<1){action=jQuery(object).find('input[name="frm_action"]').val();frmFrontForm.checkFormErrors(object,action)}else object.submit()}else object.submit()},
44
+ validateFormSubmit:function(object){if(typeof tinyMCE!=="undefined"&&jQuery(object).find(".wp-editor-wrap").length)tinyMCE.triggerSave();jsErrors=[];if(shouldJSValidate(object)){frmFrontForm.getAjaxFormErrors(object);if(Object.keys(jsErrors).length)frmFrontForm.addAjaxFormErrors(object)}return jsErrors},getAjaxFormErrors:function(object){var customErrors,key;jsErrors=validateForm(object);if(typeof frmThemeOverride_jsErrors==="function"){action=jQuery(object).find('input[name="frm_action"]').val();
45
+ customErrors=frmThemeOverride_jsErrors(action,object);if(Object.keys(customErrors).length)for(key in customErrors)jsErrors[key]=customErrors[key]}return jsErrors},addAjaxFormErrors:function(object){var key,$fieldCont;removeAllErrors();for(key in jsErrors){$fieldCont=jQuery(object).find("#frm_field_"+key+"_container");if($fieldCont.length)addFieldError($fieldCont,key,jsErrors);else delete jsErrors[key]}scrollToFirstField(object)},checkFormErrors:function(object,action){getFormErrors(object,action)},
46
+ checkRequiredField:function(field,errors){return checkRequiredField(field,errors)},showSubmitLoading:function($object){showSubmitLoading($object)},removeSubmitLoading:function($object,enable,processesRunning){removeSubmitLoading($object,enable,processesRunning)},scrollToID:function(id){var object=jQuery(document.getElementById(id));frmFrontForm.scrollMsg(object,false)},scrollMsg:function(id,object,animate){var newPos,m,b,screenTop,screenBottom,scrollObj="";if(typeof object==="undefined"){scrollObj=
47
+ jQuery(document.getElementById("frm_form_"+id+"_container"));if(scrollObj.length<1)return}else if(typeof id==="string")scrollObj=jQuery(object).find("#frm_field_"+id+"_container");else scrollObj=id;scrollObj.focus();newPos=scrollObj.offset().top;if(!newPos||frm_js.offset==="-1")return;newPos=newPos-frm_js.offset;m=jQuery("html").css("margin-top");b=jQuery("body").css("margin-top");if(m||b)newPos=newPos-parseInt(m)-parseInt(b);if(newPos&&window.innerHeight){screenTop=document.documentElement.scrollTop||
48
+ document.body.scrollTop;screenBottom=screenTop+window.innerHeight;if(newPos>screenBottom||newPos<screenTop){if(typeof animate==="undefined")jQuery(window).scrollTop(newPos);else jQuery("html,body").animate({scrollTop:newPos},500);return false}}},fieldValueChanged:function(e){var fieldId=frmFrontForm.getFieldId(this,false);if(!fieldId||typeof fieldId==="undefined")return;if(e.frmTriggered&&e.frmTriggered==fieldId)return;jQuery(document).trigger("frmFieldChanged",[this,fieldId,e]);if(e.selfTriggered!==
49
+ true)maybeValidateChange(fieldId,this)},savingDraft:function(object){console.warn("DEPRECATED: function frmFrontForm.savingDraft in v3.0 use frmProForm.savingDraft");if(typeof frmProForm!=="undefined")return frmProForm.savingDraft(object)},goingToPreviousPage:function(object){console.warn("DEPRECATED: function frmFrontForm.goingToPreviousPage in v3.0 use frmProForm.goingToPreviousPage");if(typeof frmProForm!=="undefined")return frmProForm.goingToPreviousPage(object)},hideOrShowFields:function(){console.warn("DEPRECATED: function frmFrontForm.hideOrShowFields in v3.0 use frmProForm.hideOrShowFields");
50
+ if(typeof frmProForm!=="undefined")frmProForm.hideOrShowFields()},hidePreviouslyHiddenFields:function(){console.warn("DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields");if(typeof frmProForm!=="undefined")frmProForm.hidePreviouslyHiddenFields()},checkDependentDynamicFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields");if(typeof frmProForm!==
51
+ "undefined")frmProForm.checkDependentDynamicFields(ids)},checkDependentLookupFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentLookupFields(ids)},loadGoogle:function(){console.warn("DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle");frmProForm.loadGoogle()},escapeHtml:function(text){return text.replace(/&/g,"&amp;").replace(/</g,
52
+ "&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},invisible:function(classes){jQuery(classes).css("visibility","hidden")},visible:function(classes){jQuery(classes).css("visibility","visible")}}}frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(){frmFrontForm.init()});function frmRecaptcha(){var c,cl,captchas=jQuery(".frm-g-recaptcha");for(c=0,cl=captchas.length;c<cl;c++)frmFrontForm.renderRecaptcha(captchas[c])}
53
+ function frmAfterRecaptcha(token){frmFrontForm.afterSingleRecaptcha(token)}
54
  function frmUpdateField(entryId,fieldId,value,message,num){jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:entryId,field_id:fieldId,value:value,nonce:frm_js.nonce},success:function(){if(message.replace(/^\s+|\s+$/g,"")==="")jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).fadeOut("slow");else jQuery(document.getElementById("frm_update_field_"+
55
  entryId+"_"+fieldId+"_"+num)).replaceWith(message)}})}
56
  function frmDeleteEntry(entryId,prefix){console.warn("DEPRECATED: function frmDeleteEntry in v2.0.13 use frmFrontForm.deleteEntry");jQuery(document.getElementById("frm_delete_"+entryId)).replaceWith('<span class="frm-loading-img" id="frm_delete_'+entryId+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:entryId,nonce:frm_js.nonce},success:function(html){if(html.replace(/^\s+|\s+$/g,"")==="success")jQuery(document.getElementById(prefix+entryId)).fadeOut("slow");
js/formidable_admin.js CHANGED
@@ -300,7 +300,8 @@ function frmAdminBuildJS() {
300
  cancelSort = false,
301
  copyHelper = false,
302
  fieldsUpdated = 0,
303
- thisFormId = 0;
 
304
 
305
  if ( thisForm !== null ) {
306
  thisFormId = thisForm.value;
@@ -494,7 +495,9 @@ function frmAdminBuildJS() {
494
 
495
  function loadTooltips() {
496
  var wrapClass = jQuery( '.wrap, .frm_wrap' ),
497
- confirmModal = document.getElementById( 'frm_confirm_modal' );
 
 
498
 
499
  jQuery( confirmModal ).on( 'click', '[data-deletefield]', deleteFieldConfirmed );
500
  jQuery( confirmModal ).on( 'click', '[data-removeid]', removeThisTag );
@@ -514,6 +517,39 @@ function frmAdminBuildJS() {
514
  });
515
 
516
  jQuery( '.frm_bstooltip, .frm_help' ).tooltip( );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
  }
518
 
519
  function removeThisTag() {
@@ -2329,6 +2365,146 @@ function frmAdminBuildJS() {
2329
  return false;
2330
  }
2331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2332
  function updateGetValueFieldSelection() {
2333
  /*jshint validthis:true */
2334
  var fieldID = this.id.replace( 'get_values_form_', '' );
@@ -3183,6 +3359,37 @@ function frmAdminBuildJS() {
3183
  return false;
3184
  }
3185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3186
  /**
3187
  * Get rid of empty container that inserts extra space.
3188
  */
@@ -3391,6 +3598,7 @@ function frmAdminBuildJS() {
3391
  function afterFormSave( $button, buttonVal ) {
3392
  $button.removeClass( 'frm_loading_form' ).removeClass( 'frm_loading_button' );
3393
  $button.html( frm_admin_js.saved );
 
3394
  fieldsUpdated = 0;
3395
 
3396
  setTimeout( function() {
@@ -5052,8 +5260,9 @@ function frmAdminBuildJS() {
5052
 
5053
  multiselectAccessibility();
5054
  },
5055
- onChange: function( event ) {
5056
  multiselectAccessibility();
 
5057
  }
5058
  });
5059
  });
@@ -5098,25 +5307,10 @@ function frmAdminBuildJS() {
5098
  plugin: plugin
5099
  },
5100
  success: function( response ) {
5101
- // If there is a WP Error instance, output it here and quit the script.
5102
- if ( response.error ) {
5103
- addonError( response, el, button );
5104
- return;
5105
- }
5106
-
5107
- // If we need more credentials, output the form sent back to us.
5108
- if ( response.form ) {
5109
- // Display the form to gather the users credentials.
5110
-
5111
- button.append( '<div class="frm-addon-error frm_error_style">' + response.form + '</div>' );
5112
- loader.hide();
5113
-
5114
- // Add a disabled attribute the install button if the creds are needed.
5115
- button.attr( 'disabled', true );
5116
-
5117
- el.on( 'click', '#upgrade', 'installAddonWithCreds' );
5118
 
5119
- // No need to move further if we need to enter our creds.
 
5120
  return;
5121
  }
5122
 
@@ -5133,8 +5327,9 @@ function frmAdminBuildJS() {
5133
  e.preventDefault();
5134
 
5135
  // Now let's make another Ajax request once the user has submitted their credentials.
5136
- var proceed = jQuery( this );
5137
- var el = proceed.parent().parent();
 
5138
 
5139
  proceed.addClass( 'frm_loading_button' );
5140
 
@@ -5153,17 +5348,10 @@ function frmAdminBuildJS() {
5153
  password: el.find( '#password' ).val()
5154
  },
5155
  success: function( response ) {
5156
- // If there is a WP Error instance, output it here and quit the script.
5157
- if ( response.error ) {
5158
- addonError( response, el, button );
5159
- return;
5160
- }
5161
 
5162
- if ( response.form ) {
5163
- loader.hide();
5164
- jQuery( '.frm-inline-error' ).remove();
5165
- //proceed.val(admin.proceed);
5166
- //proceed.after('<span class="frm-inline-error">' + admin.connect_error + '</span>' );
5167
  return;
5168
  }
5169
 
@@ -5196,10 +5384,42 @@ function frmAdminBuildJS() {
5196
  }
5197
  }
5198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5199
  function addonError( response, el, button ) {
5200
- el.append( '<div class="frm-addon-error frm_error_style"><p><strong>' + response.error + '</strong></p></div>' );
5201
- button.removeClass( 'frm_loading_button' );
5202
- jQuery( '.frm-addon-error' ).delay( 4000 ).fadeOut();
 
 
 
 
 
 
 
 
 
 
5203
  }
5204
 
5205
  /* Templates */
@@ -5819,6 +6039,8 @@ function frmAdminBuildJS() {
5819
  });
5820
  clickTab( jQuery( '.starttab a' ), 'auto' );
5821
 
 
 
5822
  // submit the search form with dropdown
5823
  jQuery( '#frm-fid-search-menu a' ).click( function() {
5824
  var val = this.id.replace( 'fid-', '' );
@@ -5902,6 +6124,7 @@ function frmAdminBuildJS() {
5902
  $builderForm.on( 'change', '.frm_logic_field_opts', getFieldValues );
5903
  $builderForm.on( 'change', '.scale_maxnum, .scale_minnum', setScaleValues );
5904
  $builderForm.on( 'change', '.radio_maxnum', setStarValues );
 
5905
 
5906
  jQuery( document.getElementById( 'frm-insert-fields' ) ).on( 'click', '.frm_add_field', addFieldClick );
5907
  $newFields.on( 'click', '.frm_clone_field', duplicateField );
@@ -5962,12 +6185,15 @@ function frmAdminBuildJS() {
5962
  $builderForm.on( 'change', 'select[name^="field_options[form_select_"]', maybeChangeEmbedFormMsg );
5963
 
5964
  jQuery( document ).on( 'submit', '#frm_js_build_form', buildSubmittedNoAjax );
5965
- jQuery( document ).on( 'change', '#frm_builder_page input, #frm_builder_page select', fieldUpdated );
5966
 
5967
  popAllProductFields();
5968
 
5969
  jQuery( document ).on( 'change', '.frmjs_prod_data_type_opt', toggleProductType );
5970
 
 
 
 
5971
  initBulkOptionsOverlay();
5972
  hideEmptyEle();
5973
  maybeDisableAddSummaryBtn();
@@ -6120,6 +6346,8 @@ function frmAdminBuildJS() {
6120
  }
6121
  });
6122
 
 
 
6123
  // Page Selection Autocomplete
6124
  initSelectionAutocomplete();
6125
  },
300
  cancelSort = false,
301
  copyHelper = false,
302
  fieldsUpdated = 0,
303
+ thisFormId = 0,
304
+ optionMap = {};
305
 
306
  if ( thisForm !== null ) {
307
  thisFormId = thisForm.value;
495
 
496
  function loadTooltips() {
497
  var wrapClass = jQuery( '.wrap, .frm_wrap' ),
498
+ confirmModal = document.getElementById( 'frm_confirm_modal' ),
499
+ doAction = false,
500
+ confirmedBulkDelete = false;
501
 
502
  jQuery( confirmModal ).on( 'click', '[data-deletefield]', deleteFieldConfirmed );
503
  jQuery( confirmModal ).on( 'click', '[data-removeid]', removeThisTag );
517
  });
518
 
519