Formidable Forms – Form Builder for WordPress - Version 2.02.07

Version Description

  • Improve cache clearing in order to make Formidable compatible with persistent object caching
  • Add vertical-align:baseline to radio and checkboxes to prevent styling conflicts
  • Add hook for invalid form entry error message
  • Add form id to 'frm_include_meta_keys' hook
  • Fix IE11 and Edge form builder issues with editing field options
  • Allow localhost to pass URL validation
  • Remove frm_field_input_html calls for fields on form builder page
  • Pro Features *
  • Add option to send emails on import
  • Allow default style to export with form
  • Fix form importing with a style (make sure style is selected in form's settings)
  • Fix exporting Views without form
  • Fix adding subfield types in Chrome
  • Make sure "Remove" link still shows when frm_compact is used in file upload field
  • Make sure actions only trigger on import when import is selected
  • Check if transient timeout has been deleted to prevent expired update links
  • Fix conditional logic in a section after removing and re-adding a row
  • Make sure repeating section is cleared after a form is submitted
  • Move repeating section form to trash when parent is trashed
  • Make sure collapsible icon uses section color
  • Fix errors when "Show page content" is selected in form's settings
  • If repeating form entries page is accessed directly, go to parent's entries page
  • Fix editing entries with file upload in repeating section
  • Allow translation of more file upload messages and no results message in autocomplete dropdown
  • Fix donut graphs
  • Fix PHP 5.2 graph errors
  • Adjust lowercase value sorting in Lookup fields
  • Fix auto_id errors with WPML
  • Prevent multiple View filters from being added during migration
  • Fix Phone Number mask on ajax submission form
  • Fix exclude_fields option with editlink
  • Fix truncating in place so it doesn't cut words in half
  • Make sure autocomplete, multi-select, and read-only attributes are included for category dropdowns
  • Remove "Unique" option from userID fields
  • Fix hidden row_ids field name (in repeating section)
  • Make sure character limit, read-only, etc do not apply on form builder page
  • Make sure second and third level Lookup fields correctly limit options to the current user
  • Fix HTML validation errors for checkboxes in repeating fields
Download this release

Release Info

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

Code changes from version 2.02.06 to 2.02.07

Files changed (46) hide show
  1. classes/controllers/FrmAddonsController.php +18 -4
  2. classes/controllers/FrmAppController.php +5 -3
  3. classes/controllers/FrmFieldsController.php +0 -6
  4. classes/controllers/FrmFormActionsController.php +7 -3
  5. classes/controllers/FrmFormsController.php +9 -1
  6. classes/controllers/FrmXMLController.php +20 -11
  7. classes/helpers/FrmAppHelper.php +38 -32
  8. classes/helpers/FrmFieldsHelper.php +21 -73
  9. classes/helpers/FrmFormsHelper.php +19 -3
  10. classes/helpers/FrmXMLHelper.php +31 -1
  11. classes/models/FrmAddon.php +7 -0
  12. classes/models/FrmEntry.php +4 -6
  13. classes/models/FrmEntryMeta.php +1 -1
  14. classes/models/FrmEntryValidate.php +3 -3
  15. classes/models/FrmField.php +9 -13
  16. classes/models/FrmForm.php +18 -9
  17. classes/models/FrmNotification.php +0 -6
  18. classes/models/FrmPointers.php +0 -4
  19. classes/views/addons/upgrade_to_pro.php +25 -24
  20. classes/views/frm-entries/errors.php +1 -1
  21. classes/views/frm-fields/back-end/dropdown-field.php +35 -0
  22. classes/views/frm-fields/front-end/dropdown-field.php +41 -0
  23. classes/views/frm-fields/input.php +2 -45
  24. classes/views/frm-fields/show-build.php +2 -35
  25. classes/views/frm-forms/add_field.php +1 -1
  26. css/_single_theme.css.php +2 -1
  27. css/custom_theme.css.php +1 -1
  28. css/dropzone.css +2 -2
  29. css/frm_admin.css +13 -4
  30. formidable.php +1 -1
  31. js/formidable.js +31 -14
  32. js/formidable.min.js +85 -84
  33. js/formidable_admin.js +1 -1
  34. languages/formidable-az_AZ.mo +0 -0
  35. languages/formidable-az_AZ.po +609 -591
  36. languages/formidable-da_DK.mo +0 -0
  37. languages/formidable-de_DE.mo +0 -0
  38. languages/formidable-de_DE.po +612 -594
  39. languages/formidable-es_ES.mo +0 -0
  40. languages/formidable-es_ES.po +608 -590
  41. languages/formidable-fr_FR.mo +0 -0
  42. languages/formidable-fr_FR.po +0 -7944
  43. languages/formidable-it_IT.mo +0 -0
  44. languages/formidable-it_IT.po +0 -7819
  45. languages/formidable-ja_JP.mo +0 -0
  46. languages/formidable-ja_JP.po +346 -328
classes/controllers/FrmAddonsController.php CHANGED
@@ -5,8 +5,7 @@ class FrmAddonsController {
5
  public static function menu() {
6
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
7
 
8
- $affiliate = FrmAppHelper::get_affiliate();
9
- if ( ! empty( $affiliate ) && ! FrmAppHelper::pro_is_installed() ) {
10
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'Upgrade to Pro', 'formidable' ), __( 'Upgrade to Pro', 'formidable' ), 'frm_view_forms', 'formidable-pro-upgrade', 'FrmAddonsController::upgrade_to_pro' );
11
  }
12
  }
@@ -132,9 +131,24 @@ class FrmAddonsController {
132
 
133
  public static function upgrade_to_pro() {
134
  $addons = self::get_ordered_addons();
135
- $pro = $addons[0];
136
- $price_id = 0;
137
 
138
  include( FrmAppHelper::plugin_path() . '/classes/views/addons/upgrade_to_pro.php' );
139
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
5
  public static function menu() {
6
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
7
 
8
+ if ( ! FrmAppHelper::pro_is_installed() ) {
 
9
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'Upgrade to Pro', 'formidable' ), __( 'Upgrade to Pro', 'formidable' ), 'frm_view_forms', 'formidable-pro-upgrade', 'FrmAddonsController::upgrade_to_pro' );
10
  }
11
  }
131
 
132
  public static function upgrade_to_pro() {
133
  $addons = self::get_ordered_addons();
134
+ $pro_pricing = array();
135
+ self::prepare_pro_info( $addons[0], $pro_pricing );
136
 
137
  include( FrmAppHelper::plugin_path() . '/classes/views/addons/upgrade_to_pro.php' );
138
  }
139
+
140
+ private static function prepare_pro_info( $pro, &$pro_pricing ) {
141
+ $pro_pricing = array(
142
+ 'personal' => array( 'id' => 5, 'price' => '49.00', 'name' => 'Personal' ),
143
+ 'professional' => array( 'id' => 6, 'price' => '99.00', 'name' => 'Professional' ),
144
+ 'smallbusiness' => array( 'id' => 3, 'price' => '199.00', 'name' => 'Small Business' ),
145
+ 'enterprise' => array( 'id' => 4, 'price' => '399.00', 'name' => 'Enterprise' ),
146
+ );
147
+
148
+ foreach ( $pro['pricing'] as $name => $price ) {
149
+ if ( isset( $pro_pricing[ $name ] ) ) {
150
+ $pro_pricing[ $name ]['price'] = $price;
151
+ }
152
+ }
153
+ }
154
  }
classes/controllers/FrmAppController.php CHANGED
@@ -48,12 +48,14 @@ class FrmAppController {
48
  $form = $id = false;
49
  }
50
 
51
- $nav_items = self::get_form_nav_items( $id );
52
 
53
  include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
  }
55
 
56
- private static function get_form_nav_items( $id ) {
 
 
57
  $nav_items = array(
58
  array(
59
  'link' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $id ) ),
@@ -78,7 +80,7 @@ class FrmAppController {
78
  ),
79
  );
80
 
81
- $nav_items = apply_filters( 'frm_form_nav_list', $nav_items, array( 'form_id' => $id ) );
82
  return $nav_items;
83
  }
84
 
48
  $form = $id = false;
49
  }
50
 
51
+ $nav_items = self::get_form_nav_items( $form );
52
 
53
  include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
  }
55
 
56
+ private static function get_form_nav_items( $form ) {
57
+ $id = ( $form && $form->parent_form_id ) ? $form->parent_form_id : $form->id;
58
+
59
  $nav_items = array(
60
  array(
61
  'link' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $id ) ),
80
  ),
81
  );
82
 
83
+ $nav_items = apply_filters( 'frm_form_nav_list', $nav_items, array( 'form_id' => $id, 'form' => $form ) );
84
  return $nav_items;
85
  }
86
 
classes/controllers/FrmFieldsController.php CHANGED
@@ -565,12 +565,6 @@ class FrmFieldsController {
565
  return;
566
  }
567
 
568
- global $frm_vars;
569
- if ( is_admin() && ! FrmAppHelper::is_preview_page() && ! in_array( $field['type'], array( 'scale', 'radio', 'checkbox', 'data', 'lookup' ) ) ) {
570
- // Add the dyn_default_value class to some field inputs on form builder page
571
- $class[] = 'dyn_default_value';
572
- }
573
-
574
  if ( isset($field['size']) && $field['size'] > 0 ) {
575
  $class[] = 'auto_width';
576
  }
565
  return;
566
  }
567
 
 
 
 
 
 
 
568
  if ( isset($field['size']) && $field['size'] > 0 ) {
569
  $class[] = 'auto_width';
570
  }
classes/controllers/FrmFormActionsController.php CHANGED
@@ -261,11 +261,15 @@ class FrmFormActionsController {
261
 
262
  $stored_actions = $action_priority = array();
263
 
264
- $importing = in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING;
 
 
 
 
265
 
266
  foreach ( $form_actions as $action ) {
267
- $trigger_on_import = $importing && in_array( 'import', $action->post_content['event'] );
268
- $skip_this_action = ( ! in_array( $event, $action->post_content['event'] ) && ! $trigger_on_import );
269
  $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
270
  if ( $skip_this_action ) {
271
  continue;
261
 
262
  $stored_actions = $action_priority = array();
263
 
264
+ if ( in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
265
+ $this_event = 'import';
266
+ } else {
267
+ $this_event = $event;
268
+ }
269
 
270
  foreach ( $form_actions as $action ) {
271
+
272
+ $skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) );
273
  $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
274
  if ( $skip_this_action ) {
275
  continue;
classes/controllers/FrmFormsController.php CHANGED
@@ -1155,7 +1155,7 @@ class FrmFormsController {
1155
  }
1156
 
1157
  $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1158
- $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1159
  $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1160
 
1161
  if ( $created && is_numeric($created) && $conf_method != 'message' ) {
@@ -1191,6 +1191,14 @@ class FrmFormsController {
1191
  do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1192
  }
1193
 
 
 
 
 
 
 
 
 
1194
  public static function front_head() {
1195
  $version = FrmAppHelper::plugin_version();
1196
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
1155
  }
1156
 
1157
  $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1158
+ $created = self::just_created_entry( $form->id );
1159
  $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1160
 
1161
  if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1191
  do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1192
  }
1193
 
1194
+ /**
1195
+ * @since 2.2.7
1196
+ */
1197
+ public static function just_created_entry( $form_id ) {
1198
+ global $frm_vars;
1199
+ return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0;
1200
+ }
1201
+
1202
  public static function front_head() {
1203
  $version = FrmAppHelper::plugin_version();
1204
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
classes/controllers/FrmXMLController.php CHANGED
@@ -155,16 +155,7 @@ class FrmXMLController {
155
  public static function generate_xml( $type, $args = array() ) {
156
  global $wpdb;
157
 
158
- $type = (array) $type;
159
- if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) {
160
- // make sure the form is included if there are entries
161
- $type[] = 'forms';
162
- }
163
-
164
- if ( in_array( 'forms', $type) ) {
165
- // include actions with forms
166
- $type[] = 'actions';
167
- }
168
 
169
  $tables = array(
170
  'items' => $wpdb->prefix . 'frm_items',
@@ -227,13 +218,19 @@ class FrmXMLController {
227
  break;
228
  case 'styles':
229
  // Loop through all exported forms and get their selected style IDs
 
 
230
  $form_ids = $args['ids'];
231
  $style_ids = array();
232
  foreach ( $form_ids as $form_id ) {
233
  $form_data = FrmForm::getOne( $form_id );
234
  // For forms that have not been updated while running 2.0, check if custom_style is set
235
  if ( isset( $form_data->options['custom_style'] ) ) {
236
- $style_ids[] = $form_data->options['custom_style'];
 
 
 
 
237
  }
238
  unset( $form_id, $form_data );
239
  }
@@ -266,6 +263,18 @@ class FrmXMLController {
266
  include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
267
  }
268
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
  public static function generate_csv( $atts ) {
271
  $form_ids = $atts['ids'];
155
  public static function generate_xml( $type, $args = array() ) {
156
  global $wpdb;
157
 
158
+ self::prepare_types_array( $type );
 
 
 
 
 
 
 
 
 
159
 
160
  $tables = array(
161
  'items' => $wpdb->prefix . 'frm_items',
218
  break;
219
  case 'styles':
220
  // Loop through all exported forms and get their selected style IDs
221
+ $frm_style = new FrmStyle();
222
+ $default_style = $frm_style->get_default_style();
223
  $form_ids = $args['ids'];
224
  $style_ids = array();
225
  foreach ( $form_ids as $form_id ) {
226
  $form_data = FrmForm::getOne( $form_id );
227
  // For forms that have not been updated while running 2.0, check if custom_style is set
228
  if ( isset( $form_data->options['custom_style'] ) ) {
229
+ if ( $form_data->options['custom_style'] == 1 ) {
230
+ $style_ids[] = $default_style->ID;
231
+ } else {
232
+ $style_ids[] = $form_data->options['custom_style'];
233
+ }
234
  }
235
  unset( $form_id, $form_data );
236
  }
263
  include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
264
  }
265
 
266
+ private static function prepare_types_array( &$type ) {
267
+ $type = (array) $type;
268
+ if ( ! in_array( 'forms', $type ) && ( in_array( 'items', $type ) || in_array( 'posts', $type ) ) ) {
269
+ // make sure the form is included if there are entries
270
+ $type[] = 'forms';
271
+ }
272
+
273
+ if ( in_array( 'forms', $type ) ) {
274
+ // include actions with forms
275
+ $type[] = 'actions';
276
+ }
277
+ }
278
 
279
  public static function generate_csv( $atts ) {
280
  $form_ids = $atts['ids'];
classes/helpers/FrmAppHelper.php CHANGED
@@ -4,13 +4,13 @@ if ( ! defined('ABSPATH') ) {
4
  }
5
 
6
  class FrmAppHelper {
7
- public static $db_version = 32; //version of the database we are moving to
8
  public static $pro_db_version = 37;
9
 
10
  /**
11
  * @since 2.0
12
  */
13
- public static $plug_version = '2.02.06';
14
 
15
  /**
16
  * @since 1.07.02
@@ -66,9 +66,10 @@ class FrmAppHelper {
66
  }
67
 
68
  public static function get_affiliate() {
 
69
  $affiliate_id = apply_filters( 'frm_affiliate_link', get_option('frm_aff') );
70
  $affiliate_id = strtolower( $affiliate_id );
71
- $allowed_affiliates = array( 'mojo' );
72
  if ( ! in_array( $affiliate_id, $allowed_affiliates ) ) {
73
  $affiliate_id = false;
74
  }
@@ -258,13 +259,6 @@ class FrmAppHelper {
258
  return $value;
259
  }
260
 
261
- /**
262
- *
263
- * @param string $param
264
- * @param mixed $default
265
- * @param string $sanitize
266
- * @return string|array
267
- */
268
  public static function get_post_param( $param, $default = '', $sanitize = '' ) {
269
  return self::get_simple_request( array( 'type' => 'post', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
270
  }
@@ -455,12 +449,36 @@ class FrmAppHelper {
455
  $results = $wpdb->{$type}($query);
456
  }
457
 
 
 
 
 
 
 
458
  if ( ! self::prevent_caching() ) {
 
459
  wp_cache_set( $cache_key, $results, $group, $time );
460
  }
 
461
 
462
- return $results;
463
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
 
465
  /**
466
  * Data that should be stored for a long time can be stored in a transient.
@@ -499,31 +517,18 @@ class FrmAppHelper {
499
  * @since 2.0
500
  *
501
  * @param string $group The name of the cache group
502
- * @return boolean True or False
503
  */
504
  public static function cache_delete_group( $group ) {
505
- global $wp_object_cache;
506
-
507
- if ( is_callable( array( $wp_object_cache, '__get' ) ) ) {
508
- $group_cache = $wp_object_cache->__get('cache');
509
- } elseif ( is_callable( array( $wp_object_cache, 'redis_status' ) ) && $wp_object_cache->redis_status() ) {
510
- // check if the object cache is overridden by Redis
511
- $wp_object_cache->flush();
512
- $group_cache = array();
513
- } else {
514
- // version < 4.0 fallback
515
- $group_cache = $wp_object_cache->cache;
516
- }
517
 
518
- if ( isset( $group_cache[ $group ] ) ) {
519
- foreach ( $group_cache[ $group ] as $k => $v ) {
520
- wp_cache_delete( $k, $group );
521
  }
522
- return true;
523
- }
524
 
525
- return false;
526
- }
 
527
 
528
  /**
529
  * Check a value from a shortcode to see if true or false.
@@ -1731,6 +1736,7 @@ class FrmAppHelper {
1731
  'offset' => apply_filters( 'frm_scroll_offset', 4 ),
1732
  'nonce' => wp_create_nonce( 'frm_ajax' ),
1733
  'id' => __( 'ID', 'formidable' ),
 
1734
  ) );
1735
 
1736
  if ( $location == 'admin' ) {
4
  }
5
 
6
  class FrmAppHelper {
7
+ public static $db_version = 33; //version of the database we are moving to
8
  public static $pro_db_version = 37;
9
 
10
  /**
11
  * @since 2.0
12
  */
13
+ public static $plug_version = '2.02.07';
14
 
15
  /**
16
  * @since 1.07.02
66
  }
67
 
68
  public static function get_affiliate() {
69
+ return '';
70
  $affiliate_id = apply_filters( 'frm_affiliate_link', get_option('frm_aff') );
71
  $affiliate_id = strtolower( $affiliate_id );
72
+ $allowed_affiliates = array();
73
  if ( ! in_array( $affiliate_id, $allowed_affiliates ) ) {
74
  $affiliate_id = false;
75
  }
259
  return $value;
260
  }
261
 
 
 
 
 
 
 
 
262
  public static function get_post_param( $param, $default = '', $sanitize = '' ) {
263
  return self::get_simple_request( array( 'type' => 'post', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
264
  }
449
  $results = $wpdb->{$type}($query);
450
  }
451
 
452
+ self::set_cache( $cache_key, $results, $group, $time );
453
+
454
+ return $results;
455
+ }
456
+
457
+ public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
458
  if ( ! self::prevent_caching() ) {
459
+ self::add_key_to_group_cache( $cache_key, $group );
460
  wp_cache_set( $cache_key, $results, $group, $time );
461
  }
462
+ }
463
 
464
+ /**
465
+ * Keep track of the keys cached in each group so they can be deleted
466
+ * in Redis and Memcache
467
+ */
468
+ public static function add_key_to_group_cache( $key, $group ) {
469
+ $cached = self::get_group_cached_keys( $group );
470
+ $cached[ $key ] = $key;
471
+ wp_cache_set( 'cached_keys', $cached, $group, 300 );
472
+ }
473
+
474
+ public static function get_group_cached_keys( $group ) {
475
+ $cached = wp_cache_get( 'cached_keys', $group );
476
+ if ( ! $cached ) {
477
+ $cached = array();
478
+ }
479
+
480
+ return $cached;
481
+ }
482
 
483
  /**
484
  * Data that should be stored for a long time can be stored in a transient.
517
  * @since 2.0
518
  *
519
  * @param string $group The name of the cache group
 
520
  */
521
  public static function cache_delete_group( $group ) {
522
+ $cached_keys = self::get_group_cached_keys( $group );
 
 
 
 
 
 
 
 
 
 
 
523
 
524
+ if ( ! empty( $cached_keys ) ) {
525
+ foreach ( $cached_keys as $key ) {
526
+ wp_cache_delete( $key, $group );
527
  }
 
 
528
 
529
+ wp_cache_delete( 'cached_keys', $group );
530
+ }
531
+ }
532
 
533
  /**
534
  * Check a value from a shortcode to see if true or false.
1736
  'offset' => apply_filters( 'frm_scroll_offset', 4 ),
1737
  'nonce' => wp_create_nonce( 'frm_ajax' ),
1738
  'id' => __( 'ID', 'formidable' ),
1739
+ 'no_results' => __( 'No results match', 'formidable' ),
1740
  ) );
1741
 
1742
  if ( $location == 'admin' ) {
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -452,6 +452,14 @@ DEFAULT_HTML;
452
  }
453
  }
454
 
 
 
 
 
 
 
 
 
455
  public static function display_recaptcha( $field ) {
456
  $frm_settings = FrmAppHelper::get_settings();
457
  $lang = apply_filters( 'frm_recaptcha_lang', $frm_settings->re_lang, $field );
@@ -496,79 +504,6 @@ DEFAULT_HTML;
496
  }
497
  }
498
 
499
- public static function dropdown_categories( $args ) {
500
- $defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' );
501
- $args = wp_parse_args($args, $defaults);
502
-
503
- if ( ! $args['field'] ) {
504
- return;
505
- }
506
-
507
- if ( ! $args['name'] ) {
508
- $args['name'] = 'item_meta[' . $args['field']['id'] . ']';
509
- }
510
-
511
- $id = self::get_html_id($args['field']);
512
- $class = $args['field']['type'];
513
-
514
- $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
515
- $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
516
-
517
- if ( is_array($args['field']['value']) ) {
518
- if ( ! empty($exclude) ) {
519
- $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
520
- }
521
- $selected = reset($args['field']['value']);
522
- } else {
523
- $selected = $args['field']['value'];
524
- }
525
-
526
- $tax_atts = array(
527
- 'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'],
528
- 'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
529
- 'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
530
- );
531
-
532
- $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
533
-
534
- if ( FrmAppHelper::pro_is_installed() ) {
535
- $post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
536
- $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
537
- if ( ! $tax_atts['taxonomy'] ) {
538
- return;
539
- }
540
-
541
- // If field type is dropdown (not Dynamic), exclude children when parent is excluded
542
- if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
543
- $tax_atts['exclude_tree'] = $exclude;
544
- }
545
- }
546
-
547
- $dropdown = wp_dropdown_categories($tax_atts);
548
-
549
- $add_html = FrmFieldsController::input_html($args['field'], false);
550
-
551
- if ( FrmAppHelper::pro_is_installed() ) {
552
- $add_html .= FrmProFieldsController::input_html($args['field'], false);
553
- }
554
-
555
- $dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown );
556
-
557
- if ( is_array($args['field']['value']) ) {
558
- $skip = true;
559
- foreach ( $args['field']['value'] as $v ) {
560
- if ( $skip ) {
561
- $skip = false;
562
- continue;
563
- }
564
- $dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
565
- unset($v);
566
- }
567
- }
568
-
569
- return $dropdown;
570
- }
571
-
572
  public static function get_term_link( $tax_id ) {
573
  $tax = get_taxonomy($tax_id);
574
  if ( ! $tax ) {
@@ -1394,4 +1329,17 @@ DEFAULT_HTML;
1394
  _deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1395
  FrmField::maybe_get_field( $field );
1396
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1397
  }
452
  }
453
  }
454
 
455
+ public static function get_checkbox_id( $field, $opt_key ) {
456
+ $id = $field['id'];
457
+ if ( isset( $field['in_section'] ) && $field['in_section'] ) {
458
+ $id .= '-' . $field['in_section'];
459
+ }
460
+ return 'frm_checkbox_' . $id . '-' . $opt_key;
461
+ }
462
+
463
  public static function display_recaptcha( $field ) {
464
  $frm_settings = FrmAppHelper::get_settings();
465
  $lang = apply_filters( 'frm_recaptcha_lang', $frm_settings->re_lang, $field );
504
  }
505
  }
506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  public static function get_term_link( $tax_id ) {
508
  $tax = get_taxonomy($tax_id);
509
  if ( ! $tax ) {
1329
  _deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1330
  FrmField::maybe_get_field( $field );
1331
  }
1332
+
1333
+ public static function dropdown_categories( $args ) {
1334
+ _deprecated_function( __FUNCTION__, '2.02.07', 'FrmProPost::get_category_dropdown' );
1335
+
1336
+ if ( FrmAppHelper::pro_is_installed() ) {
1337
+ $args['location'] = 'front';
1338
+ $dropdown = FrmProPost::get_category_dropdown( $args['field'], $args );
1339
+ } else {
1340
+ $dropdown = '';
1341
+ }
1342
+
1343
+ return $dropdown;
1344
+ }
1345
  }
classes/helpers/FrmFormsHelper.php CHANGED
@@ -119,6 +119,21 @@ class FrmFormsHelper {
119
  echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  public static function get_success_message( $atts ) {
123
  $message = apply_filters( 'frm_content', $atts['message'], $atts['form'], $atts['entry_id'] );
124
  $message = FrmAppHelper::use_wpautop( do_shortcode( $message ) );
@@ -494,11 +509,12 @@ BEFORE_HTML;
494
  * @since 2.0.6
495
  */
496
  public static function show_errors( $args ) {
497
- $frm_settings = FrmAppHelper::get_settings();
498
- if ( empty( $frm_settings->invalid_msg ) ) {
 
499
  $show_img = false;
500
  } else {
501
- echo wp_kses_post( $frm_settings->invalid_msg );
502
  $show_img = true;
503
  }
504
 
119
  echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
120
  }
121
 
122
+ /**
123
+ * Get the invalid form error message
124
+ *
125
+ * @since 2.02.07
126
+ * @param array $args
127
+ * @return string
128
+ */
129
+ public static function get_invalid_error_message( $args ) {
130
+ $frm_settings = FrmAppHelper::get_settings();
131
+
132
+ $invalid_msg = apply_filters( 'frm_invalid_error_message', $frm_settings->invalid_msg, $args );
133
+
134
+ return $invalid_msg;
135
+ }
136
+
137
  public static function get_success_message( $atts ) {
138
  $message = apply_filters( 'frm_content', $atts['message'], $atts['form'], $atts['entry_id'] );
139
  $message = FrmAppHelper::use_wpautop( do_shortcode( $message ) );
509
  * @since 2.0.6
510
  */
511
  public static function show_errors( $args ) {
512
+ $invalid_msg = self::get_invalid_error_message( $args );
513
+
514
+ if ( empty( $invalid_msg ) ) {
515
  $show_img = false;
516
  } else {
517
+ echo wp_kses_post( $invalid_msg );
518
  $show_img = true;
519
  }
520
 
classes/helpers/FrmXMLHelper.php CHANGED
@@ -426,6 +426,7 @@ class FrmXMLHelper {
426
 
427
  /**
428
  * Updates the custom style setting on import
 
429
  *
430
  * @since 2.0.19
431
  * @param array $form
@@ -453,12 +454,36 @@ class FrmXMLHelper {
453
  if ( $style_id ) {
454
  $form['options']['custom_style'] = $style_id;
455
  } else {
 
 
 
456
  // Set to default
457
  $form['options']['custom_style'] = 1;
458
  }
459
  }
460
  }
461
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  public static function import_xml_views( $views, $imported ) {
463
  $imported['posts'] = array();
464
  $form_action_type = FrmFormActionsController::$action_post_type;
@@ -699,11 +724,16 @@ class FrmXMLHelper {
699
  }
700
 
701
  private static function maybe_update_stylesheet( $imported ) {
702
- if ( ( isset( $imported['imported']['styles'] ) && ! empty( $imported['imported']['styles'] ) ) || ( isset( $imported['updated']['styles'] ) && ! empty( $imported['updated']['styles'] ) ) ) {
 
 
703
  if ( is_admin() && function_exists( 'get_filesystem_method' ) ) {
704
  $frm_style = new FrmStyle();
705
  $frm_style->update( 'default' );
706
  }
 
 
 
707
  }
708
  }
709
 
426
 
427
  /**
428
  * Updates the custom style setting on import
429
+ * Convert the post slug to an ID
430
  *
431
  * @since 2.0.19
432
  * @param array $form
454
  if ( $style_id ) {
455
  $form['options']['custom_style'] = $style_id;
456
  } else {
457
+ // save the old style to maybe update after styles import
458
+ $form['options']['old_style'] = $form['options']['custom_style'];
459
+
460
  // Set to default
461
  $form['options']['custom_style'] = 1;
462
  }
463
  }
464
  }
465
 
466
+ /**
467
+ * After styles are imported, check for any forms that were linked
468
+ * and link them back up.
469
+ *
470
+ * @since 2.2.7
471
+ */
472
+ private static function update_custom_style_setting_after_import( $form_id ) {
473
+ $form = FrmForm::getOne( $form_id );
474
+
475
+ if ( $form && isset( $form->options['old_style'] ) ) {
476
+ $form = (array) $form;
477
+ $saved_style = $form['options']['custom_style'];
478
+ $form['options']['custom_style'] = $form['options']['old_style'];
479
+ self::update_custom_style_setting_on_import( $form );
480
+ $has_changed = ( $form['options']['custom_style'] != $saved_style && $form['options']['custom_style'] != $form['options']['old_style'] );
481
+ if ( $has_changed ) {
482
+ FrmForm::update( $form['id'], $form );
483
+ }
484
+ }
485
+ }
486
+
487
  public static function import_xml_views( $views, $imported ) {
488
  $imported['posts'] = array();
489
  $form_action_type = FrmFormActionsController::$action_post_type;
724
  }
725
 
726
  private static function maybe_update_stylesheet( $imported ) {
727
+ $new_styles = isset( $imported['imported']['styles'] ) && ! empty( $imported['imported']['styles'] );
728
+ $updated_styles = isset( $imported['updated']['styles'] ) && ! empty( $imported['updated']['styles'] );
729
+ if ( $new_styles || $updated_styles ) {
730
  if ( is_admin() && function_exists( 'get_filesystem_method' ) ) {
731
  $frm_style = new FrmStyle();
732
  $frm_style->update( 'default' );
733
  }
734
+ foreach ( $imported['forms'] as $form_id ) {
735
+ self::update_custom_style_setting_after_import( $form_id );
736
+ }
737
  }
738
  }
739
 
classes/models/FrmAddon.php CHANGED
@@ -117,6 +117,13 @@ class FrmAddon {
117
  } else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
118
  $cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' );
119
  $version_info = get_transient( $cache_key );
 
 
 
 
 
 
 
120
  if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) {
121
  $transient->response[ $this->plugin_folder ] = $version_info;
122
  } else {
117
  } else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
118
  $cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' );
119
  $version_info = get_transient( $cache_key );
120
+
121
+ $expiration = get_option( '_transient_timeout_' . $cache_key );
122
+ if ( $expiration === false ) {
123
+ // make sure transients don't stick around on some sites
124
+ $version_info = false;
125
+ }
126
+
127
  if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) {
128
  $transient->response[ $this->plugin_folder ] = $version_info;
129
  } else {
classes/models/FrmEntry.php CHANGED
@@ -296,7 +296,7 @@ class FrmEntry {
296
 
297
  $entry->metas = array();
298
 
299
- $include_key = apply_filters( 'frm_include_meta_keys', false );
300
  foreach ( $metas as $meta_val ) {
301
  if ( $meta_val->item_id == $entry->id ) {
302
  $entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
@@ -317,7 +317,7 @@ class FrmEntry {
317
  }
318
  unset($metas);
319
 
320
- wp_cache_set( $entry->id, $entry, 'frm_entry');
321
 
322
  return $entry;
323
  }
@@ -374,9 +374,7 @@ class FrmEntry {
374
  $entries = $wpdb->get_results($query, OBJECT_K);
375
  unset($query);
376
 
377
- if ( ! FrmAppHelper::prevent_caching() ) {
378
- wp_cache_set( $cache_key, $entries, 'frm_entry', 300 );
379
- }
380
  }
381
 
382
  if ( ! $meta || ! $entries ) {
@@ -419,7 +417,7 @@ class FrmEntry {
419
 
420
  if ( ! FrmAppHelper::prevent_caching() ) {
421
  foreach ( $entries as $entry ) {
422
- wp_cache_set( $entry->id, $entry, 'frm_entry' );
423
  unset( $entry );
424
  }
425
  }
296
 
297
  $entry->metas = array();
298
 
299
+ $include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) );
300
  foreach ( $metas as $meta_val ) {
301
  if ( $meta_val->item_id == $entry->id ) {
302
  $entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
317
  }
318
  unset($metas);
319
 
320
+ FrmAppHelper::set_cache( $entry->id, $entry, 'frm_entry' );
321
 
322
  return $entry;
323
  }
374
  $entries = $wpdb->get_results($query, OBJECT_K);
375
  unset($query);
376
 
377
+ FrmAppHelper::set_cache( $cache_key, $entries, 'frm_entry' );
 
 
378
  }
379
 
380
  if ( ! $meta || ! $entries ) {
417
 
418
  if ( ! FrmAppHelper::prevent_caching() ) {
419
  foreach ( $entries as $entry ) {
420
+ FrmAppHelper::set_cache( $entry->id, $entry, 'frm_entry' );
421
  unset( $entry );
422
  }
423
  }
classes/models/FrmEntryMeta.php CHANGED
@@ -379,7 +379,7 @@ class FrmEntryMeta {
379
  }
380
 
381
  $results = $wpdb->get_col($query, 0);
382
- wp_cache_set($cache_key, $results, 'frm_entry', 300);
383
 
384
  return $results;
385
  }
379
  }
380
 
381
  $results = $wpdb->get_col($query, 0);
382
+ FrmAppHelper::set_cache( $cache_key, $results, 'frm_entry' );
383
 
384
  return $results;
385
  }
classes/models/FrmEntryValidate.php CHANGED
@@ -111,10 +111,10 @@ class FrmEntryValidate {
111
  $value = preg_match( '/^(https?|ftps?|mailto|news|feed|telnet):/is', $value ) ? $value : 'http://' . $value;
112
  }
113
 
114
- //validate the url format
115
- if ( ! preg_match('/^http(s)?:\/\/([\da-z\.-]+)\.([\da-z\.-]+)/i', $value) ) {
116
  $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
117
- }
118
  }
119
 
120
  public static function validate_email_field( &$errors, $field, $value, $args ) {
111
  $value = preg_match( '/^(https?|ftps?|mailto|news|feed|telnet):/is', $value ) ? $value : 'http://' . $value;
112
  }
113
 
114
+ // validate the url format
115
+ if ( ! preg_match('/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value) ) {
116
  $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
117
+ }
118
  }
119
 
120
  public static function validate_email_field( &$errors, $field, $value, $args ) {
classes/models/FrmField.php CHANGED
@@ -189,7 +189,7 @@ class FrmField {
189
  if ( $query_results ) {
190
  wp_cache_delete( $id, 'frm_field' );
191
  if ( $form_id ) {
192
- self::delete_form_transient($form_id);
193
  }
194
  }
195
 
@@ -235,11 +235,7 @@ class FrmField {
235
  global $wpdb;
236
  $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_' . $form_id . 'ex%', '_transient_frm_form_fields_' . $form_id . 'ex%', '_transient_timeout_frm_form_fields_' . $form_id . 'in%', '_transient_frm_form_fields_' . $form_id . 'in%' ) );
237
 
238
- $cache_key = serialize( array( 'fi.form_id' => $form_id ) ) . 'field_orderlb';
239
- wp_cache_delete($cache_key, 'frm_field');
240
-
241
- // this cache key is autogenerated in FrmDb::get_var
242
- wp_cache_delete( '(__fi.form_id=%d_OR_fr.parent_form_id=%d_)__' . $form_id . '_' . $form_id . '_ORDER_BY_field_orderfi.*__fr.name_as_form_name_results', 'frm_field' );
243
 
244
  $form = FrmForm::getOne($form_id);
245
  if ( $form && $form->parent_form_id ) {
@@ -273,9 +269,9 @@ class FrmField {
273
  }
274
 
275
  if ( is_numeric($id) ) {
276
- wp_cache_set( $results->field_key, $results, 'frm_field' );
277
  } else if ( $results ) {
278
- wp_cache_set( $results->id, $results, 'frm_field' );
279
  }
280
 
281
  self::prepare_options( $results );
@@ -470,7 +466,7 @@ class FrmField {
470
 
471
  self::format_field_results( $results );
472
 
473
- wp_cache_set( $cache_key, $results, 'frm_field', 300 );
474
 
475
  return stripslashes_deep( $results );
476
  }
@@ -481,8 +477,8 @@ class FrmField {
481
  private static function format_field_results( &$results ) {
482
  if ( is_array( $results ) ) {
483
  foreach ( $results as $r_key => $result ) {
484
- wp_cache_set( $result->id, $result, 'frm_field' );
485
- wp_cache_set( $result->field_key, $result, 'frm_field' );
486
 
487
  $results[ $r_key ]->field_options = maybe_unserialize( $result->field_options );
488
  $results[ $r_key ]->options = maybe_unserialize( $result->options );
@@ -491,8 +487,8 @@ class FrmField {
491
  unset( $r_key, $result );
492
  }
493
  } else if ( $results ) {
494
- wp_cache_set( $results->id, $results, 'frm_field' );
495
- wp_cache_set( $results->field_key, $results, 'frm_field' );
496
 
497
  self::prepare_options( $results );
498
  }
189
  if ( $query_results ) {
190
  wp_cache_delete( $id, 'frm_field' );
191
  if ( $form_id ) {
192
+ self::delete_form_transient( $form_id );
193
  }
194
  }
195
 
235
  global $wpdb;
236
  $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_' . $form_id . 'ex%', '_transient_frm_form_fields_' . $form_id . 'ex%', '_transient_timeout_frm_form_fields_' . $form_id . 'in%', '_transient_frm_form_fields_' . $form_id . 'in%' ) );
237
 
238
+ FrmAppHelper::cache_delete_group( 'frm_field' );
 
 
 
 
239
 
240
  $form = FrmForm::getOne($form_id);
241
  if ( $form && $form->parent_form_id ) {
269
  }
270
 
271
  if ( is_numeric($id) ) {
272
+ FrmAppHelper::set_cache( $results->field_key, $results, 'frm_field' );
273
  } else if ( $results ) {
274
+ FrmAppHelper::set_cache( $results->id, $results, 'frm_field' );
275
  }
276
 
277
  self::prepare_options( $results );
466
 
467
  self::format_field_results( $results );
468
 
469
+ FrmAppHelper::set_cache( $cache_key, $results, 'frm_field' );
470
 
471
  return stripslashes_deep( $results );
472
  }
477
  private static function format_field_results( &$results ) {
478
  if ( is_array( $results ) ) {
479
  foreach ( $results as $r_key => $result ) {
480
+ FrmAppHelper::set_cache( $result->id, $result, 'frm_field' );
481
+ FrmAppHelper::set_cache( $result->field_key, $result, 'frm_field' );
482
 
483
  $results[ $r_key ]->field_options = maybe_unserialize( $result->field_options );
484
  $results[ $r_key ]->options = maybe_unserialize( $result->options );
487
  unset( $r_key, $result );
488
  }
489
  } else if ( $results ) {
490
+ FrmAppHelper::set_cache( $results->id, $results, 'frm_field' );
491
+ FrmAppHelper::set_cache( $results->field_key, $results, 'frm_field' );
492
 
493
  self::prepare_options( $results );
494
  }
classes/models/FrmForm.php CHANGED
@@ -24,7 +24,7 @@ class FrmForm {
24
  'created_at' => isset($values['created_at']) ? $values['created_at'] : current_time('mysql', 1),
25
  );
26
 
27
- $options = array();
28
  FrmFormsHelper::fill_form_options( $options, $values );
29
 
30
  $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
@@ -171,7 +171,7 @@ class FrmForm {
171
  return $new_values;
172
  }
173
 
174
- $options = array();
175
  FrmFormsHelper::fill_form_options( $options, $values );
176
 
177
  $options['custom_style'] = isset($values['options']['custom_style']) ? $values['options']['custom_style'] : 0;
@@ -225,7 +225,8 @@ class FrmForm {
225
  continue;
226
  }
227
 
228
- if ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ) {
 
229
  //updating the settings page
230
  if ( isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ) {
231
  $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ? $values['field_options'][ 'custom_html_' . $field_id ] : ( isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ) );
@@ -241,7 +242,7 @@ class FrmForm {
241
  }
242
  }
243
 
244
- if ( ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ) && ! defined( 'WP_IMPORTING' ) ) {
245
  continue;
246
  }
247
 
@@ -269,6 +270,7 @@ class FrmForm {
269
 
270
  FrmField::delete_form_transient($field->form_id);
271
  }
 
272
 
273
  return $values;
274
  }
@@ -290,13 +292,14 @@ class FrmForm {
290
  global $wpdb;
291
 
292
  if ( is_array($id) ) {
293
- $where = array( 'id' => $id );
294
  FrmDb::get_where_clause_and_values( $where );
295
  array_unshift( $where['values'], $status );
296
 
297
  $query_results = $wpdb->query( $wpdb->prepare( 'UPDATE ' . $wpdb->prefix . 'frm_forms SET status = %s ' . $where['where'], $where['values'] ) );
298
  } else {
299
  $query_results = $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'status' => $status ), array( 'id' => $id ) );
 
300
  }
301
 
302
  if ( $query_results ) {
@@ -329,6 +332,12 @@ class FrmForm {
329
  array( 'id' => $id )
330
  );
331
 
 
 
 
 
 
 
332
  if ( $query_results ) {
333
  self::clear_form_cache();
334
  }
@@ -491,7 +500,7 @@ class FrmForm {
491
  $results = FrmDb::get_row( $table_name, $where );
492
 
493
  if ( isset($results->options) ) {
494
- wp_cache_set($results->id, $results, 'frm_form');
495
  $results->options = maybe_unserialize($results->options);
496
  }
497
  return stripslashes_deep($results);
@@ -513,7 +522,7 @@ class FrmForm {
513
 
514
  if ( $results ) {
515
  foreach ( $results as $result ) {
516
- wp_cache_set( $result->id, $result, 'frm_form' );
517
  $result->options = maybe_unserialize( $result->options );
518
  }
519
  }
@@ -550,7 +559,7 @@ class FrmForm {
550
 
551
  $cache_key = 'frm_form_counts';
552
 
553
- $counts = wp_cache_get( $cache_key, 'counts' );
554
  if ( false !== $counts ) {
555
  return $counts;
556
  }
@@ -579,7 +588,7 @@ class FrmForm {
579
  }
580
 
581
  $counts = (object) $counts;
582
- wp_cache_set( $cache_key, $counts, 'counts' );
583
 
584
  return $counts;
585
  }
24
  'created_at' => isset($values['created_at']) ? $values['created_at'] : current_time('mysql', 1),
25
  );
26
 
27
+ $options = isset( $values['options'] ) ? (array) $values['options'] : array();
28
  FrmFormsHelper::fill_form_options( $options, $values );
29
 
30
  $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
171
  return $new_values;
172
  }
173
 
174
+ $options = isset( $values['options'] ) ? (array) $values['options'] : array();
175
  FrmFormsHelper::fill_form_options( $options, $values );
176
 
177
  $options['custom_style'] = isset($values['options']['custom_style']) ? $values['options']['custom_style'] : 0;
225
  continue;
226
  }
227
 
228
+ $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) );
229
+ if ( $is_settings_page ) {
230
  //updating the settings page
231
  if ( isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ) {
232
  $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ? $values['field_options'][ 'custom_html_' . $field_id ] : ( isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ) );
242
  }
243
  }
244
 
245
+ if ( $is_settings_page && ! defined( 'WP_IMPORTING' ) ) {
246
  continue;
247
  }
248
 
270
 
271
  FrmField::delete_form_transient($field->form_id);
272
  }
273
+ self::clear_form_cache();
274
 
275
  return $values;
276
  }
292
  global $wpdb;
293
 
294
  if ( is_array($id) ) {
295
+ $where = array( 'id' => $id, 'parent_form_id' => $id, 'or' => 1 );
296
  FrmDb::get_where_clause_and_values( $where );
297
  array_unshift( $where['values'], $status );
298
 
299
  $query_results = $wpdb->query( $wpdb->prepare( 'UPDATE ' . $wpdb->prefix . 'frm_forms SET status = %s ' . $where['where'], $where['values'] ) );
300
  } else {
301
  $query_results = $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'status' => $status ), array( 'id' => $id ) );
302
+ $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'status' => $status ), array( 'parent_form_id' => $id ) );
303
  }
304
 
305
  if ( $query_results ) {
332
  array( 'id' => $id )
333
  );
334
 
335
+ $wpdb->update(
336
+ $wpdb->prefix . 'frm_forms',
337
+ array( 'status' => 'trash', 'options' => serialize( $options ) ),
338
+ array( 'parent_form_id' => $id )
339
+ );
340
+
341
  if ( $query_results ) {
342
  self::clear_form_cache();
343
  }
500
  $results = FrmDb::get_row( $table_name, $where );
501
 
502
  if ( isset($results->options) ) {
503
+ FrmAppHelper::set_cache( $results->id, $results, 'frm_form' );
504
  $results->options = maybe_unserialize($results->options);
505
  }
506
  return stripslashes_deep($results);
522
 
523
  if ( $results ) {
524
  foreach ( $results as $result ) {
525
+ FrmAppHelper::set_cache( $result->id, $result, 'frm_form' );
526
  $result->options = maybe_unserialize( $result->options );
527
  }
528
  }
559
 
560
  $cache_key = 'frm_form_counts';
561
 
562
+ $counts = wp_cache_get( $cache_key, 'frm_form' );
563
  if ( false !== $counts ) {
564
  return $counts;
565
  }
588
  }
589
 
590
  $counts = (object) $counts;
591
+ FrmAppHelper::set_cache( $cache_key, $counts, 'frm_form' );
592
 
593
  return $counts;
594
  }
classes/models/FrmNotification.php CHANGED
@@ -9,12 +9,6 @@ class FrmNotification {
9
  }
10
 
11
  public static function trigger_email( $action, $entry, $form ) {
12
- if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
13
- return;
14
- }
15
-
16
- global $wpdb;
17
-
18
  $notification = $action->post_content;
19
  $email_key = $action->ID;
20
 
9
  }
10
 
11
  public static function trigger_email( $action, $entry, $form ) {
 
 
 
 
 
 
12
  $notification = $action->post_content;
13
  $email_key = $action->ID;
14
 
classes/models/FrmPointers.php CHANGED
@@ -179,10 +179,6 @@ class FrmPointers {
179
 
180
  private function opening_line() {
181
  $opening = __( 'You&#8217;ve just installed a new form builder plugin!', 'formidable' );
182
- $affiliate = FrmAppHelper::get_affiliate();
183
- if ( $affiliate == 'mojo' ) {
184
- $opening = 'Your Forms plugin has been installed by MOJO Marketplace for your convenience.';
185
- }
186
  return $opening;
187
  }
188
 
179
 
180
  private function opening_line() {
181
  $opening = __( 'You&#8217;ve just installed a new form builder plugin!', 'formidable' );
 
 
 
 
182
  return $opening;
183
  }
184
 
classes/views/addons/upgrade_to_pro.php CHANGED
@@ -1,6 +1,9 @@
1
  <div class="wrap upgrade_to_pro">
2
- <h1 class="frm_pro_heading">Save time and make life easier. Upgrade to Pro.</h1>
3
- <img src="<?php echo esc_url( FrmAppHelper::plugin_url() ) ?>/images/logo.png" alt="Upgrade to Pro" />
 
 
 
4
 
5
  <div class="clear"></div>
6
 
@@ -12,44 +15,42 @@
12
  <thead>
13
  <tr>
14
  <th></th>
15
- <?php foreach ( $pro['pricing'] as $name => $price ) {
16
- $price_id++;
17
- if ( $name == 'smallbusiness' ) {
18
- $name = 'Small Business';
19
- } ?>
20
  <th>
21
- <h3><?php echo esc_attr( ucfirst( $name ) ) ?></h3>
22
- <h4>$<?php echo esc_attr( $price ) ?></h4>
23
- <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/checkout?edd_action=add_to_cart&download_id=93790' ) ) ?>&amp;edd_options[price_id]=<?php echo absint( $price_id ) ?>" class="button-primary" target="_blank"><?php _e( 'Get Started', 'formidable' ) ?></a>
 
 
24
  </th>
25
  <?php } ?>
26
  </tr>
27
  </thead>
28
  <tbody>
29
  <tr>
30
- <th>Knowledge Base Support For # Sites</th>
31
  <td>1 Site</td>
32
- <td>1 Site + 1 Staging Site</td>
33
  <td>15 Sites</td>
34
- <td>200 Sites</td>
35
- </tr>
36
- <tr>
37
- <th>Product Updates Forever</th>
38
- <td>Manual</td>
39
- <td>Manual</td>
40
- <td>Manual</td>
41
- <td>Automatic</td>
42
  </tr>
43
  <tr>
44
  <th>Automatic Updates</th>
45
  <td>1 Year</td>
46
  <td>1 Year</td>
47
- <td>2 Years</td>
48
  <td>Lifetime</td>
49
  </tr>
50
  <tr>
51
- <th>1 Year of Ticket Support</th>
52
- <td>None</td>
 
 
 
 
 
 
 
53
  <td>Standard Support</td>
54
  <td>Priority Support</td>
55
  <td>Elite Support</td>
@@ -57,7 +58,7 @@
57
  <tr>
58
  <th>Included AddOns</th>
59
  <td>None</td>
60
- <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Basic Addons</a></td>
61
  <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Advanced Addons</a></td>
62
  <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Enterprise Addons</a></td>
63
  </tr>
1
  <div class="wrap upgrade_to_pro">
2
+ <h1 class="frm_pro_heading">
3
+ <img src="<?php echo esc_url( FrmAppHelper::plugin_url() ) ?>/images/logo.png" alt="Upgrade to Pro" />
4
+ <span class="alignright">Save time and make life easier. Upgrade to Pro.</span>
5
+ <span class="clear"></span>
6
+ </h1>
7
 
8
  <div class="clear"></div>
9
 
15
  <thead>
16
  <tr>
17
  <th></th>
18
+ <?php foreach ( $pro_pricing as $price_info ) { ?>
 
 
 
 
19
  <th>
20
+ <h3><?php echo esc_attr( ucfirst( $price_info['name'] ) ) ?></h3>
21
+ <h4>$<?php echo esc_attr( $price_info['price'] ) ?></h4>
22
+ <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/checkout?edd_action=add_to_cart&download_id=93790' ) ) ?>&amp;edd_options[price_id]=<?php echo absint( $price_info['id'] ) ?>" class="button-primary" target="_blank">
23
+ <?php _e( 'Get Started', 'formidable' ) ?>
24
+ </a>
25
  </th>
26
  <?php } ?>
27
  </tr>
28
  </thead>
29
  <tbody>
30
  <tr>
31
+ <th>Number of Sites</th>
32
  <td>1 Site</td>
33
+ <td>3 Sites</td>
34
  <td>15 Sites</td>
35
+ <td>Unlimited Sites</td>
 
 
 
 
 
 
 
36
  </tr>
37
  <tr>
38
  <th>Automatic Updates</th>
39
  <td>1 Year</td>
40
  <td>1 Year</td>
41
+ <td>1 Year</td>
42
  <td>Lifetime</td>
43
  </tr>
44
  <tr>
45
+ <th>Support Term</th>
46
+ <td>1 Year</td>
47
+ <td>1 Year</td>
48
+ <td>1 Year</td>
49
+ <td>1 Year</td>
50
+ </tr>
51
+ <tr>
52
+ <th>Support Priority</th>
53
+ <td>Standard Support</td>
54
  <td>Standard Support</td>
55
  <td>Priority Support</td>
56
  <td>Elite Support</td>
58
  <tr>
59
  <th>Included AddOns</th>
60
  <td>None</td>
61
+ <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Premium Addons</a></td>
62
  <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Advanced Addons</a></td>
63
  <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Enterprise Addons</a></td>
64
  </tr>
classes/views/frm-entries/errors.php CHANGED
@@ -30,7 +30,7 @@ if ( ! FrmAppHelper::is_admin() ) {
30
  }
31
  }
32
 
33
- FrmFormsHelper::show_errors( compact( 'img', 'errors' ) );
34
 
35
  ?>
36
  </div>
30
  }
31
  }
32
 
33
+ FrmFormsHelper::show_errors( compact( 'img', 'errors', 'form' ) );
34
 
35
  ?>
36
  </div>
classes/views/frm-fields/back-end/dropdown-field.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( isset($field['post_field']) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) {
4
+ echo FrmProPost::get_category_dropdown( $field, array( 'name' => $field_name, 'id' => 'placeholder_id', 'location' => 'form_builder' ) );
5
+ } else { ?>
6
+ <select name="<?php echo esc_attr( $field_name ) . ( FrmField::is_option_true( $field, 'multiple' ) ? '[]' : '' ); ?>" <?php
7
+ echo FrmField::is_option_true( $field, 'size' ) ? 'class="auto_width"' : '';
8
+ echo FrmField::is_option_true( $field, 'multiple' ) ? ' multiple="multiple"' : ''; ?> >
9
+ <?php foreach ( $field['options'] as $opt_key => $opt ) {
10
+ $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
11
+ $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
12
+ $selected = ( $field['default_value'] == $field_val || FrmFieldsHelper::get_other_val( array( 'opt_key', 'field' ) ) ) ? ' selected="selected"' : ''; ?>
13
+ <option value="<?php echo esc_attr( $field_val ) ?>"<?php echo $selected ?>><?php echo esc_html( $opt ) ?> </option>
14
+ <?php } ?>
15
+ </select>
16
+ <?php }
17
+
18
+ if ( $display['default_blank'] ) { ?>
19
+ <span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>" class="frm_clear_on_focus frm-show-click">
20
+ <?php FrmFieldsHelper::show_default_blank_js( $field['default_blank'] ); ?>
21
+ </span>
22
+ <input type="hidden" name="field_options[default_blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['default_blank'] ) ?>" />
23
+ <?php } ?>
24
+ <div class="clear"></div>
25
+ <div class="frm-show-click frm_small_top_margin">
26
+ <?php
27
+
28
+ if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { ?>
29
+ <?php do_action('frm_add_multiple_opts_labels', $field); ?>
30
+ <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count($field['options']) > 10 ) ? ' frm_field_opts_list' : ''; ?>">
31
+ <?php FrmFieldsHelper::show_single_option($field); ?>
32
+ </ul>
33
+ <?php
34
+ } ?>
35
+ </div>
classes/views/frm-fields/front-end/dropdown-field.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $read_only = false;
4
+ if ( isset($field['post_field']) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) {
5
+ echo FrmProPost::get_category_dropdown( $field, array( 'location' => 'front', 'name' => $field_name, 'id' => $html_id ) );
6
+ } else {
7
+ if ( FrmAppHelper::pro_is_installed() && FrmField::is_read_only( $field ) ) {
8
+ $read_only = true;
9
+
10
+ echo FrmProDropdownFieldsController::get_hidden_fields_with_readonly_values( $field, $field_name, $html_id ); ?>
11
+ <select <?php do_action('frm_field_input_html', $field) ?>> <?php
12
+
13
+ } else { ?>
14
+ <select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action('frm_field_input_html', $field) ?>>
15
+ <?php }
16
+
17
+ $other_opt = $other_checked = false;
18
+ foreach ( $field['options'] as $opt_key => $opt ) {
19
+ $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
20
+ $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
21
+ $selected = FrmAppHelper::check_selected( $field['value'], $field_val );
22
+ if ( $other_opt === false ) {
23
+ $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $selected );
24
+ if ( FrmFieldsHelper::is_other_opt( $opt_key ) && $selected ) {
25
+ $other_checked = true;
26
+ }
27
+ }
28
+ ?>
29
+ <option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo esc_html( $opt == '' ? ' ' : $opt ); ?></option>
30
+ <?php
31
+ } ?>
32
+ </select>
33
+ <?php
34
+
35
+ FrmFieldsHelper::include_other_input( array(
36
+ 'other_opt' => $other_opt, 'read_only' => $read_only,
37
+ 'checked' => $other_checked, 'name' => $other_args['name'],
38
+ 'value' => $other_args['value'], 'field' => $field,
39
+ 'html_id' => $html_id, 'opt_key' => false,
40
+ ) );
41
+ }
classes/views/frm-fields/input.php CHANGED
@@ -59,50 +59,7 @@ do_action('frm_field_input_html', $field);
59
  }
60
  }
61
  } else if ( $field['type'] == 'select' ) {
62
- $read_only = false;
63
- if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
64
- echo FrmFieldsHelper::dropdown_categories( array( 'name' => $field_name, 'field' => $field ) );
65
- } else {
66
- if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
67
- $read_only = true;
68
-
69
- if ( is_array( $field['value'] ) ) {
70
- foreach ( $field['value'] as $selected_value ) { ?>
71
- <input type="hidden" value="<?php echo esc_attr( $selected_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" /> <?php
72
- }
73
- } else { ?>
74
- <input type="hidden" value="<?php echo esc_attr($field['value']) ?>" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" /> <?php
75
- } ?>
76
- <select disabled="disabled" <?php do_action('frm_field_input_html', $field) ?>> <?php
77
-
78
- } else { ?>
79
- <select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action('frm_field_input_html', $field) ?>>
80
- <?php }
81
-
82
- $other_opt = $other_checked = false;
83
- foreach ( $field['options'] as $opt_key => $opt ) {
84
- $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
85
- $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
86
- $selected = FrmAppHelper::check_selected( $field['value'], $field_val );
87
- if ( $other_opt === false ) {
88
- $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $selected );
89
- if ( FrmFieldsHelper::is_other_opt( $opt_key ) && $selected ) {
90
- $other_checked = true;
91
- }
92
- }
93
- ?>
94
- <option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo esc_html( $opt == '' ? ' ' : $opt ); ?></option>
95
- <?php
96
- } ?>
97
- </select>
98
- <?php
99
- FrmFieldsHelper::include_other_input( array(
100
- 'other_opt' => $other_opt, 'read_only' => $read_only,
101
- 'checked' => $other_checked, 'name' => $other_args['name'],
102
- 'value' => $other_args['value'], 'field' => $field,
103
- 'html_id' => $html_id, 'opt_key' => false,
104
- ) );
105
- }
106
  } else if ( $field['type'] == 'checkbox' ) {
107
  $checked_values = $field['value'];
108
  $read_only = false;
@@ -137,7 +94,7 @@ do_action('frm_field_input_html', $field);
137
  $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked );
138
 
139
  ?>
140
- <div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="frm_checkbox_<?php echo esc_attr( $field['id'] ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
141
 
142
  if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
143
  ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
59
  }
60
  }
61
  } else if ( $field['type'] == 'select' ) {
62
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/dropdown-field.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  } else if ( $field['type'] == 'checkbox' ) {
64
  $checked_values = $field['value'];
65
  $read_only = false;
94
  $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked );
95
 
96
  ?>
97
+ <div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="<?php echo esc_attr( FrmFieldsHelper::get_checkbox_id( $field, $opt_key ) ) ?>"><?php
98
 
99
  if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
100
  ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
classes/views/frm-fields/show-build.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php if ( in_array( $display['type'], array( 'text', 'website', 'email', 'url' ) ) ) { ?>
2
- <input type="text" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" value="<?php echo esc_attr( $field['default_value'] ); ?>" <?php echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '') . ';"' ) : ''; ?> class="dyn_default_value" />
3
  <?php } else if ( $field['type'] == 'textarea' ) { ?>
4
  <textarea name="<?php echo esc_attr( $field_name ) ?>" <?php
5
  echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : '';
@@ -19,40 +19,7 @@
19
  <?php
20
  }
21
  } else if ( $field['type'] == 'select' ) {
22
- if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
23
- echo FrmFieldsHelper::dropdown_categories( array( 'name' => $field_name, 'field' => $field ) );
24
- } else { ?>
25
- <select name="<?php echo esc_attr( $field_name ) . ( FrmField::is_option_true( $field, 'multiple' ) ? '[]' : '' ); ?>" <?php
26
- echo FrmField::is_option_true( $field, 'size' ) ? 'class="auto_width"' : '';
27
- echo FrmField::is_option_true( $field, 'multiple' ) ? ' multiple="multiple"' : ''; ?> >
28
- <?php foreach ( $field['options'] as $opt_key => $opt ) {
29
- $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
30
- $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
31
- $selected = ( $field['default_value'] == $field_val || FrmFieldsHelper::get_other_val( array( 'opt_key', 'field' ) ) ) ? ' selected="selected"' : ''; ?>
32
- <option value="<?php echo esc_attr( $field_val ) ?>"<?php echo $selected ?>><?php echo esc_html( $opt ) ?> </option>
33
- <?php } ?>
34
- </select>
35
- <?php }
36
-
37
- if ( $display['default_blank'] ) { ?>
38
- <span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>" class="frm_clear_on_focus frm-show-click">
39
- <?php FrmFieldsHelper::show_default_blank_js( $field['default_blank'] ); ?>
40
- </span>
41
- <input type="hidden" name="field_options[default_blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['default_blank'] ) ?>" />
42
- <?php } ?>
43
- <div class="clear"></div>
44
- <div class="frm-show-click frm_small_top_margin">
45
- <?php
46
-
47
- if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { ?>
48
- <?php do_action('frm_add_multiple_opts_labels', $field); ?>
49
- <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count($field['options']) > 10 ) ? ' frm_field_opts_list' : ''; ?>">
50
- <?php FrmFieldsHelper::show_single_option($field); ?>
51
- </ul>
52
- <?php
53
- } ?>
54
- </div>
55
- <?php
56
  } else if ( $field['type'] == 'captcha' ) {
57
  if ( empty($frm_settings->pubkey) ) { ?>
58
  <div class="howto frm_no_captcha_text"><?php printf(__( '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>') ?></div>
1
  <?php if ( in_array( $display['type'], array( 'text', 'website', 'email', 'url' ) ) ) { ?>
2
+ <input type="text" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" value="<?php echo esc_attr( $field['default_value'] ); ?>" class="dyn_default_value" />
3
  <?php } else if ( $field['type'] == 'textarea' ) { ?>
4
  <textarea name="<?php echo esc_attr( $field_name ) ?>" <?php
5
  echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : '';
19
  <?php
20
  }
21
  } else if ( $field['type'] == 'select' ) {
22
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/dropdown-field.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  } else if ( $field['type'] == 'captcha' ) {
24
  if ( empty($frm_settings->pubkey) ) { ?>
25
  <div class="howto frm_no_captcha_text"><?php printf(__( '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>') ?></div>
classes/views/frm-forms/add_field.php CHANGED
@@ -88,7 +88,7 @@ if ( $display['conf_field'] ) { ?>
88
  <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_container" class="frm_conf_field_container frm_form_fields frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>">
89
  <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_conf_container">
90
  <div class="frm_form_fields">
91
- <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" <?php do_action('frm_field_input_html', $field) ?> />
92
  </div>
93
  <div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php
94
  echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div>
88
  <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_container" class="frm_conf_field_container frm_form_fields frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>">
89
  <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_conf_container">
90
  <div class="frm_form_fields">
91
+ <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" class="dyn_default_value" />
92
  </div>
93
  <div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php
94
  echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div>
css/_single_theme.css.php CHANGED
@@ -164,10 +164,12 @@ if ( ! isset( $center_form ) ) {
164
 
165
  .<?php echo esc_html( $style_class ) ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{
166
  content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ) ?>";
 
167
  }
168
 
169
  .<?php echo esc_html( $style_class ) ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{
170
  content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ) ?>";
 
171
  }
172
 
173
  .<?php echo esc_html( $style_class ) ?> .form-field{
@@ -729,7 +731,6 @@ if ( ! $submit_style ) { ?>
729
  background-color:transparent<?php echo esc_html( $important ) ?>;
730
  border:none<?php echo esc_html( $important ) ?>;
731
  display:inline<?php echo esc_html( $important ) ?>;
732
- width:auto<?php echo esc_html( $important ) ?>;
733
  padding:0<?php echo esc_html( $important ) ?>;
734
  }
735
 
164
 
165
  .<?php echo esc_html( $style_class ) ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{
166
  content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ) ?>";
167
+ color:#<?php echo esc_html( $section_color . $important ) ?>;
168
  }
169
 
170
  .<?php echo esc_html( $style_class ) ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{
171
  content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ) ?>";
172
+ color:#<?php echo esc_html( $section_color . $important ) ?>;
173
  }
174
 
175
  .<?php echo esc_html( $style_class ) ?> .form-field{
731
  background-color:transparent<?php echo esc_html( $important ) ?>;
732
  border:none<?php echo esc_html( $important ) ?>;
733
  display:inline<?php echo esc_html( $important ) ?>;
 
734
  padding:0<?php echo esc_html( $important ) ?>;
735
  }
736
 
css/custom_theme.css.php CHANGED
@@ -259,6 +259,7 @@ a.frm_save_draft{
259
  margin-right:5px;
260
  width:auto;
261
  border:none;
 
262
  }
263
 
264
  .with_frm_style :invalid,
@@ -1034,7 +1035,6 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
1034
  -webkit-box-shadow:none;
1035
  box-shadow:none !important;
1036
  display:inline;
1037
- width:auto !important;
1038
  -moz-appearance:textfield;
1039
  padding:0;
1040
  }
259
  margin-right:5px;
260
  width:auto;
261
  border:none;
262
+ vertical-align:baseline;
263
  }
264
 
265
  .with_frm_style :invalid,
1035
  -webkit-box-shadow:none;
1036
  box-shadow:none !important;
1037
  display:inline;
 
1038
  -moz-appearance:textfield;
1039
  padding:0;
1040
  }
css/dropzone.css CHANGED
@@ -549,7 +549,7 @@
549
  }
550
 
551
  .frm_compact .frm_dropzone .dz-preview.dz-error .dz-error-message{
552
- top: 0;
553
  padding: 4px;
554
  width: auto;
555
  text-align: center;
@@ -562,7 +562,7 @@
562
  top: 6px;
563
  }
564
 
565
- .frm_compact .frm_dropzone .dz-error .dz-remove{
566
  display:none;
567
  }
568
 
549
  }
550
 
551
  .frm_compact .frm_dropzone .dz-preview.dz-error .dz-error-message{
552
+ top: -40px;
553
  padding: 4px;
554
  width: auto;
555
  text-align: center;
562
  top: 6px;
563
  }
564
 
565
+ .frm_compact .frm_dropzone .dz-preview:hover .dz-error-mark{
566
  display:none;
567
  }
568
 
css/frm_admin.css CHANGED
@@ -290,6 +290,15 @@ form label.frm_primary_label input{font-size:12px;}
290
  margin-top:10px;
291
  }
292
 
 
 
 
 
 
 
 
 
 
293
  .update-nag.frm-update-to-pro{
294
  display:block;
295
  text-align:center;
@@ -323,10 +332,8 @@ form label.frm_primary_label input{font-size:12px;}
323
  border:1px solid #BB3E01;
324
  }
325
 
326
- .frm_pro_heading{
327
- position:absolute;
328
- left:285px;
329
- line-height: 2.3em !important;
330
  }
331
 
332
  .upgrade_to_pro .frm_check_icon{
@@ -681,6 +688,8 @@ label input[type="checkbox"], label input[type="radio"] {vertical-align:inherit;
681
  border-radius:5px;
682
  -moz-border-radius:5px;
683
  -webkit-border-radius:5px;
 
 
684
  position:relative;
685
  }
686
  .frm_field_list #frm-insert-fields .button a{
290
  margin-top:10px;
291
  }
292
 
293
+ .upgrade_to_pro{
294
+ background: #fff;
295
+ padding: 10px 25px 25px;
296
+ }
297
+
298
+ .upgrade_to_pro .error{
299
+ display:none;
300
+ }
301
+
302
  .update-nag.frm-update-to-pro{
303
  display:block;
304
  text-align:center;
332
  border:1px solid #BB3E01;
333
  }
334
 
335
+ .frm_pro_heading span{
336
+ margin-top:20px;
 
 
337
  }
338
 
339
  .upgrade_to_pro .frm_check_icon{
688
  border-radius:5px;
689
  -moz-border-radius:5px;
690
  -webkit-border-radius:5px;
691
+ }
692
+ #postbox-container-1 .frm_field_list #frm-insert-fields .frmbutton.dropdown{
693
  position:relative;
694
  }
695
  .frm_field_list #frm-insert-fields .button a{
formidable.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Formidable
4
  Description: Quickly and easily create drag-and-drop forms
5
- Version: 2.02.06
6
  Plugin URI: http://formidablepro.com/
7
  Author URI: http://strategy11.com
8
  Author: Strategy11
2
  /*
3
  Plugin Name: Formidable
4
  Description: Quickly and easily create drag-and-drop forms
5
+ Version: 2.02.07
6
  Plugin URI: http://formidablepro.com/
7
  Author URI: http://strategy11.com
8
  Author: Strategy11
js/formidable.js CHANGED
@@ -140,6 +140,12 @@ function frmFrontFormJS(){
140
  maxFilesize: uploadFields[i].maxFilesize,
141
  maxFiles: max,
142
  uploadMultiple: uploadFields[i].uploadMultiple,
 
 
 
 
 
 
143
  dictCancelUpload: uploadFields[i].cancel,
144
  dictCancelUploadConfirmation: uploadFields[i].cancelConfirm,
145
  dictRemoveFile: uploadFields[i].remove,
@@ -167,7 +173,7 @@ function frmFrontFormJS(){
167
  this.on('successmultiple', function( files, response ) {
168
  var mediaIDs = jQuery.parseJSON(response);
169
  for ( var m = 0; m < files.length; m++ ) {
170
- jQuery(files[m].previewElement).append( getHiddenUploadHTML( uploadFields[i], mediaIDs[m] ) );
171
  }
172
  });
173
 
@@ -180,7 +186,7 @@ function frmFrontFormJS(){
180
  this.on('complete', function( file ) {
181
  if ( typeof file.mediaID !== 'undefined' ) {
182
  if ( uploadFields[i].uploadMultiple ) {
183
- jQuery(file.previewElement).append( getHiddenUploadHTML( uploadFields[i], file.mediaID ) );
184
  }
185
 
186
  // Add download link to the file
@@ -229,8 +235,8 @@ function frmFrontFormJS(){
229
  });
230
  }
231
 
232
- function getHiddenUploadHTML( field, mediaID ) {
233
- return '<input name="'+ field.fieldName +'[]" type="hidden" value="'+ mediaID +'" data-frmfile="'+ field.fieldID +'" />';
234
  }
235
 
236
  function removeFile(){
@@ -376,18 +382,19 @@ function frmFrontFormJS(){
376
  var field_id = nameParts[0];
377
  var isRepeating = false;
378
 
379
- if ( nameParts.length === 1 || nameParts[1] == '[form' || nameParts[1] == '[row_ids' ) {
380
  return field_id;
381
  }
382
 
 
 
 
 
 
383
  // Check if 'this' is in a repeating section
384
  if ( jQuery('input[name="item_meta['+ field_id +'][form]"]').length ) {
385
- // If item_meta[370][0]
386
- if ( nameParts.length === 2 && nameParts[1] == '[0' ) {
387
- return 0;
388
- }
389
 
390
- // this is a repeatable section with name: item_meta[370][0][414]
391
  field_id = nameParts[2].replace('[', '');
392
  isRepeating = true;
393
  }
@@ -2388,7 +2395,7 @@ function frmFrontFormJS(){
2388
  var dec = thisCalc.calc_dec;
2389
 
2390
  // allow .toFixed for reverse compatability
2391
- if ( thisFullCalc.indexOf(').toFixed(') ) {
2392
  var calcParts = thisFullCalc.split(').toFixed(');
2393
  if ( isNumeric(calcParts[1]) ) {
2394
  dec = calcParts[1];
@@ -3423,19 +3430,25 @@ function frmFrontFormJS(){
3423
  /* Repeating Fields */
3424
  function removeRow(){
3425
  /*jshint validthis:true */
3426
- var id = 'frm_section_'+ jQuery(this).data('parent') +'-'+ jQuery(this).data('key');
 
 
3427
  var thisRow = jQuery(document.getElementById(id));
3428
  var fields = thisRow.find('input, select, textarea');
 
3429
 
3430
  thisRow.fadeOut('slow', function(){
3431
  thisRow.remove();
3432
 
3433
  fields.each(function(){
3434
  /* update calculations when a row is removed */
 
3435
  if ( this.type != 'file' ) {
3436
- var fieldID = getFieldId( this, false );
3437
  doCalculation(fieldID, jQuery(this));
3438
  }
 
 
 
3439
  });
3440
 
3441
  if(typeof(frmThemeOverride_frmRemoveRow) == 'function'){
@@ -3499,6 +3512,7 @@ function frmFrontFormJS(){
3499
  if ( this.id === false || this.id === '' ) {
3500
  return;
3501
  }
 
3502
  fieldObject = jQuery( '#' + this.id );
3503
  checked.push(fieldID);
3504
  hideOrShowFieldById( fieldID, repeatArgs );
@@ -3636,7 +3650,7 @@ function frmFrontFormJS(){
3636
 
3637
  function loadChosen() {
3638
  if ( jQuery().chosen ) {
3639
- var opts = {allow_single_deselect:true};
3640
  if ( typeof __frmChosen !== 'undefined' ) {
3641
  opts = '{' + __frmChosen + '}';
3642
  }
@@ -3996,6 +4010,9 @@ function frmFrontFormJS(){
3996
  var scrollObj = '';
3997
  if(typeof(object) == 'undefined'){
3998
  scrollObj = jQuery(document.getElementById('frm_form_'+id+'_container'));
 
 
 
3999
  } else if ( typeof id == 'string' ) {
4000
  scrollObj = jQuery(object).find('#frm_field_'+id+'_container');
4001
  } else {
140
  maxFilesize: uploadFields[i].maxFilesize,
141
  maxFiles: max,
142
  uploadMultiple: uploadFields[i].uploadMultiple,
143
+ dictDefaultMessage: uploadFields[i].defaultMessage,
144
+ dictFallbackMessage: uploadFields[i].fallbackMessage,
145
+ dictFallbackText: uploadFields[i].fallbackText,
146
+ dictFileTooBig: uploadFields[i].fileTooBig,
147
+ dictInvalidFileType: uploadFields[i].invalidFileType,
148
+ dictResponseError: uploadFields[i].responseError,
149
  dictCancelUpload: uploadFields[i].cancel,
150
  dictCancelUploadConfirmation: uploadFields[i].cancelConfirm,
151
  dictRemoveFile: uploadFields[i].remove,
173
  this.on('successmultiple', function( files, response ) {
174
  var mediaIDs = jQuery.parseJSON(response);
175
  for ( var m = 0; m < files.length; m++ ) {
176
+ jQuery(files[m].previewElement).append( getHiddenUploadHTML( uploadFields[i], mediaIDs[m], fieldName ) );
177
  }
178
  });
179
 
186
  this.on('complete', function( file ) {
187
  if ( typeof file.mediaID !== 'undefined' ) {
188
  if ( uploadFields[i].uploadMultiple ) {
189
+ jQuery(file.previewElement).append( getHiddenUploadHTML( uploadFields[i], file.mediaID, fieldName ) );
190
  }
191
 
192
  // Add download link to the file
235
  });
236
  }
237
 
238
+ function getHiddenUploadHTML( field, mediaID, fieldName ) {
239
+ return '<input name="'+ fieldName +'[]" type="hidden" value="'+ mediaID +'" data-frmfile="'+ field.fieldID +'" />';
240
  }
241
 
242
  function removeFile(){
382
  var field_id = nameParts[0];
383
  var isRepeating = false;
384
 
385
+ if ( nameParts.length === 1 ) {
386
  return field_id;
387
  }
388
 
389
+ if ( nameParts[1] === '[form' || nameParts[1] === '[row_ids' ) {
390
+ return 0;
391
+ }
392
+
393
+
394
  // Check if 'this' is in a repeating section
395
  if ( jQuery('input[name="item_meta['+ field_id +'][form]"]').length ) {
 
 
 
 
396
 
397
+ // this is a repeatable section with name: item_meta[repeating-section-id][row-id][field-id]
398
  field_id = nameParts[2].replace('[', '');
399
  isRepeating = true;
400
  }
2395
  var dec = thisCalc.calc_dec;
2396
 
2397
  // allow .toFixed for reverse compatability
2398
+ if ( thisFullCalc.indexOf(').toFixed(') > -1 ) {
2399
  var calcParts = thisFullCalc.split(').toFixed(');
2400
  if ( isNumeric(calcParts[1]) ) {
2401
  dec = calcParts[1];
3430
  /* Repeating Fields */
3431
  function removeRow(){
3432
  /*jshint validthis:true */
3433
+ var rowNum = jQuery(this).data('key');
3434
+ var sectionID = jQuery(this).data('parent');
3435
+ var id = 'frm_section_'+ sectionID +'-'+ rowNum;
3436
  var thisRow = jQuery(document.getElementById(id));
3437
  var fields = thisRow.find('input, select, textarea');
3438
+ var formId = jQuery(this).closest('form').find('input[name="form_id"]').val();
3439
 
3440
  thisRow.fadeOut('slow', function(){
3441
  thisRow.remove();
3442
 
3443
  fields.each(function(){
3444
  /* update calculations when a row is removed */
3445
+ var fieldID = getFieldId( this, false );
3446
  if ( this.type != 'file' ) {
 
3447
  doCalculation(fieldID, jQuery(this));
3448
  }
3449
+
3450
+ var container = 'frm_field_' + fieldID + '-' + sectionID + '-' + rowNum + '_container';
3451
+ removeFromHideFields( container, formId );
3452
  });
3453
 
3454
  if(typeof(frmThemeOverride_frmRemoveRow) == 'function'){
3512
  if ( this.id === false || this.id === '' ) {
3513
  return;
3514
  }
3515
+
3516
  fieldObject = jQuery( '#' + this.id );
3517
  checked.push(fieldID);
3518
  hideOrShowFieldById( fieldID, repeatArgs );
3650
 
3651
  function loadChosen() {
3652
  if ( jQuery().chosen ) {
3653
+ var opts = {allow_single_deselect:true,no_results_text:frm_js.no_results};
3654
  if ( typeof __frmChosen !== 'undefined' ) {
3655
  opts = '{' + __frmChosen + '}';
3656
  }
4010
  var scrollObj = '';
4011
  if(typeof(object) == 'undefined'){
4012
  scrollObj = jQuery(document.getElementById('frm_form_'+id+'_container'));
4013
+ if(scrollObj.length < 1 ){
4014
+ return;
4015
+ }
4016
  } else if ( typeof id == 'string' ) {
4017
  scrollObj = jQuery(object).find('#frm_field_'+id+'_container');
4018
  } else {
js/formidable.min.js CHANGED
@@ -2,91 +2,92 @@ function frmFrontFormJS(){function l(a){var b=jQuery(this),c=b.attr("type");"sub
2
  jQuery(this).toggleClass("active").children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s").toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e")}function p(){for(var a=__frmUniqueTimes,b=0;b<a.length;b++)a[b].dateID==this.id&&frmFrontForm.removeUsedTimes(this,a[b].timeID)}function r(){if(-1===this.className.indexOf("frm_custom_date")&&"undefined"!==typeof __frmDatepicker){var a=__frmDatepicker,b=this.id,c=b.split("-");c.pop();c='input[id^="'+c.join("-")+'"]';jQuery.datepicker.setDefaults(jQuery.datepicker.regional[""]);
3
  for(var d=0,e=0;e<a.length;e++)if(a[e].triggerID=="#"+b||a[e].triggerID==c)d=e;""!==a[d].options.defaultDate&&(a[d].options.defaultDate=new Date(a[d].options.defaultDate));jQuery(this).datepicker(jQuery.extend(jQuery.datepicker.regional[a[d].locale],a[d].options))}}function v(a){if("undefined"!==typeof __frmDropzone)for(var b=__frmDropzone,c=0;c<b.length;c++)z(c,a)}function z(a,b){var c=__frmDropzone,d="#"+c[a].htmlID+"_dropzone",e=c[a].fieldName;"undefined"!==typeof b&&-1!==d.indexOf("-0_dropzone")&&
4
  (d=d.replace("-0_dropzone","-"+b+"_dropzone"),e=e.replace("[0]","["+b+"]"),delete c[a].mockFiles);d=jQuery(d);if(!(1>d.length||d.hasClass("dz-clickable"))){var f=c[a].maxFiles;if("undefined"!==typeof c[a].mockFiles){var h=c[a].mockFiles.length;0<f&&(f-=h)}var h=d.closest("form"),g=h.find('input[type="submit"], .frm_submit input[type="button"]'),k=h.find(".frm_ajax_loading");d.dropzone({url:frm_js.ajax_url,addRemoveLinks:!0,paramName:d.attr("id").replace("_dropzone",""),maxFilesize:c[a].maxFilesize,
5
- maxFiles:f,uploadMultiple:c[a].uploadMultiple,dictCancelUpload:c[a].cancel,dictCancelUploadConfirmation:c[a].cancelConfirm,dictRemoveFile:c[a].remove,dictMaxFilesExceeded:c[a].maxFilesExceeded,fallback:function(){jQuery(this.element).closest("form").removeClass("frm_ajax_submit")},init:function(){this.on("sending",function(b,d,e){e.append("action","frm_submit_dropzone");e.append("field_id",c[a].fieldID);e.append("form_id",c[a].formID)});this.on("success",function(b,d){for(var f=jQuery.parseJSON(d),
6
- g=0;g<f.length;g++)!0!==c[a].uploadMultiple&&jQuery('input[name="'+e+'"]').val(f[g])});this.on("successmultiple",function(b,d){for(var e=jQuery.parseJSON(d),f=0;f<b.length;f++)jQuery(b[f].previewElement).append(y(c[a],e[f]))});this.on("removedfile",function(b){!0!==c[a].uploadMultiple&&jQuery('input[name="'+e+'"]').val("")});this.on("complete",function(b){if("undefined"!==typeof b.mediaID){c[a].uploadMultiple&&jQuery(b.previewElement).append(y(c[a],b.mediaID));for(var d=b.previewElement.querySelectorAll("[data-dz-name]"),
7
- e=0,f=d.length;e<f;e++)d[e].innerHTML='<a href="'+b.url+'">'+b.name+"</a>"}});this.on("addedfile",function(){k.addClass("frm_loading_now");g.attr("disabled","disabled")});this.on("queuecomplete",function(){k.removeClass("frm_loading_now");g.removeAttr("disabled")});this.on("removedfile",function(b){"undefined"!==typeof b.mediaID&&(jQuery(b.previewElement).remove(),this.options.maxFiles=c[a].maxFiles-this.files.length)});if("undefined"!==typeof c[a].mockFiles)for(var b=0;b<c[a].mockFiles.length;b++){var d=
8
- {name:c[a].mockFiles[b].name,size:c[a].mockFiles[b].size,url:c[a].mockFiles[b].file_url,mediaID:c[a].mockFiles[b].id};this.emit("addedfile",d);this.emit("thumbnail",d,c[a].mockFiles[b].url);this.emit("complete",d);this.files.push(d)}}})}}function y(a,b){return'<input name="'+a.fieldName+'[]" type="hidden" value="'+b+'" data-frmfile="'+a.fieldID+'" />'}function w(){var a=jQuery(this).data("frm-remove");Pa(jQuery(this).parent(".dz-preview"));a=jQuery('input[name="'+a+'"]');a.length&&a.val("")}function A(){var a=
9
- this.type,b=!1,c=!1;if("select-one"===a)c=!0,"frm_other_trigger"===this.options[this.selectedIndex].className&&(b=!0);else if("select-multiple"===a)for(var c=!0,d=this.options,b=!1,e=0;e<d.length;e++)if("frm_other_trigger"===d[e].className&&d[e].selected){b=!0;break}c?(a=jQuery(this).parent().children(".frm_other_input"),a.length&&(b?a[0].className=a[0].className.replace("frm_pos_none",""):(1>a[0].className.indexOf("frm_pos_none")&&(a[0].className+=" frm_pos_none"),a[0].value=""))):"radio"===a?jQuery(this).is(":checked")&&
10
- (jQuery(this).closest(".frm_radio").children(".frm_other_input").removeClass("frm_pos_none"),jQuery(this).closest(".frm_radio").siblings().children(".frm_other_input").addClass("frm_pos_none").val("")):"checkbox"===a&&(this.checked?jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none"):jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val(""))}function F(a){var b=q(this,!1);if(b&&"undefined"!==typeof b&&(!a.frmTriggered||
11
- a.frmTriggered!=b)&&(ea(b,jQuery(this)),a="undefined"!==typeof a.originalEvent||-1<a.currentTarget.className.indexOf("frm_chzn")?"value changed":"other",fa(b,jQuery(this),a),L(b,jQuery(this)),jQuery(this).closest("form").hasClass("frm_js_validate"))){b=[];a=jQuery(this).closest(".frm_form_field");a.hasClass("frm_required_field")&&!jQuery(this).hasClass("frm_optional")&&(b=ga(this,b));if(1>b.length)if("email"==this.type)var c=jQuery(this).closest("form").find("input[type=email]"),b=ha(this,b,c);else"number"==
12
- this.type?b=ia(this,b):null!==this.pattern&&(b=ja(this,b));a.removeClass("frm_blank_field");a.find(".frm_error").remove();if(0<Object.keys(b).length)for(var d in b)M(a,d,b)}}function q(a,b){var c="",c=a instanceof jQuery?a.attr("name"):a.name;if(""===c)return c=a instanceof jQuery?a.data("name"):a.getAttribute("data-name"),""!==c&&c?c:0;c=c.replace("item_meta[","").replace("[]","").split("]");if(1>c.length)return 0;var c=c.filter(function(a){return""!==a}),d=c[0],e=!1;if(1===c.length||"[form"==c[1]||
13
- "[row_ids"==c[1])return d;if(jQuery('input[name="item_meta['+d+'][form]"]').length){if(2===c.length&&"[0"==c[1])return 0;d=c[2].replace("[","");e=!0}"other"===d&&(d=e?c[3].replace("[",""):c[1].replace("[",""));!0===b&&(d=d===c[0]?d+"-"+c[1].replace("[",""):d+"-"+c[0]+"-"+c[1].replace("[",""));return d}function ea(a,b){if(!("undefined"===typeof __FRMRULES||"undefined"===typeof __FRMRULES[a]||1>__FRMRULES[a].dependents.length||null===b||"undefined"===typeof b))for(var c=__FRMRULES[a],d=G(b[0].name),
14
- e=0,f=c.dependents.length;e<f;e++)H(c.dependents[e],d)}function H(a,b){var c=N(a);if(!(!1===c||1>c.conditions.length)){var d;d=[];if(c.isRepeating)if(""!==b.repeatingSection){var e="frm_field_"+c.fieldId+"-",e=e+(b.repeatingSection+"-"+b.repeatRow+"_container");d.push(e)}else if(d=O(c),null!==document.getElementById("frm_field_"+d+"_container")){d=[];for(var e=document.querySelectorAll(".frm_field_"+c.fieldId+"_container"),f=0,h=e.length;f<h;f++)d.push(e[f].id)}else{d=[];for(var f=O(c),e="frm_field_"+
15
- c.fieldId+"-"+f+"-",f=document.querySelectorAll('[name="item_meta['+f+'][row_ids][]"]'),h=0,g=f.length;h<g;h++)""!==f[h].value&&d.push(e+f[h].value+"_container");1>d.length&&d.push(e+"0_container")}else d.push("frm_field_"+c.fieldId+"_container");e=d.length;for(f=0;f<e;f++)c.containerId=d[f],ka(c,d[f]),la(c)}}function O(a){var b="";"0"!==a.inEmbedForm?b=a.inEmbedForm:"0"!==a.inSection&&(b=a.inSection);return b}function ka(a,b){if(a.isRepeating){var c=b.replace("_container","").split("-");a.repeatRow=
16
- c[2]}else a.repeatRow=""}function la(a){for(var b=[],c=a.conditions.length,d=0;d<c;d++)b.push(Qa(a.conditions[d],a));c=C="any"==a.anyAll?-1<b.indexOf(!0)?a.showHide:ma(a.showHide):-1<b.indexOf(!1)?ma(a.showHide):a.showHide;b=null!==document.getElementById(a.containerId);"show"==c?"data"==a.fieldType&&a.hasOwnProperty("dataLogic")?(a={fieldId:a.fieldId,fieldKey:a.fieldKey,formId:a.formId,containerId:a.containerId,repeatRow:a.repeatRow,dataLogic:{actualValue:a.dataLogic.actualValue,fieldId:a.dataLogic.fieldId},
17
- children:"",inputType:a.inputType},"data"==a.inputType?Ra(a,b):b&&Sa(a)):!1!==B(a.containerId,a.formId)&&(I(a.containerId,a.formId),b?(b=na(a.containerId),oa(b,"divider"==a.fieldType||"form"==a.fieldType,a.formId),jQuery("#"+a.containerId).show()):(b=pa(a),oa(b,"divider"==a.fieldType||"form"==a.fieldType,a.formId))):P(a,b)}function N(a){return"undefined"===typeof __FRMRULES||"undefined"===typeof __FRMRULES[a]?!1:__FRMRULES[a]}function Qa(a,b){var c=N(a.fieldId),d=qa(c,b);"data"==b.fieldType&&"data"==
18
- c.fieldType?(c=""===a.value?""===d||1==d.length&&""===d[0]?!1:!0:Q(a.operator,a.value,d),b.dataLogic=a,b.dataLogic.actualValue=d,d=c):d=Q(a.operator,a.value,d);return d}function qa(a,b){var c;if("radio"==a.inputType||"checkbox"==a.inputType)c=ra(a,b),c=document.querySelectorAll('input[name^="'+c+'"]'),c="checkbox"==a.inputType?R(c):sa(c);else if(c="",!0===a.isMultiSelect){c=ra(a,b);var d=document.querySelectorAll('[name^="'+c+'"]');1==d.length&&"hidden"!=d[0].type?(c=jQuery('[name^="'+c+'"]').val(),
19
- null===c&&(c="")):c=R(d)}else d="field_"+a.fieldKey,a.isRepeating&&(d+="-"+b.repeatRow),d=document.getElementById(d),null!==d&&(c=d.value);"undefined"===typeof c?c="":"string"===typeof c&&(c=c.trim());return c}function ra(a,b){return a.isRepeating?"item_meta["+("0"!==b.inEmbedForm?b.inEmbedForm:b.inSection)+"]["+b.repeatRow+"]["+a.fieldId+"]":"item_meta["+a.fieldId+"]"}function R(a){for(var b=[],c=0,d=a.length;c<d;c++)("hidden"==a[c].type||a[c].checked)&&b.push(a[c].value);0===b.length&&(b="");return b}
20
- function Q(a,b,c){b=Ta(b);c=Ua(b,c);return"string"===typeof b&&"-1"!=b.indexOf("&quot;")&&Q(a,b.replace("&quot;",'"'),c)?!0:{"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"<":function(a,b){return a>b},">":function(a,b){return a<b},LIKE:function(a,b){if(!b)return!1;a=S(a);b=ta(a,b);return-1!=b.indexOf(a)},"not LIKE":function(a,b){if(!b)return!0;a=S(a);b=ta(a,b);return-1==b.indexOf(a)}}[a](b,c)}function Ta(a){-1!==String(a).search(/^\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*$/)?a=parseFloat(a):
21
- "string"===typeof a&&(a=a.trim());return a}function Ua(a,b){"undefined"===typeof b&&(b="");jQuery.isArray(b)&&-1<jQuery.inArray(String(a),b)&&(b=a);"number"===typeof a&&"string"===typeof b&&(b=parseFloat(b));"string"===typeof b&&(b=b.trim());return b}function ta(a,b){b=S(b);var c;if(jQuery.isArray(b))for(var d=0,e=b.length;d<e;d++)if(c=b[d].toLowerCase(),-1<c.indexOf(a)){b=a;break}return b}function S(a){"string"===typeof a?a=a.toLowerCase():"number"===typeof a&&(a=a.toString());return a}function ma(a){return"show"==
22
- a?"hide":"show"}function na(a){return document.getElementById(a).querySelectorAll('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]')}function pa(a){if("divider"==a.fieldType){var b=[];"divider"==a.fieldType&&(b=document.querySelectorAll('[data-sectionid="'+a.fieldId+'"]'));a=b}else"form"==a.fieldType?a=document.querySelectorAll('[id^="field_'+a.fieldKey+'-"]'):(a=a.isRepeating?"item_meta["+O(a)+"]["+a.repeatRow+"]["+a.fieldId+"]":"item_meta["+a.fieldId+"]",a=document.querySelectorAll('[name^="'+
23
- a+'"]'));return a}function oa(a,b,c){if(a.length)for(var d,e=["checkbox","radio"],f=0;f<a.length;f++)if(!(0<f&&"undefined"!==typeof d&&d.name==a[f].name&&-1<e.indexOf(d.type)||b&&T(a[f],c))){d=a[f];var h=jQuery(d),g=h.data("frmval");if("undefined"!==typeof g){if("checkbox"==d.type||"radio"==d.type)for(var k=document.getElementsByName(d.name),m=0,l=k.length;m<l;m++)if("hidden"==k[m].type)jQuery.isArray(g)&&null!==g[m]?k[m].value=g[m]:k[m].value=g;else{if(k[m].value==g||jQuery.isArray(g)&&-1<g.indexOf(k[m].value))if(k[m].checked=
24
- !0,"radio"==k[m].type)break}else if(-1<d.name.indexOf("[]"))if(k=document.getElementsByName(d.name),jQuery.isArray(g))for(m=0,l=g.length;m<l;m++)m in k&&(k[m].value=g[m]);else null!==k[0]&&(k[0].value=g);else g.constructor===Object&&(k=d.getAttribute("name").split("[").slice(-1)[0],null!==k&&(k=k.replace("]",""),g=g[k],"undefined"==typeof g&&(g=""))),d.value=g;"SELECT"==d.tagName&&U(d);u(h)}d=a[f];h=q(d,!1);h=V(h);!1!==h&&"lookup"!=h.fieldType&&(h.parentVals=W(h),ua(h,d));d=a[f];if(h="undefined"!==
25
- typeof __FRMCALC){h=d.type;g=!1;if("text"==h||"hidden"==h||"number"==h)g=!0;h=g}if(h){h=__FRMCALC;g=d.name;k=d.id.replace("field_","");if(3<=g.split("][").length)for(g=k.split("-"),k="",m=0;m<g.length-1;m++)k=""===k?g[m]:k+"-"+g[m];g=k;k=null;3<=d.name.split("][").length&&(k="hidden"!=d.type?jQuery(d).closest(".frm_form_field"):jQuery(d));d=k;void 0!==h.calc[g]&&X(h,g,[],d)}d=a[f]}}function T(a,b){var c=q(a,!0);return B("frm_field_"+c+"_container",b)}function P(a,b){if(!B(a.containerId,a.formId)){if(b){jQuery("#"+
26
- a.containerId).hide();var c=na(a.containerId)}else c=pa(a);Y(c);va(a.containerId,a.formId)}}function Y(a){if(!(1>a.length)){for(var b,c=!0,d=0,e=a.length;d<e;d++)0<d&&b.name!=a[d].name&&!0===c&&u(jQuery(b)),c=!0,"radio"==a[d].type||"checkbox"==a[d].type?a[d].checked=!1:"SELECT"==a[d].tagName?(0===a[d].selectedIndex?c=!1:a[d].selectedIndex=0,null!==document.getElementById(a[d].id+"_chosen")&&jQuery(a[d]).trigger("chosen:updated")):a[d].value="",b=a[d];!0===c&&u(jQuery(b))}}function B(a,b){var c=!1;
27
- -1<D(b).indexOf(a)&&(c=!0);return c}function va(a,b){var c=D(b);if(!(-1<c.indexOf(a))){c.push(a);var c=JSON.stringify(c),d=document.getElementById("frm_hide_fields_"+b);null!==d&&(d.value=c)}}function D(a){var b=[];a=document.getElementById("frm_hide_fields_"+a);return null===a?b:b=(b=a.value)?JSON.parse(b):[]}function I(a,b){var c=D(b),d=c.indexOf(a);-1<d&&(c.splice(d,1),c=JSON.stringify(c),document.getElementById("frm_hide_fields_"+b).value=c)}function fa(a,b,c){if(!("undefined"===typeof __FRMLOOKUP||
28
- "undefined"===typeof __FRMLOOKUP[a]||1>__FRMLOOKUP[a].dependents.length||null===b||"undefined"===typeof b)){a=__FRMLOOKUP[a];b=G(b[0].name);for(var d=0,e=a.dependents.length;d<e;d++)Z(a.dependents[d],b,c)}}function Z(a,b,c){a=V(a);if(!(!1===a||1>a.parents.length))if("lookup"==a.fieldType){if(""!==b.repeatRow){c=[];var d="frm_field_"+a.fieldId+"-",d=d+(b.repeatingSection+"-"+b.repeatRow+"_container");b=document.getElementById(d);null!==b&&c.push(b);b=c}else b=[],a.isRepeating?b=document.querySelectorAll(".frm_field_"+
29
- a.fieldId+"_container"):(c=document.getElementById("frm_field_"+a.fieldId+"_container"),null!==c&&b.push(c));c=0;for(d=b.length;c<d;c++){ka(a,b[c].id);var e=a,f=b[c];e.parentVals=W(e);if("select"==e.inputType)Va(e,f);else if("radio"==e.inputType||"checkbox"==e.inputType)if(!1===e.parentVals){var h=f.getElementsByTagName("input");wa(e,f);Y(h)}else Wa(e,f)}}else if("value changed"===c)for(c="field_"+a.fieldKey,c=a.isRepeating?""!==b.repeatingSection?'[id="'+c+"-"+b.repeatRow+'"]':'[id^="'+c+'-"]':'[id="'+
30
- c+'"]',b=document.querySelectorAll(c),c=0,d=b.length;c<d;c++)e=a,f=G(b[c].name),e.repeatRow=""!==f.repeatRow?f.repeatRow:"",e=a,f=b[c],e.parentVals=W(e),ua(e,f)}function V(a){return"undefined"===typeof __FRMLOOKUP||"undefined"===typeof __FRMLOOKUP[a]?!1:__FRMLOOKUP[a]}function W(a){for(var b=[],c=a.parents,d,e=0,f=c.length;e<f;e++){d=V(c[e]);d=qa(d,a);if(""===d||!1===d){b=!1;break}b[e]=d}return b}function sa(a){for(var b=!1,c=a.length,d=0;d<c;d++)if("hidden"==a[d].type||a[d].checked){b=a[d].value;
31
- break}return b}function Va(a,b){var c=b.getElementsByTagName("SELECT")[0];if(null!==c){var d=c.value;!1===a.parentVals?(c.options.length=1,""!==d&&(c.value="",U(c),u(jQuery(c),a.fieldKey))):(Xa(c),jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_replace_lookup_field_options",parent_fields:a.parents,parent_vals:a.parentVals,field_id:a.fieldId,nonce:frm_js.nonce},success:function(b){var d=a.fieldKey,h=c.value;b=JSON.parse(b);for(var g=c.options.length;0<g;g--)c.remove(g);for(var k=b.length,
32
- g=0;g<k;g++)c.options[g+1]=new Option(b[g],b[g],!1,!1);c.value=h;""===c.value&&(b=c.getAttribute("data-frmval"),null!==b&&(c.value=b));U(c);c.value!=h&&u(jQuery(c),d)}}))}}function U(a){-1<a.className.indexOf("frm_chzn")&&jQuery().chosen&&jQuery(a).trigger("chosen:updated")}function Xa(a){a.value||(a.options.length=1,a.options[1]=new Option(frm_js.loading,"",!1,!1))}function Wa(a,b){var c=b.getElementsByClassName("frm_opt_container")[0],d=c.getElementsByTagName("input");Ya(b,c);var e="",e="radio"==
33
- a.inputType?sa(d):R(d);jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_replace_cb_radio_lookup_options",parent_fields:a.parents,parent_vals:a.parentVals,field_id:a.fieldId,row_index:a.repeatRow,current_value:e,nonce:frm_js.nonce},success:function(e){c.innerHTML=e;e=b.getElementsByClassName("frm-loading-img")[0];null!==e&&void 0!==e&&e.parentNode.removeChild(e);c.style.display="block";1==d.length&&""===d[0].value?wa(a,b):!1!==B(b.id,a.formId)&&(e=N(a.fieldId),!1===e||1>e.conditions.length?
34
- (I(b.id,a.formId),jQuery("#"+b.id).show()):(e.containerId=b.id,e.repeatRow=a.repeatRow,la(e)));u(jQuery(d[0]),a.fieldKey)}})}function wa(a,b){B(b.id,a.formId)||(jQuery("#"+b.id).hide(),va(b.id,a.formId))}function ua(a,b){if(!T(b,a.formId))if(!1===a.parentVals){var c=b.getAttribute("data-frmval");null===c&&(c="");xa(a,b,c)}else jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_get_lookup_text_value",parent_fields:a.parents,parent_vals:a.parentVals,field_id:a.fieldId,nonce:frm_js.nonce},
35
- success:function(c){b.value!=c&&xa(a.fieldKey,b,c)}})}function xa(a,b,c){b.value=c;u(jQuery(b),a)}function Ra(a,b){if(b){var c=jQuery("#"+a.containerId);ya(c)}jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_get_data",entry_id:a.dataLogic.actualValue,current_field:a.fieldId,hide_id:a.containerId,nonce:frm_js.nonce},success:function(d){if(b){var e=c.find(".frm_opt_container");e.html(d);var f=e.children("input"),h=f.val();za(e);""===d||""===h?P(a,!0):Aa(a,c,f,!0)}else e="field_"+
36
- a.fieldKey,""!==a.repeatRow&&(e+="-"+a.repeatRow),e=document.getElementById(e),e.value=d,B(a.containerId,a.formId)&&I(a.containerId,a.formId),u(jQuery(e))}})}function Sa(a,b){var c=jQuery("#"+a.containerId),d=c.find('select[name^="item_meta"], input[name^="item_meta"]'),e=Ba(d),d=d.data("frmval");ya(c);jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_data_options",trigger_field_id:a.dataLogic.fieldId,entry_id:a.dataLogic.actualValue,field_id:a.fieldId,default_value:d,container_id:a.containerId,
37
- prev_val:e,nonce:frm_js.nonce},success:function(b){var d=c.find(".frm_opt_container");d.html(b);var g=d.find('select, input[type="checkbox"], input[type="radio"]');za(d);""===b||1>g.length?P(a,!0):(b=Ba(g),Aa(a,c,g,e!==b))}})}function ya(a){var b=a.html();-1<b.indexOf("frm-loading-img")||(a.html(b+'<span class="frm-loading-img"></span>'),a.find(".frm_opt_container").hide())}function Ya(a,b){if(!(-1<a.innerHTML.indexOf("frm-loading-img"))){b.style.display="none";var c=document.createElement("span");
38
- c.setAttribute("class","frm-loading-img");a.insertBefore(c,b.nextSibling)}}function za(a){a.parent().children(".frm-loading-img").remove();a.show()}function Ba(a){var b=[],c="";a.each(function(){c=this.value;"radio"===this.type||"checkbox"===this.type?!0===this.checked&&b.push(c):""!==c&&b.push(c)});0===b.length&&(b="");return b}function Aa(a,b,c,d){B(a.containerId,a.formId)&&(I(a.containerId,a.formId),b.show());c.hasClass("frm_chzn")&&aa();!0===d&&u(c)}function L(a,b){if("undefined"!==typeof __FRMCALC){var c=
39
- __FRMCALC,d=c.fields[a];if("undefined"!==typeof d)for(var d=d.total,e=[],f=0,h=d.length;f<h;f++){var g;g=c.calc[d[f]];var k=b.attr("name"),m=!1,l=g.field_id,n=D(g.form_id);1>n.length||("0"===g.inSection&&"0"===g.inEmbedForm?m=J(l,n):(k=G(k),J(l,n)?m=!0:Ca(l,k,n)?m=!0:"0"!==g.inSection&&"0"!==g.inEmbedForm?m=Ca(g.inSection,k,n):"0"!==g.inSection?m=J(g.inSection,n):"0"!==g.inEmbedForm&&(m=J(g.inEmbedForm,n))));g=m;!1===g&&X(c,d[f],e,b)}}}function J(a,b){return-1<b.indexOf("frm_field_"+a+"_container")}
40
- function Ca(a,b,c){var d=!1;b.repeatingSection&&(a="frm_field_"+a+"-"+b.repeatingSection,a+="-"+b.repeatRow+"_container",d=-1<c.indexOf(a));return d}function X(a,b,c,d){var e=a.calc[b],f=e.calc,h=jQuery(document.getElementById("field_"+b)),g={triggerField:d,inSection:!1,thisFieldCall:'input[id^="field_'+b+'-"]'};1>h.length&&"undefined"!==typeof d&&(g.inSection=!0,g.thisFieldId=Za(a.fieldsWithCalc,b),h=Da(g));if(!(1>h.length)){f=$a(e,f,a,c,g);if("text"!=e.calc_type){a=e.calc_dec;f.indexOf(").toFixed(")&&
41
- (c=f.split(").toFixed("),Ea(c[1])&&(a=c[1],f=f.replace(").toFixed("+a,"")));f=parseFloat(eval(f));if("undefined"===typeof f||isNaN(f))f=0;Ea(a)&&(f=f.toFixed(a))}h.val()!=f&&(h.val(f),u(h,b))}}function $a(a,b,c,d,e){for(var f=0,h=a.fields.length;f<h;f++){var g={triggerField:e.triggerField,thisFieldId:a.fields[f],inSection:e.inSection,valKey:e.inSection+""+a.fields[f],thisField:c.fields[a.fields[f]],thisFieldCall:"input"+c.fieldKeys[a.fields[f]]},k=c;"checkbox"==g.thisField.type||"radio"==g.thisField.type||
42
- "scale"==g.thisField.type?g.thisFieldCall=g.thisFieldCall+":checked,"+g.thisFieldCall+"[type=hidden]":"select"==g.thisField.type||"time"==g.thisField.type?g.thisFieldCall="select"+k.fieldKeys[g.thisFieldId]+" option:selected,"+g.thisFieldCall+"[type=hidden]":"textarea"==g.thisField.type&&(g.thisFieldCall=g.thisFieldCall+",textarea"+k.fieldKeys[g.thisFieldId]);if("text"==a.calc_type)g.valKey="text"+g.valKey,d=ab(g,d),"undefined"===typeof d[g.valKey]&&(d[g.valKey]="");else{g.valKey="num"+g.valKey;d=
43
- bb(g,c,d);if("undefined"===typeof d[g.valKey]||isNaN(d[g.valKey]))d[g.valKey]=0;"date"==g.thisField.type&&0===d[g.valKey]&&(b="")}k="["+g.thisFieldId+"]";k=k.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");b=b.replace(new RegExp(k,"g"),d[g.valKey])}return b}function bb(a,b,c){if("undefined"!==typeof c[a.valKey]&&0!==c[a.valKey])return c;c[a.valKey]=0;var d=Fa(a);if(!1===d)return c;d.each(function(){var d=Ga(a.thisField,this);if("date"==a.thisField.type){var f;f=b.date;var h=0;if(d)if("undefined"===
44
- typeof jQuery.datepicker){h="-";-1<f.indexOf("/")&&(h="/");f=f.split(h);var d=d.split(h),g,k;g=h=k="";for(var m=0;m<f.length;m++)if("y"==f[m])g=((new Date).getFullYear()+15).toString().substr(2,2),g=d[m]>g?"19"+d[m]:"20"+d[m];else if("yy"==f[m])g=d[m];else if("m"==f[m]||"mm"==f[m])h=d[m],2>h.length&&(h="0"+h);else if("d"==f[m]||"dd"==f[m])k=d[m],2>k.length&&(k="0"+k);h=Date.parse(g+"-"+h+"-"+k)}else h=jQuery.datepicker.parseDate(f,d);f=h;null!==f&&(c[a.valKey]=Math.ceil(f/864E5))}else{f=d;""!==f&&
45
- 0!==f&&(f=f.trim(),f=parseFloat(f.replace(/,/g,"").match(/-?[\d\.]+$/)));if("undefined"===typeof f||isNaN(f)||""===f)f=0;c[a.valKey]+=f}});return c}function ab(a,b){if("undefined"!==typeof b[a.valKey]&&""!==b[a.valKey])return b;b[a.valKey]="";var c=Fa(a);if(!1===c)return b;c.each(function(){var c=Ga(a.thisField,this),c=c.trim();b[a.valKey]+=c});return b}function Fa(a){var b;if(!1===a.inSection)b=jQuery(a.thisFieldCall);else if(b=Da(a),null===b||"undefined"===typeof b)b=jQuery(a.thisFieldCall);if(null===
46
- b||"undefined"===typeof b||1>b.length)b=!1;return b}function Da(a){if("undefined"===typeof a.triggerField)return null;var b=a.triggerField.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");return b.length?(a=a.thisFieldCall.replace("[id=","[id^="),b.find(a)):null}function Ga(a,b){var c;c=!1;if("hidden"==b.type)""!==ba(b)&&(c=!0);else if("select"==a.type){var d=b.className;d&&-1<d.indexOf("frm_other_trigger")&&(c=!0)}else("checkbox"==a.type||"radio"==a.type)&&-1<b.id.indexOf("-other_")&&
47
- 0>b.id.indexOf("-otext")&&(c=!0);c?(c=0,"select"==a.type?"hidden"==b.type?(d=!1,2<b.name.split("[").length&&(d=!0),d||(c=ba(b))):c=jQuery(b).closest(".frm_other_container").find(".frm_other_input").val():"checkbox"!=a.type&&"radio"!=a.type||"hidden"==b.type||(c=ba(b))):c="checkbox"!==b.type&&"radio"!==b.type||!b.checked?jQuery(b).val():b.value;"undefined"===typeof c&&(c="");return c}function ba(a){var b="";a=document.getElementById(a.id+"-otext");null!==a&&""!==a.value&&(b=a.value);return b}function Ha(a){var b=
48
- !1;a=jQuery(a).find(".frm_saving_draft");a.length&&(b=a.val());return b}function Ia(a){var b=!1,c=jQuery(a).find(".frm_next_page");if(c.length&&c.val()){var d=jQuery(a).find('input[name="form_id"]').val();a=jQuery(a).find('input[name="frm_page_order_'+d+'"]');a=a.length?a.val():0;if(!a||c.val()<a)b=!0}return b}function ga(a,b){var c=a.getAttribute("data-frmfile");if("hidden"==a.type&&null===c)return b;var d="",e="";if("checkbox"==a.type||"radio"==a.type)c=jQuery('input[name="'+a.name+'"]').closest(".frm_required_field").find("input:checked"),
49
- jQuery(c).each(function(){d=this.value});else if("file"==a.type||c)"undefined"===typeof c&&(c=q(a,!0),c=c.replace("file","")),"undefined"===typeof b[c]&&(d=cb(c)),e=c;else{e=a.className;if(-1!==e.indexOf("frm_pos_none"))return b;d=jQuery(a).val();if("string"!==typeof d)for(var c=d,d="",f=0;f<c.length;f++)""!==c[f]&&(d=c[f]);e=-1===e.indexOf("frm_other_input")?q(a,!0):q(a,!1)}""===d&&(""===e&&(e=q(a,!0)),e in b||(b[e]=E(a,"data-reqmsg")));return b}function cb(a){var b="";jQuery('input[name="file'+
50
- a+'"], input[name="file'+a+'[]"], input[name^="item_meta['+a+']"]').each(function(){""===b&&(b=this.value)});return b}function ha(a,b,c){var d=a.value,e=q(a,!0);if(e in b)return b;var f=0===e.indexOf("conf_");if(""!==d||f){var h=/^(([^<>()\[\]\\.,;:\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,g=E(a,"data-invmsg");""!==d&&!1===h.test(d)?(b[e]=g,f&&(b[e.replace("conf_","")]="")):f&&(a=a.name.replace("conf_",""),
51
- c.filter('[name="'+a+'"]').val()!==d&&(b[e]="",b[e.replace("conf_","")]=""))}return b}function ia(a,b){var c=a.value;""!==c&&!1!==isNaN(c/1)&&(c=q(a,!0),c in b||(b[c]=E(a,"data-invmsg")));return b}function ja(a,b){var c=a.value,d=E(a,"pattern");if(""!==d&&""!==c){var e=q(a,!0);e in b||(d=new RegExp("^"+d+"$","i"),!1===d.test(c)&&(b[e]=E(a,"data-invmsg")))}return b}function E(a,b){var c=a.getAttribute(b);null===c&&(c="");return c}function db(a,b){jQuery(a).find('input[type="submit"], input[type="button"]').attr("disabled",
52
- "disabled");"undefined"==typeof b&&jQuery(a).find('input[name="frm_action"]').val();jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:jQuery(a).serialize()+"&action=frm_entries_"+b+"&nonce="+frm_js.nonce,success:function(b){var d={content:"",errors:{},pass:!1};null===b&&(b=d);b=b.replace(/^\s+|\s+$/g,"");b=0===b.indexOf("{")?jQuery.parseJSON(b):d;if("undefined"!=typeof b.redirect)window.location=b.redirect;else if(""!==b.content){jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");
53
- var e=jQuery(a).find('input[name="form_id"]').val();jQuery(a).closest("#frm_form_"+e+"_container").replaceWith(b.content);frmFrontForm.scrollMsg(e);"function"==typeof frmThemeOverride_frmAfterSubmit&&(e=jQuery('input[name="frm_page_order_'+e+'"]').val(),d=jQuery(b.content).find('input[name="form_id"]').val(),frmThemeOverride_frmAfterSubmit(d,e,b.content,a));e=jQuery(a).find('input[name="id"]');e.length&&jQuery(document.getElementById("frm_edit_"+e.val())).find("a").addClass("frm_ajax_edited").click();
54
- jQuery(b.content).find(".frm_message").length&&ca("pageLoad");da()}else if(Object.keys(b.errors).length){jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");d=!0;Ja();var f=!1,h;for(e in b.errors)if(h=jQuery(a).find("#frm_field_"+e+"_container"),h.length){if(!h.is(":visible")){var g=h.closest(".frm_toggle_container");g.length&&(g=g.prev(),g.hasClass("frm_trigger")||(g=g.prev(".frm_trigger")),g.click())}h.is(":visible")&&
55
- (M(h,e,b.errors),d=!1,h=jQuery(a).find("#frm_field_"+e+"_container .frm-g-recaptcha, #frm_field_"+e+"_container .g-recaptcha"),h.length&&(f=!0,h=h.data("rid"),jQuery().grecaptcha&&(h?grecaptcha.reset(h):grecaptcha.reset())))}Ka(a);!0!==f&&La(a,!1);d?a.submit():jQuery(a).prepend(b.error_message)}else eb(a),La(a,!0),a.submit()},error:function(){jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");a.submit()}})}function M(a,b,c){a.length&&a.is(":visible")&&(a.addClass("frm_blank_field"),
56
- "function"==typeof frmThemeOverride_frmPlaceError?frmThemeOverride_frmPlaceError(b,c):a.append('<div class="frm_error">'+c[b]+"</div>"))}function Ja(){jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");jQuery(".frm_error_style").remove()}function Ka(a){var b=jQuery(a).find(".frm_blank_field:first");b.length&&frmFrontForm.scrollMsg(b,a,!0)}function eb(a){var b=document.getElementById("frm_loading");null!==b&&(a=jQuery(a).find("input[type=file]").val(),
57
- "undefined"!=typeof a&&""!==a&&setTimeout(function(){jQuery(b).fadeIn("slow")},2E3))}function La(a,b){var c=jQuery(a).find(".frm-g-recaptcha, .g-recaptcha");c.length&&(!b||1>jQuery(a).find(".frm_next_page").length||1>jQuery(a).find(".frm_next_page").val())&&c.closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">')}function fb(){Ma(jQuery(this),"clear")}function gb(){Ma(jQuery(this),"replace")}function Ma(a,b){var c=a.data("frmval").replace(/(\n|\r\n)/g,
58
- "\r");if(""===c||"undefined"==typeof c)return!1;var d=a.val().replace(/(\n|\r\n)/g,"\r");"replace"==b?""===d&&a.addClass("frm_default").val(c):d==c&&a.removeClass("frm_default").val("")}function hb(){var a=jQuery(this),b=a.data("eid"),c=a.data("fid");a.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:b,form_id:c,nonce:frm_js.nonce},success:function(b){a.replaceWith(b)}});return!1}function ib(a,
59
- b){google.load("visualization","1.0",{packages:[b],callback:function(){var b=new google.visualization.DataTable,d=!1;-1!==jQuery.inArray("id",a.options.fields)&&(d=!0,b.addColumn("number",frm_js.id));for(var e=a.fields.length,f,h=0,g=e;h<g;h++){var k=a.fields[h];f=Na(k);b.addColumn(f,k.name)}h=!1;a.options.edit_link&&(h=!0,b.addColumn("string",a.options.edit_link));g=!1;a.options.delete_link&&(g=!0,b.addColumn("string",a.options.delete_link));if(null!==a.entries){var m=a.entries.length;b.addRows(m);
60
- for(var l=0,n=0;n<m;n++){var k=0,p=a.entries[n];d&&(b.setCell(l,k,p.id),k++);for(var q=0,r=e;q<r;q++){var t=a.fields[q];f=Na(t);t=p.metas[t.id];"number"!=f||null!==t&&""!==t?"boolean"==f&&(t=null===t||"false"==t||!1===t?!1:!0):t=0;b.setCell(l,k,t);k++}h&&("undefined"!==typeof p.editLink?b.setCell(l,k,'<a href="'+p.editLink+'">'+a.options.edit_link+"</a>"):b.setCell(l,k,""),k++);g&&("undefined"!==typeof p.deleteLink?b.setCell(l,k,'<a href="'+p.deleteLink+'" class="frm_delete_link" data-frmconfirm="'+
61
- a.options.confirm+'">'+a.options.delete_link+"</a>"):b.setCell(l,k,""));l++}}else for(b.addRows(1),h=k=0,g=e;h<g;h++)0<k?b.setCell(0,k,""):b.setCell(0,k,a.options.no_entries),k++;(new google.visualization.Table(document.getElementById("frm_google_table_"+a.options.form_id))).draw(b,a.graphOpts)}})}function jb(a){google.load("visualization","1.0",{packages:[a["package"]],callback:function(){var b;new google.visualization.DataTable;b=google.visualization.arrayToDataTable(a.data);var c=document.getElementById("chart_"+
62
- a.graph_id);if(null!==c){var d=a.type.charAt(0).toUpperCase()+a.type.slice(1);"Histogram"!==d&&"Table"!==d&&(d+="Chart");(new google.visualization[d](c)).draw(b,a.options)}}})}function Na(a){var b="string";if("number"==a.type)b="number";else if("checkbox"==a.type||"select"==a.type){var c=a.options.length;"select"==a.type&&""===a.options[0]&&(c="post_status"==a.field_options.post_field?3:c-1);1==c&&(b="boolean")}return b}function kb(){var a="frm_section_"+jQuery(this).data("parent")+"-"+jQuery(this).data("key"),
63
- b=jQuery(document.getElementById(a)),c=b.find("input, select, textarea");b.fadeOut("slow",function(){b.remove();c.each(function(){if("file"!=this.type){var a=q(this,!1);L(a,jQuery(this))}});"function"==typeof frmThemeOverride_frmRemoveRow&&frmThemeOverride_frmRemoveRow(a,b)});return!1}function lb(){if(!0===K)return!1;K=!0;var a=jQuery(this).data("parent"),b=0;if(0<jQuery(".frm_repeat_"+a).length)var c=jQuery(".frm_repeat_"+a+":last").attr("id").replace("frm_section_"+a+"-",""),b=-1<c.indexOf("i")?
64
- 1:1+parseInt(c);jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_add_form_row",field_id:a,i:b,nonce:frm_js.nonce},success:function(c){var e=c.html,f=jQuery(e).hide().fadeIn("slow");jQuery(".frm_repeat_"+a+":last").after(f);var h=["other"],g,k,m={repeatingSection:a.toString(),repeatRow:b.toString()};jQuery(e).find("input, select, textarea").each(function(){if("file"!=this.type){if(""===this.name)return!0;g=this.name.replace("item_meta[","").split("]")[2].replace("[","");
65
- -1==jQuery.inArray(g,h)&&!1!==this.id&&""!==this.id&&(k=jQuery("#"+this.id),h.push(g),H(g,m),Z(g,m,"value changed"),ea(g,k),fa(g,k,"value changed"),L(g,k))}});v(m.repeatRow);Oa();aa();"function"==typeof frmThemeOverride_frmAddRow&&frmThemeOverride_frmAddRow(a,c);K=!1},error:function(){K=!1}});return!1}function mb(){var a=jQuery(this),b=a.data("entryid"),c=a.data("prefix"),d=a.data("pageid"),e=a.data("formid"),f=a.data("cancel"),h=a.data("fields"),g=a.data("excludefields"),k=jQuery(document.getElementById(c+
66
- b)),m=k.html();k.html('<span class="frm-loading-img" id="'+c+b+'"></span><div class="frm_orig_content" style="display:none">'+m+"</div>");jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:d,entry_id:b,id:e,nonce:frm_js.nonce,fields:h,exclude_fields:g},success:function(b){k.children(".frm-loading-img").replaceWith(b);a.removeClass("frm_inplace_edit").addClass("frm_cancel_edit");a.html(f);ca("editInPlace");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"]',
67
- F);da()}});return!1}function nb(){var a=jQuery(this),b=a.data("entryid"),c=a.data("prefix"),d=a.data("edit");a.hasClass("frm_ajax_edited")||(b=jQuery(document.getElementById(c+b)),b.children(".frm_forms").replaceWith(""),b.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));a.removeClass("frm_cancel_edit").addClass("frm_inplace_edit");a.html(d);return!1}function ob(){var a=jQuery(this),b=a.data("deleteconfirm");if(confirm(b)){var c=a.data("entryid"),d=a.data("prefix");a.replaceWith('<span class="frm-loading-img" id="frm_delete_'+
68
- c+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:c,nonce:frm_js.nonce},success:function(a){"success"==a.replace(/^\s+|\s+$/g,"")?(jQuery(document.getElementById(d+c)).fadeOut("slow"),jQuery(document.getElementById("frm_delete_"+c)).fadeOut("slow")):jQuery(document.getElementById("frm_delete_"+c)).replaceWith(a)}})}return!1}function da(){"undefined"!==typeof __frmHideFields&&frmFrontForm.hidePreviouslyHiddenFields();jQuery(document).on("focusin",
69
- ".frm_date",r);if("undefined"!==typeof __frmUniqueTimes)for(var a=__frmUniqueTimes,b=0;b<a.length;b++)jQuery(document.getElementById(a[b].dateID)).change(p);if("undefined"!==typeof __frmMasks)for(a=__frmMasks,b=0;b<a.length;b++)jQuery(a[b].trigger).attr("data-frmmask",a[b].mask);Oa();aa();"undefined"!==typeof __frmDepDynamicFields&&frmFrontForm.checkDependentDynamicFields(__frmDepDynamicFields);"undefined"!==typeof __frmDepLookupFields&&frmFrontForm.checkDependentLookupFields(__frmDepLookupFields);
70
- if("undefined"!==typeof __FRMCALC){(a=__FRMCALC.triggers)&&jQuery(a.join()).trigger({type:"change",selfTriggered:!0});var a=__FRMCALC.calc,b=[],c;for(c in a)if(1>a[c].fields.length){var d=document.getElementById("field_"+c);null===d||T(d,a[c].form_id)||X(__FRMCALC,c,b)}}v()}function aa(){if(jQuery().chosen){var a={allow_single_deselect:!0};"undefined"!==typeof __frmChosen&&(a="{"+__frmChosen+"}");jQuery(".frm_chzn").chosen(a)}}function Oa(){if(jQuery().rating){var a=jQuery(".star");a.length&&a.rating()}}
71
- function ca(a){"undefined"!==typeof __frmHideOrShowFields&&frmFrontForm.hideOrShowFields(__frmHideOrShowFields,a)}function u(a,b){"undefined"===typeof b&&(b="dependent");1<a.length&&(a=a.eq(0));a.trigger({type:"change",selfTriggered:!0,frmTriggered:b})}function G(a){var b={repeatingSection:"",repeatRow:""};"undefined"!==typeof a&&3<=a.split("][").length&&(a=a.split("]["),b.repeatingSection=a[0].replace("item_meta[",""),b.repeatRow=a[1]);return b}function Pa(a){a.fadeOut("slow",function(){a.remove()})}
72
- function pb(){var a=jQuery(this).data("frmconfirm");return confirm(a)}function qb(){var a=jQuery(this).data("frmtoggle");jQuery(a).is(":visible")?jQuery(a).slideUp("fast"):jQuery(a).slideDown("fast");return!1}function Za(a,b){for(var c in a)if(a.hasOwnProperty(c)&&a[c]===b)return c;return null}function Ea(a){return!jQuery.isArray(a)&&0<=a-parseFloat(a)+1}function rb(){Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c=this.length>>>0,d=Number(b)||0,d=0>d?Math.ceil(d):Math.floor(d);
73
- for(0>d&&(d+=c);d<c;d++)if(d in this&&this[d]===a)return d;return-1})}function sb(){"function"!==typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")})}function tb(){Array.prototype.filter||(Array.prototype.filter=function(a,b){if(void 0===this||null===this)throw new TypeError;var c=Object(this),d=c.length>>>0;if("function"!==typeof a)throw new TypeError;for(var e=[],f=0;f<d;f++)if(f in c){var h=c[f];a.call(b,h,f,c)&&e.push(h)}return e})}function ub(){Object.keys||
74
- (Object.keys=function(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c);return b})}var K=!1,C="",x=[];return{init:function(){jQuery(document).off("submit.formidable",".frm-show-form");jQuery(document).on("submit.formidable",".frm-show-form",frmFrontForm.submitForm);jQuery(document).on("click",".frm_trigger",n);var a=jQuery(".frm_blank_field");a.length&&a.closest(".frm_toggle_container").prev(".frm_trigger").click();jQuery.isFunction(jQuery.fn.placeholder)?jQuery(".frm-show-form input, .frm-show-form textarea").placeholder():
75
- jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){""===jQuery(this).val()&&jQuery(this).blur()});jQuery(document).on("focus",".frm_toggle_default",fb);jQuery(document).on("blur",".frm_toggle_default",gb);jQuery(".frm_toggle_default").blur();jQuery(document.getElementById("frm_resend_email")).click(hb);jQuery(document).on("click",".frm_remove_link",w);jQuery(document).on("focusin","input[data-frmmask]",function(){jQuery(this).mask(jQuery(this).data("frmmask").toString())});
76
- 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"]',F);jQuery(document).on("click",'.frm-show-form input[type="submit"], .frm-show-form input[name="frm_prev_page"], .frm-show-form .frm_save_draft',l);jQuery(document).on("change",'.frm_other_container input[type="checkbox"], .frm_other_container input[type="radio"], .frm_other_container select',A);jQuery(document).on("click",".frm_remove_form_row",
77
- kb);jQuery(document).on("click",".frm_add_form_row",lb);jQuery(document).on("click","a[data-frmconfirm]",pb);jQuery("a[data-frmtoggle]").click(qb);jQuery(".frm_edit_link_container").on("click","a.frm_inplace_edit",mb);jQuery(".frm_edit_link_container").on("click","a.frm_cancel_edit",nb);jQuery(document).on("click",".frm_ajax_delete",ob);jQuery(".frm_month_heading, .frm_year_heading").click(function(){var a=jQuery(this).children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s");a.hasClass("ui-icon-triangle-1-e")?
78
- (a.addClass("ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-e"),jQuery(this).next(".frm_toggle_container").fadeIn("slow")):(a.addClass("ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-s"),jQuery(this).next(".frm_toggle_container").hide())});ca("pageLoad");da();rb();sb();tb();ub()},submitForm:function(a){frmFrontForm.submitFormManual(a,this)},submitFormManual:function(a,b){var c=b.className.trim().split(/\s+/gi);if((!c||-1<c.indexOf("frm_pro_form"))&&!jQuery("body").hasClass("wp-admin")){a.preventDefault();
79
- var d=frmFrontForm.validateFormSubmit(b);0===Object.keys(d).length&&(jQuery(b).find(".frm_ajax_loading").addClass("frm_loading_now"),-1<c.indexOf("frm_ajax_submit")?1>jQuery(b).find('input[type="file"]').length?(C=jQuery(b).find('input[name="frm_action"]').val(),frmFrontForm.checkFormErrors(b,C)):b.submit():b.submit())}},validateFormSubmit:function(a){"undefined"!=typeof tinyMCE&&jQuery(this).find(".wp-editor-wrap").length&&tinyMCE.triggerSave();x=[];var b=jQuery(a).hasClass("frm_js_validate");b&&
80
- (Ha(a)||Ia(a))&&(b=!1);b&&(frmFrontForm.getAjaxFormErrors(a),Object.keys(x).length&&frmFrontForm.addAjaxFormErrors(a));return x},getAjaxFormErrors:function(a){var b=[],c=jQuery(a).find(".frm_required_field:visible input, .frm_required_field:visible select, .frm_required_field:visible textarea").filter(":not(.frm_optional)");if(c.length)for(var d=0,e=c.length;d<e;d++)b=ga(c[d],b);c=jQuery(a).find("input[type=email]").filter(":visible");d=jQuery(a).find("input,select,textarea");if(d.length)for(var e=
81
- 0,f=d.length;e<f;e++){var h=d[e];""!==h.value&&"hidden"!=h.type&&("number"==h.type?b=ia(h,b):"email"==h.type?b=ha(h,b,c):null!==h.pattern&&(b=ja(h,b)))}c=jQuery(a).find(".frm-g-recaptcha");c.length&&(d=c.data("rid"),0===grecaptcha.getResponse(d).length&&(c=c.closest(".frm_form_field").attr("id").replace("frm_field_","").replace("_container",""),b[c]=""));x=b;if("function"==typeof frmThemeOverride_jsErrors&&(C=jQuery(a).find('input[name="frm_action"]').val(),a=frmThemeOverride_jsErrors(C,a),Object.keys(a).length))for(var g in a)x[g]=
82
- a[g];return x},addAjaxFormErrors:function(a){Ja();for(var b in x){var c=jQuery(a).find("#frm_field_"+b+"_container");c.length?M(c,b,x):delete x[b]}Ka(a)},checkFormErrors:function(a,b){db(a,b)},scrollToID:function(a){a=jQuery(document.getElementById(a));frmFrontForm.scrollMsg(a,!1)},scrollMsg:function(a,b,c){if(a=("undefined"==typeof b?jQuery(document.getElementById("frm_form_"+a+"_container")):"string"==typeof a?jQuery(b).find("#frm_field_"+a+"_container"):a).offset().top){a-=frm_js.offset;b=jQuery("html").css("margin-top");
83
- var d=jQuery("body").css("margin-top");if(b||d)a=a-parseInt(b)-parseInt(d);if(a&&window.innerHeight&&(b=document.documentElement.scrollTop||document.body.scrollTop,a>b+window.innerHeight||a<b))return"undefined"===typeof c?jQuery(window).scrollTop(a):jQuery("html,body").animate({scrollTop:a},500),!1}},savingDraft:function(a){return Ha(a)},goingToPreviousPage:function(a){return Ia(a)},hideOrShowFields:function(a,b){if("pageLoad"===b){var c=document.querySelectorAll('[id^="frm_hide_fields_"]');Y(c)}for(var c=
84
- {repeatingSection:"",repeatRow:""},d=0,e=a.length;d<e;d++)H(a[d],c)},hidePreviouslyHiddenFields:function(){var a;a=[];for(var b=document.querySelectorAll('*[id^="frm_hide_fields_"]'),c=b.length,d,e=0;e<c;e++)d=b[e].id.replace("frm_hide_fields_",""),a=a.concat(D(d));b=0;for(c=a.length;b<c;b++)d=document.getElementById(a[b]),null!==d&&(d.style.display="none")},checkDependentDynamicFields:function(a){for(var b={repeatingSection:"",repeatRow:""},c=0,d=a.length;c<d;c++)H(a[c],b)},checkDependentLookupFields:function(a){for(var b,
85
- c={repeatingSection:"",repeatRow:""},d=0,e=a.length;d<e;d++)b=a[d],Z(b,c,"value changed")},loadGoogle:function(){if("undefined"!==typeof google&&google&&google.load)for(var a=__FRMTABLES,b=Object.keys(a),c=0;c<b.length;c++)if("graphs"===b[c])for(var d=a[b[c]],e=0,f=d.length;e<f;e++)jb(d[e]);else for(d=a[b[c]],e=b[c],f=0;f<d.length;f++)ib(d[f],e);else setTimeout(frmFrontForm.loadGoogle,30)},removeUsedTimes:function(a,b){var c=jQuery(a).parents("form:first").find('input[name="id"]');jQuery.ajax({type:"POST",
86
- url:frm_js.ajax_url,dataType:"json",data:{action:"frm_fields_ajax_time_options",time_field:b,date_field:a.id,entry_id:c?c.val():"",date:jQuery(a).val(),nonce:frm_js.nonce},success:function(a){var c=jQuery(document.getElementById(b));c.find("option").removeAttr("disabled");if(a&&""!==a)for(var f in a)c.find('option[value="'+f+'"]').attr("disabled","disabled")}})},escapeHtml:function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},
87
- invisible:function(a){jQuery(a).css("visibility","hidden")},visible:function(a){jQuery(a).css("visibility","visible")}}}var frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(l){frmFrontForm.init()});function frmRecaptcha(){for(var l=jQuery(".frm-g-recaptcha"),n=0,p=l.length;n<p;n++){var r=grecaptcha.render(l[n].id,{sitekey:l[n].getAttribute("data-sitekey"),size:l[n].getAttribute("data-size"),theme:l[n].getAttribute("data-theme")});l[n].setAttribute("data-rid",r)}}
 
88
  function frmUpdateField(l,n,p,r,v){jQuery(document.getElementById("frm_update_field_"+l+"_"+n)).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:l,field_id:n,value:p,nonce:frm_js.nonce},success:function(){""===r.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+v)).fadeOut("slow"):jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+v)).replaceWith(r)}})}
89
- function frmEditEntry(l,n,p,r,v,z){console.warn("DEPRECATED: function frmEditEntry in v2.0.13 use frmFrontForm.editEntry");var y=jQuery(document.getElementById("frm_edit_"+l)),w=y.html(),A=jQuery(document.getElementById(n+l)),F=A.html();A.html('<span class="frm-loading-img" id="'+n+l+'"></span><div class="frm_orig_content" style="display:none">'+F+"</div>");jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:p,entry_id:l,id:r,nonce:frm_js.nonce},
90
  success:function(q){A.children(".frm-loading-img").replaceWith(q);y.replaceWith('<span id="frm_edit_'+l+'"><a onclick="frmCancelEdit('+l+",'"+n+"','"+frmFrontForm.escapeHtml(w)+"',"+p+","+r+",'"+z+'\')" class="'+z+'">'+v+"</a></span>")}})}
91
  function frmCancelEdit(l,n,p,r,v,z){console.warn("DEPRECATED: function frmCancelEdit in v2.0.13 use frmFrontForm.cancelEdit");var y=jQuery(document.getElementById("frm_edit_"+l)),w=y.find("a"),A=w.html();w.hasClass("frm_ajax_edited")||(w=jQuery(document.getElementById(n+l)),w.children(".frm_forms").replaceWith(""),w.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));y.replaceWith('<a id="frm_edit_'+l+'" class="frm_edit_link '+z+'" href="javascript:frmEditEntry('+l+",'"+
92
  n+"',"+r+","+v+",'"+frmFrontForm.escapeHtml(A)+"','"+z+"')\">"+p+"</a>")}
2
  jQuery(this).toggleClass("active").children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s").toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e")}function p(){for(var a=__frmUniqueTimes,b=0;b<a.length;b++)a[b].dateID==this.id&&frmFrontForm.removeUsedTimes(this,a[b].timeID)}function r(){if(-1===this.className.indexOf("frm_custom_date")&&"undefined"!==typeof __frmDatepicker){var a=__frmDatepicker,b=this.id,c=b.split("-");c.pop();c='input[id^="'+c.join("-")+'"]';jQuery.datepicker.setDefaults(jQuery.datepicker.regional[""]);
3
  for(var d=0,e=0;e<a.length;e++)if(a[e].triggerID=="#"+b||a[e].triggerID==c)d=e;""!==a[d].options.defaultDate&&(a[d].options.defaultDate=new Date(a[d].options.defaultDate));jQuery(this).datepicker(jQuery.extend(jQuery.datepicker.regional[a[d].locale],a[d].options))}}function v(a){if("undefined"!==typeof __frmDropzone)for(var b=__frmDropzone,c=0;c<b.length;c++)z(c,a)}function z(a,b){var c=__frmDropzone,d="#"+c[a].htmlID+"_dropzone",e=c[a].fieldName;"undefined"!==typeof b&&-1!==d.indexOf("-0_dropzone")&&
4
  (d=d.replace("-0_dropzone","-"+b+"_dropzone"),e=e.replace("[0]","["+b+"]"),delete c[a].mockFiles);d=jQuery(d);if(!(1>d.length||d.hasClass("dz-clickable"))){var f=c[a].maxFiles;if("undefined"!==typeof c[a].mockFiles){var h=c[a].mockFiles.length;0<f&&(f-=h)}var h=d.closest("form"),g=h.find('input[type="submit"], .frm_submit input[type="button"]'),k=h.find(".frm_ajax_loading");d.dropzone({url:frm_js.ajax_url,addRemoveLinks:!0,paramName:d.attr("id").replace("_dropzone",""),maxFilesize:c[a].maxFilesize,
5
+ maxFiles:f,uploadMultiple:c[a].uploadMultiple,dictDefaultMessage:c[a].defaultMessage,dictFallbackMessage:c[a].fallbackMessage,dictFallbackText:c[a].fallbackText,dictFileTooBig:c[a].fileTooBig,dictInvalidFileType:c[a].invalidFileType,dictResponseError:c[a].responseError,dictCancelUpload:c[a].cancel,dictCancelUploadConfirmation:c[a].cancelConfirm,dictRemoveFile:c[a].remove,dictMaxFilesExceeded:c[a].maxFilesExceeded,fallback:function(){jQuery(this.element).closest("form").removeClass("frm_ajax_submit")}, </