Formidable Forms – Form Builder for WordPress - Version 4.06

Version Description

  • New: Better accessibility for honeypot field and message after submit.
  • New: Add a Dismiss all button in the inbox.
  • New: Add 'frm_user_id_display' hook for showing something other than the dispay name by default in user ID fields.
  • Set the default styling to use grids since most browsers support it now.
  • Fix: On some sites, permissions were preventing a form from being created from a template.
  • Fix: The button colors were overriding eachother with some settings.
Download this release

Release Info

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

Code changes from version 4.05.02 to 4.06

Files changed (38) hide show
  1. classes/controllers/FrmAddonsController.php +32 -0
  2. classes/controllers/FrmFormsController.php +1 -1
  3. classes/controllers/FrmInboxController.php +14 -1
  4. classes/controllers/FrmXMLController.php +1 -1
  5. classes/helpers/FrmAppHelper.php +11 -3
  6. classes/helpers/FrmEntriesHelper.php +5 -1
  7. classes/helpers/FrmFieldsHelper.php +0 -1
  8. classes/helpers/FrmFormsHelper.php +1 -1
  9. classes/helpers/FrmStylesHelper.php +3 -0
  10. classes/helpers/FrmXMLHelper.php +27 -20
  11. classes/models/FrmEntryFormatter.php +3 -3
  12. classes/models/FrmFieldValue.php +1 -0
  13. classes/models/FrmInbox.php +67 -4
  14. classes/models/FrmSettings.php +1 -7
  15. classes/models/fields/FrmFieldCheckbox.php +7 -0
  16. classes/models/fields/FrmFieldRadio.php +7 -0
  17. classes/models/fields/FrmFieldType.php +11 -1
  18. classes/models/fields/FrmFieldUserID.php +1 -1
  19. classes/views/frm-entries/errors.php +1 -1
  20. classes/views/frm-entries/form.php +6 -2
  21. classes/views/frm-entries/new.php +2 -0
  22. classes/views/frm-fields/back-end/field-options.php +2 -2
  23. classes/views/frm-fields/back-end/radio-images.php +13 -0
  24. classes/views/frm-fields/single-option.php +2 -0
  25. classes/views/frm-settings/general.php +2 -1
  26. classes/views/inbox/list.php +25 -26
  27. css/_single_theme.css.php +0 -36
  28. css/custom_theme.css.php +56 -3
  29. css/frm_admin.css +159 -5
  30. css/frm_grids.css +5 -0
  31. formidable.php +1 -1
  32. images/icons.svg +12 -0
  33. images/image-options.png +0 -0
  34. js/formidable.js +1 -0
  35. js/formidable.min.js +3 -3
  36. js/formidable_admin.js +297 -20
  37. languages/formidable.pot +530 -502
  38. readme.txt +9 -1
classes/controllers/FrmAddonsController.php CHANGED
@@ -191,6 +191,38 @@ class FrmAddonsController {
191
  return isset( $pro['url'] ) ? $pro['url'] : '';
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  /**
195
  * @since 4.0.01
196
  */
191
  return isset( $pro['url'] ) ? $pro['url'] : '';
192
  }
193
 
194
+ /**
195
+ * @since 4.06
196
+ */
197
+ public static function license_type() {
198
+ $api = new FrmFormApi();
199
+ $addons = $api->get_api_info();
200
+ $type = 'free';
201
+
202
+ if ( isset( $addons['error'] ) ) {
203
+ if ( isset( $addons['error']['code'] ) && $addons['error']['code'] === 'expired' ) {
204
+ return $addons['error']['code'];
205
+ }
206
+ $type = isset( $addons['error']['type'] ) ? $addons['error']['type'] : $type;
207
+ }
208
+
209
+ $pro = isset( $addons['93790'] ) ? $addons['93790'] : array();
210
+ if ( $type === 'free' ) {
211
+ $type = isset( $pro['type'] ) ? $pro['type'] : $type;
212
+ if ( $type === 'free' ) {
213
+ return $type;
214
+ }
215
+ }
216
+
217
+ if ( isset( $pro['code'] ) && $pro['code'] === 'grandfathered' ) {
218
+ return $pro['code'];
219
+ }
220
+
221
+ $expires = isset( $pro['expires'] ) ? $pro['expires'] : '';
222
+ $expired = $expires ? $expires < time() : false;
223
+ return $expired ? 'expired' : strtolower( $type );
224
+ }
225
+
226
  /**
227
  * @since 4.0.01
228
  */
classes/controllers/FrmFormsController.php CHANGED
@@ -1812,7 +1812,7 @@ class FrmFormsController {
1812
  * @param array $args
1813
  */
1814
  private static function get_redirect_message( $success_url, $success_msg, $args ) {
1815
- $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg frm_message">' . $success_msg . '<br/>' .
1816
  /* translators: %1$s: Start link HTML, %2$s: End link HTML */
1817
  sprintf( __( '%1$sClick here%2$s if you are not automatically redirected.', 'formidable' ), '<a href="' . esc_url( $success_url ) . '">', '</a>' ) .
1818
  '</div></div>';
1812
  * @param array $args
1813
  */
1814
  private static function get_redirect_message( $success_url, $success_msg, $args ) {
1815
+ $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg frm_message" role="status">' . $success_msg . '<br/>' .
1816
  /* translators: %1$s: Start link HTML, %2$s: End link HTML */
1817
  sprintf( __( '%1$sClick here%2$s if you are not automatically redirected.', 'formidable' ), '<a href="' . esc_url( $success_url ) . '">', '</a>' ) .
1818
  '</div></div>';
classes/controllers/FrmInboxController.php CHANGED
@@ -23,6 +23,19 @@ class FrmInboxController {
23
  return $inbox->unread_html();
24
  }
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * @since 4.05
28
  */
@@ -31,7 +44,7 @@ class FrmInboxController {
31
  self::add_tracking_request();
32
 
33
  $inbox = new FrmInbox();
34
- $messages = $inbox->get_messages();
35
  $messages = array_reverse( $messages );
36
  $user = wp_get_current_user();
37
 
23
  return $inbox->unread_html();
24
  }
25
 
26
+ /**
27
+ * @since 4.06
28
+ */
29
+ public static function dismiss_all_button( $atts ) {
30
+ if ( empty( $atts['messages'] ) ) {
31
+ return;
32
+ }
33
+
34
+ echo '<button class="button-secondary frm-button-secondary" id="frm-dismiss-inbox" type="button">' .
35
+ esc_html__( 'Dismiss All', 'formidable' ) .
36
+ '</button>';
37
+ }
38
+
39
  /**
40
  * @since 4.05
41
  */
44
  self::add_tracking_request();
45
 
46
  $inbox = new FrmInbox();
47
+ $messages = $inbox->get_messages( 'filter' );
48
  $messages = array_reverse( $messages );
49
  $user = wp_get_current_user();
50
 
classes/controllers/FrmXMLController.php CHANGED
@@ -34,7 +34,7 @@ class FrmXMLController {
34
  * @since 3.06
35
  */
36
  public static function install_template() {
37
- FrmAppHelper::permission_check( 'frm_create_forms' );
38
  check_ajax_referer( 'frm_ajax', 'nonce' );
39
 
40
  $url = FrmAppHelper::get_param( 'xml', '', 'post', 'esc_url_raw' );
34
  * @since 3.06
35
  */
36
  public static function install_template() {
37
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
38
  check_ajax_referer( 'frm_ajax', 'nonce' );
39
 
40
  $url = FrmAppHelper::get_param( 'xml', '', 'post', 'esc_url_raw' );
classes/helpers/FrmAppHelper.php CHANGED
@@ -11,7 +11,7 @@ class FrmAppHelper {
11
  /**
12
  * @since 2.0
13
  */
14
- public static $plug_version = '4.05.02';
15
 
16
  /**
17
  * @since 1.07.02
@@ -201,6 +201,14 @@ class FrmAppHelper {
201
  return apply_filters( 'frm_pro_installed', false );
202
  }
203
 
 
 
 
 
 
 
 
 
204
  public static function is_formidable_admin() {
205
  $page = self::simple_get( 'page', 'sanitize_title' );
206
  $is_formidable = strpos( $page, 'formidable' ) !== false;
@@ -1102,8 +1110,7 @@ class FrmAppHelper {
1102
  * @since 4.0
1103
  */
1104
  public static function is_full_screen() {
1105
- $action = self::simple_get( 'frm_action', 'sanitize_title' );
1106
- $full_builder = self::is_admin_page( 'formidable' ) && ( $action === 'edit' || $action === 'settings' || $action === 'duplicate' );
1107
  $styler = self::is_admin_page( 'formidable-styles' ) || self::is_admin_page( 'formidable-styles2' );
1108
  $full_entries = self::simple_get( 'frm-full', 'absint' );
1109
 
@@ -2360,6 +2367,7 @@ class FrmAppHelper {
2360
  'select_a_field' => __( 'Select a Field', 'formidable' ),
2361
  'no_items_found' => __( 'No items found.', 'formidable' ),
2362
  );
 
2363
 
2364
  $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
2365
  if ( empty( $data ) ) {
11
  /**
12
  * @since 2.0
13
  */
14
+ public static $plug_version = '4.06';
15
 
16
  /**
17
  * @since 1.07.02
201
  return apply_filters( 'frm_pro_installed', false );
202
  }
203
 
204
+ /**
205
+ * @since 4.06
206
+ */
207
+ public static function is_form_builder_page() {
208
+ $action = self::simple_get( 'frm_action', 'sanitize_title' );
209
+ return self::is_admin_page( 'formidable' ) && ( $action === 'edit' || $action === 'settings' || $action === 'duplicate' );
210
+ }
211
+
212
  public static function is_formidable_admin() {
213
  $page = self::simple_get( 'page', 'sanitize_title' );
214
  $is_formidable = strpos( $page, 'formidable' ) !== false;
1110
  * @since 4.0
1111
  */
1112
  public static function is_full_screen() {
1113
+ $full_builder = self::is_form_builder_page();
 
1114
  $styler = self::is_admin_page( 'formidable-styles' ) || self::is_admin_page( 'formidable-styles2' );
1115
  $full_entries = self::simple_get( 'frm-full', 'absint' );
1116
 
2367
  'select_a_field' => __( 'Select a Field', 'formidable' ),
2368
  'no_items_found' => __( 'No items found.', 'formidable' ),
2369
  );
2370
+ $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
2371
 
2372
  $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
2373
  if ( empty( $data ) ) {
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -213,7 +213,11 @@ class FrmEntriesHelper {
213
  unset( $child_entry );
214
  }
215
 
216
- $val = implode( ', ', (array) $field_value );
 
 
 
 
217
 
218
  return FrmAppHelper::kses( $val, 'all' );
219
  }
213
  unset( $child_entry );
214
  }
215
 
216
+ $sep = ', ';
217
+ if ( strpos( implode( ' ', (array) $field_value ), '<img' ) !== false ) {
218
+ $sep = '<br/>';
219
+ }
220
+ $val = implode( $sep, (array) $field_value );
221
 
222
  return FrmAppHelper::kses( $val, 'all' );
223
  }
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -1055,7 +1055,6 @@ class FrmFieldsHelper {
1055
  }
1056
 
1057
  // Check posted vals before checking saved values
1058
-
1059
  // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1060
  if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
1061
  if ( FrmField::is_field_with_multiple_values( $field ) ) {
1055
  }
1056
 
1057
  // Check posted vals before checking saved values
 
1058
  // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1059
  if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
1060
  if ( FrmField::is_field_with_multiple_values( $field ) ) {
classes/helpers/FrmFormsHelper.php CHANGED
@@ -253,7 +253,7 @@ class FrmFormsHelper {
253
  public static function get_success_message( $atts ) {
254
  $message = apply_filters( 'frm_content', $atts['message'], $atts['form'], $atts['entry_id'] );
255
  $message = FrmAppHelper::use_wpautop( do_shortcode( $message ) );
256
- $message = '<div class="' . esc_attr( $atts['class'] ) . '">' . $message . '</div>';
257
 
258
  return $message;
259
  }
253
  public static function get_success_message( $atts ) {
254
  $message = apply_filters( 'frm_content', $atts['message'], $atts['form'], $atts['entry_id'] );
255
  $message = FrmAppHelper::use_wpautop( do_shortcode( $message ) );
256
+ $message = '<div class="' . esc_attr( $atts['class'] ) . '" role="status">' . $message . '</div>';
257
 
258
  return $message;
259
  }
classes/helpers/FrmStylesHelper.php CHANGED
@@ -313,6 +313,9 @@ class FrmStylesHelper {
313
  if ( ! isset( $settings[ $var ] ) ) {
314
  continue;
315
  }
 
 
 
316
  $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] );
317
  if ( $show ) {
318
  echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // WPCS: XSS ok.
313
  if ( ! isset( $settings[ $var ] ) ) {
314
  continue;
315
  }
316
+ if ( ! isset( $defaults[ $var ] ) ) {
317
+ $defaults[ $var ] = '';
318
+ }
319
  $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] );
320
  if ( $show ) {
321
  echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // WPCS: XSS ok.
classes/helpers/FrmXMLHelper.php CHANGED
@@ -350,26 +350,7 @@ class FrmXMLHelper {
350
  foreach ( $xml_fields as $field ) {
351
  $f = self::fill_field( $field, $form_id );
352
 
353
- $has_default = array(
354
- 'text',
355
- 'email',
356
- 'url',
357
- 'textarea',
358
- 'number',
359
- 'phone',
360
- 'date',
361
- 'hidden',
362
- 'password',
363
- 'tag',
364
- );
365
- if ( is_array( $f['default_value'] ) && in_array( $f['type'], $has_default, true ) ) {
366
- if ( count( $f['default_value'] ) === 1 ) {
367
- $f['default_value'] = '[' . reset( $f['default_value'] ) . ']';
368
- } else {
369
- $f['default_value'] = reset( $f['default_value'] );
370
- }
371
- }
372
-
373
  self::maybe_add_required( $f );
374
  self::maybe_update_in_section_variable( $in_section, $f );
375
  self::maybe_update_form_select( $f, $imported );
@@ -424,6 +405,32 @@ class FrmXMLHelper {
424
  );
425
  }
426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  /**
428
  * Make sure the required indicator is set.
429
  *
350
  foreach ( $xml_fields as $field ) {
351
  $f = self::fill_field( $field, $form_id );
352
 
353
+ self::set_default_value( $f );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  self::maybe_add_required( $f );
355
  self::maybe_update_in_section_variable( $in_section, $f );
356
  self::maybe_update_form_select( $f, $imported );
405
  );
406
  }
407
 
408
+ /**
409
+ * @since 4.06
410
+ */
411
+ private static function set_default_value( &$f ) {
412
+ $has_default = array(
413
+ 'text',
414
+ 'email',
415
+ 'url',
416
+ 'textarea',
417
+ 'number',
418
+ 'phone',
419
+ 'date',
420
+ 'hidden',
421
+ 'password',
422
+ 'tag',
423
+ );
424
+
425
+ if ( is_array( $f['default_value'] ) && in_array( $f['type'], $has_default, true ) ) {
426
+ if ( count( $f['default_value'] ) === 1 ) {
427
+ $f['default_value'] = '[' . reset( $f['default_value'] ) . ']';
428
+ } else {
429
+ $f['default_value'] = reset( $f['default_value'] );
430
+ }
431
+ }
432
+ }
433
+
434
  /**
435
  * Make sure the required indicator is set.
436
  *
classes/models/FrmEntryFormatter.php CHANGED
@@ -123,14 +123,14 @@ class FrmEntryFormatter {
123
  * @param array $atts
124
  */
125
  protected function init_entry( $atts ) {
126
- if ( is_object( $atts['entry'] ) ) {
127
 
128
  if ( isset( $atts['entry']->metas ) ) {
129
  $this->entry = $atts['entry'];
130
  } else {
131
  $this->entry = FrmEntry::getOne( $atts['entry']->id, true );
132
  }
133
- } elseif ( $atts['id'] ) {
134
  $this->entry = FrmEntry::getOne( $atts['id'], true );
135
  }
136
  }
@@ -329,7 +329,7 @@ class FrmEntryFormatter {
329
  $atts['wpautop'] = false;
330
  $atts['return_array'] = true;
331
 
332
- $unset = array( 'id', 'entry', 'form_id', 'format', 'plain_text' );
333
  foreach ( $unset as $param ) {
334
  if ( isset( $atts[ $param ] ) ) {
335
  unset( $atts[ $param ] );
123
  * @param array $atts
124
  */
125
  protected function init_entry( $atts ) {
126
+ if ( isset( $atts['entry'] ) && is_object( $atts['entry'] ) ) {
127
 
128
  if ( isset( $atts['entry']->metas ) ) {
129
  $this->entry = $atts['entry'];
130
  } else {
131
  $this->entry = FrmEntry::getOne( $atts['entry']->id, true );
132
  }
133
+ } elseif ( ! empty( $atts['id'] ) ) {
134
  $this->entry = FrmEntry::getOne( $atts['id'], true );
135
  }
136
  }
329
  $atts['wpautop'] = false;
330
  $atts['return_array'] = true;
331
 
332
+ $unset = array( 'id', 'entry', 'form_id', 'format' );
333
  foreach ( $unset as $param ) {
334
  if ( isset( $atts[ $param ] ) ) {
335
  unset( $atts[ $param ] );
classes/models/FrmFieldValue.php CHANGED
@@ -85,6 +85,7 @@ class FrmFieldValue {
85
  */
86
  public function prepare_displayed_value( $atts = array() ) {
87
  $this->displayed_value = $this->saved_value;
 
88
  $this->generate_displayed_value_for_field_type( $atts );
89
  $this->filter_displayed_value( $atts );
90
  }
85
  */
86
  public function prepare_displayed_value( $atts = array() ) {
87
  $this->displayed_value = $this->saved_value;
88
+ unset( $atts['class'] ); // This class shouldn't affect values.
89
  $this->generate_displayed_value_for_field_type( $atts );
90
  $this->filter_displayed_value( $atts );
91
  }
classes/models/FrmInbox.php CHANGED
@@ -32,8 +32,12 @@ class FrmInbox extends FrmFormApi {
32
  /**
33
  * @since 4.05
34
  */
35
- public function get_messages() {
36
- return $this->messages;
 
 
 
 
37
  }
38
 
39
  /**
@@ -89,6 +93,7 @@ class FrmInbox extends FrmFormApi {
89
  'icon' => $message['icon'],
90
  'cta' => $message['cta'],
91
  'expires' => $message['expires'],
 
92
  );
93
 
94
  $this->update_list();
@@ -104,6 +109,7 @@ class FrmInbox extends FrmFormApi {
104
  'icon' => 'frm_tooltip_icon',
105
  'cta' => '',
106
  'expires' => false,
 
107
  );
108
 
109
  return array_merge( $defaults, $message );
@@ -114,7 +120,7 @@ class FrmInbox extends FrmFormApi {
114
  foreach ( $this->messages as $t => $message ) {
115
  $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' );
116
  $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' );
117
- $expired = isset( $message['expires'] ) && ! empty( $message['expires'] ) && $message['expires'] < time();
118
  if ( $read || $expired || $dismissed ) {
119
  unset( $this->messages[ $t ] );
120
  $removed = true;
@@ -126,6 +132,41 @@ class FrmInbox extends FrmFormApi {
126
  }
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  /**
130
  * @param string $key
131
  */
@@ -159,6 +200,11 @@ class FrmInbox extends FrmFormApi {
159
  * @param string $key
160
  */
161
  public function dismiss( $key ) {
 
 
 
 
 
162
  if ( ! isset( $this->messages[ $key ] ) ) {
163
  return;
164
  }
@@ -171,8 +217,25 @@ class FrmInbox extends FrmFormApi {
171
  $this->update_list();
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  public function unread() {
175
- $messages = $this->get_messages();
176
  $user_id = get_current_user_id();
177
  foreach ( $messages as $t => $message ) {
178
  if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) {
32
  /**
33
  * @since 4.05
34
  */
35
+ public function get_messages( $filter = false ) {
36
+ $messages = $this->messages;
37
+ if ( $filter === 'filter' ) {
38
+ $this->filter_messages( $messages );
39
+ }
40
+ return $messages;
41
  }
42
 
43
  /**
93
  'icon' => $message['icon'],
94
  'cta' => $message['cta'],
95
  'expires' => $message['expires'],
96
+ 'who' => $message['who'],
97
  );
98
 
99
  $this->update_list();
109
  'icon' => 'frm_tooltip_icon',
110
  'cta' => '',
111
  'expires' => false,
112
+ 'who' => 'all', // use 'free', 'personal', 'business', 'elite', 'grandfathered'
113
  );
114
 
115
  return array_merge( $defaults, $message );
120
  foreach ( $this->messages as $t => $message ) {
121
  $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' );
122
  $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' );
123
+ $expired = $this->is_expired( $message );
124
  if ( $read || $expired || $dismissed ) {
125
  unset( $this->messages[ $t ] );
126
  $removed = true;
132
  }
133
  }
134
 
135
+ private function filter_messages( &$messages ) {
136
+ $user_id = get_current_user_id();
137
+ foreach ( $messages as $k => $message ) {
138
+ $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] );
139
+ if ( $this->is_expired( $message ) || $dismissed ) {
140
+ unset( $messages[ $k ] );
141
+ } elseif ( ! $this->is_for_user( $message ) ) {
142
+ unset( $messages[ $k ] );
143
+ }
144
+ }
145
+ }
146
+
147
+ private function is_expired( $message ) {
148
+ return isset( $message['expires'] ) && ! empty( $message['expires'] ) && $message['expires'] < time();
149
+ }
150
+
151
+ /**
152
+ * Show different messages for different accounts.
153
+ */
154
+ private function is_for_user( $message ) {
155
+ if ( ! isset( $message['who'] ) || $message['who'] === 'all' ) {
156
+ return true;
157
+ }
158
+
159
+ return in_array( $this->get_user_type(), (array) $message['who'] );
160
+ }
161
+
162
+ private function get_user_type() {
163
+ if ( ! FrmAppHelper::pro_is_installed() ) {
164
+ return 'free';
165
+ }
166
+
167
+ return FrmAddonsController::license_type();
168
+ }
169
+
170
  /**
171
  * @param string $key
172
  */
200
  * @param string $key
201
  */
202
  public function dismiss( $key ) {
203
+ if ( $key === 'all' ) {
204
+ $this->dismiss_all();
205
+ return;
206
+ }
207
+
208
  if ( ! isset( $this->messages[ $key ] ) ) {
209
  return;
210
  }
217
  $this->update_list();
218
  }
219
 
220
+ /**
221
+ * @since 4.06
222
+ */
223
+ private function dismiss_all() {
224
+ $user_id = get_current_user_id();
225
+ foreach ( $this->messages as $key => $message ) {
226
+ if ( ! isset( $message['dismissed'] ) ) {
227
+ $this->messages[ $key ]['dismissed'] = array();
228
+ }
229
+
230
+ if ( ! isset( $message['dismissed'][ $user_id ] ) ) {
231
+ $this->messages[ $key ]['dismissed'][ $user_id ] = time();
232
+ }
233
+ }
234
+ $this->update_list();
235
+ }
236
+
237
  public function unread() {
238
+ $messages = $this->get_messages( 'filter' );
239
  $user_id = get_current_user_id();
240
  foreach ( $messages as $t => $message ) {
241
  if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) {
classes/models/FrmSettings.php CHANGED
@@ -92,7 +92,7 @@ class FrmSettings {
92
  'jquery_css' => false,
93
  'accordion_js' => false,
94
  'fade_form' => false,
95
- 'old_css' => true,
96
  'admin_bar' => false,
97
 
98
  're_multi' => 1,
@@ -144,12 +144,6 @@ class FrmSettings {
144
  public function fill_with_defaults( $params = array() ) {
145
  $settings = $this->default_options();
146
 
147
- // Use grids and fade in as default for new installs.
148
- if ( isset( $params['frm_currency'] ) ) {
149
- $settings['old_css'] = false;
150
- $settings['fade_form'] = true;
151
- }
152
-
153
  foreach ( $settings as $setting => $default ) {
154
  if ( isset( $params[ 'frm_' . $setting ] ) ) {
155
  $this->{$setting} = $params[ 'frm_' . $setting ];
92
  'jquery_css' => false,
93
  'accordion_js' => false,
94
  'fade_form' => false,
95
+ 'old_css' => false,
96
  'admin_bar' => false,
97
 
98
  're_multi' => 1,
144
  public function fill_with_defaults( $params = array() ) {
145
  $settings = $this->default_options();
146
 
 
 
 
 
 
 
147
  foreach ( $settings as $setting => $default ) {
148
  if ( isset( $params[ 'frm_' . $setting ] ) ) {
149
  $this->{$setting} = $params[ 'frm_' . $setting ];
classes/models/fields/FrmFieldCheckbox.php CHANGED
@@ -64,6 +64,13 @@ class FrmFieldCheckbox extends FrmFieldType {
64
  );
65
  }
66
 
 
 
 
 
 
 
 
67
  protected function include_front_form_file() {
68
  return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/checkbox-field.php';
69
  }
64
  );
65
  }
66
 
67
+ /**
68
+ * @since 4.06
69
+ */
70
+ protected function show_priority_field_choices( $args = array() ) {
71
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-images.php' );
72
+ }
73
+
74
  protected function include_front_form_file() {
75
  return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/checkbox-field.php';
76
  }
classes/models/fields/FrmFieldRadio.php CHANGED
@@ -64,6 +64,13 @@ class FrmFieldRadio extends FrmFieldType {
64
  );
65
  }
66
 
 
 
 
 
 
 
 
67
  protected function include_front_form_file() {
68
  return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/radio-field.php';
69
  }
64
  );
65
  }
66
 
67
+ /**
68
+ * @since 4.06
69
+ */
70
+ protected function show_priority_field_choices( $args = array() ) {
71
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-images.php' );
72
+ }
73
+
74
  protected function include_front_form_file() {
75
  return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/radio-field.php';
76
  }
classes/models/fields/FrmFieldType.php CHANGED
@@ -112,7 +112,7 @@ abstract class FrmFieldType {
112
  }
113
 
114
  if ( is_array( $this->field ) ) {
115
- $this->field_id = $this->field['id'];
116
  } else if ( is_object( $this->field ) && property_exists( $this->field, 'id' ) ) {
117
  $this->field_id = $this->field->id;
118
  } elseif ( is_numeric( $this->field ) ) {
@@ -371,6 +371,7 @@ DEFAULT_HTML;
371
  $this->field_choices_heading( $args );
372
 
373
  echo '<div class="frm_grid_container frm-collapse-me' . esc_attr( $this->extra_field_choices_class() ) . '">';
 
374
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-choices.php' );
375
  $this->show_extra_field_choices( $args );
376
  echo '</div>';
@@ -480,6 +481,15 @@ DEFAULT_HTML;
480
  return;
481
  }
482
 
 
 
 
 
 
 
 
 
 
483
  /**
484
  * This is called for any fields with set options (radio, checkbox, select, dynamic, lookup).
485
  *
112
  }
113
 
114
  if ( is_array( $this->field ) ) {
115
+ $this->field_id = isset( $this->field['id'] ) ? $this->field['id'] : 0;
116
  } else if ( is_object( $this->field ) && property_exists( $this->field, 'id' ) ) {
117
  $this->field_id = $this->field->id;
118
  } elseif ( is_numeric( $this->field ) ) {
371
  $this->field_choices_heading( $args );
372
 
373
  echo '<div class="frm_grid_container frm-collapse-me' . esc_attr( $this->extra_field_choices_class() ) . '">';
374
+ $this->show_priority_field_choices( $args );
375
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-choices.php' );
376
  $this->show_extra_field_choices( $args );
377
  echo '</div>';
481
  return;
482
  }
483
 
484
+ /**
485
+ * Show settings above the multiple options settings.
486
+ *
487
+ * @since 4.06
488
+ */
489
+ protected function show_priority_field_choices( $args = array() ) {
490
+ return;
491
+ }
492
+
493
  /**
494
  * This is called for any fields with set options (radio, checkbox, select, dynamic, lookup).
495
  *
classes/models/fields/FrmFieldUserID.php CHANGED
@@ -103,7 +103,7 @@ class FrmFieldUserID extends FrmFieldType {
103
  $user_info = $atts['show'];
104
  }
105
  } else {
106
- $user_info = 'display_name';
107
  }
108
 
109
  return $user_info;
103
  $user_info = $atts['show'];
104
  }
105
  } else {
106
+ $user_info = apply_filters( 'frm_user_id_display', 'display_name' );
107
  }
108
 
109
  return $user_info;
classes/views/frm-entries/errors.php CHANGED
@@ -6,7 +6,7 @@ if ( isset( $include_extra_container ) ) { ?>
6
  if ( isset( $message ) && $message != '' ) {
7
  if ( FrmAppHelper::is_admin() ) {
8
  ?>
9
- <div id="message" class="frm_updated_message"><?php echo wp_kses_post( $message ); ?></div>
10
  <?php
11
  } else {
12
  FrmFormsHelper::maybe_get_scroll_js( $form->id );
6
  if ( isset( $message ) && $message != '' ) {
7
  if ( FrmAppHelper::is_admin() ) {
8
  ?>
9
+ <div id="message" class="frm_updated_message" role="status"><?php echo wp_kses_post( $message ); ?></div>
10
  <?php
11
  } else {
12
  FrmFormsHelper::maybe_get_scroll_js( $form->id );
classes/views/frm-entries/form.php CHANGED
@@ -35,8 +35,6 @@ $frm_hide_fields = FrmAppHelper::get_post_param( 'frm_hide_fields_' . $form->id,
35
  <input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ); ?>" />
36
  <input type="hidden" name="item_meta[0]" value="" />
37
  <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?>
38
- <label for="frm_verify_<?php echo esc_attr( $form->id ); ?>" class="frm_screen_reader frm_hidden"><?php esc_html_e( 'If you are human, leave this field blank.', 'formidable' ); ?></label>
39
- <input type="text" class="frm_hidden frm_verify" id="frm_verify_<?php echo esc_attr( $form->id ); ?>" name="frm_verify" value="<?php echo esc_attr( FrmAppHelper::get_param( 'frm_verify', '', 'get', 'wp_kses_post' ) ); ?>" <?php FrmFormsHelper::maybe_hide_inline(); ?> />
40
  <?php if ( isset( $id ) ) { ?>
41
  <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
42
  <?php } ?>
@@ -82,6 +80,12 @@ if ( FrmForm::show_submit( $form ) ) {
82
  FrmFormsHelper::get_custom_submit( $copy_values['submit_html'], $form, $submit, $form_action, $copy_values );
83
  }
84
  ?>
 
 
 
 
 
 
85
  </div>
86
  </fieldset>
87
  </div>
35
  <input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ); ?>" />
36
  <input type="hidden" name="item_meta[0]" value="" />
37
  <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?>
 
 
38
  <?php if ( isset( $id ) ) { ?>
39
  <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
40
  <?php } ?>
80
  FrmFormsHelper::get_custom_submit( $copy_values['submit_html'], $form, $submit, $form_action, $copy_values );
81
  }
82
  ?>
83
+ <div class="frm_verify" aria-hidden="true">
84
+ <label for="frm_verify_<?php echo esc_attr( $form->id ); ?>">
85
+ <?php esc_html_e( 'If you are human, leave this field blank.', 'formidable' ); ?>
86
+ </label>
87
+ <input type="text" class="frm_verify" id="frm_verify_<?php echo esc_attr( $form->id ); ?>" name="frm_verify" value="<?php echo esc_attr( FrmAppHelper::get_param( 'frm_verify', '', 'get', 'wp_kses_post' ) ); ?>" <?php FrmFormsHelper::maybe_hide_inline(); ?> />
88
+ </div>
89
  </div>
90
  </fieldset>
91
  </div>
classes/views/frm-entries/new.php CHANGED
@@ -6,6 +6,8 @@
6
  <?php
7
  }
8
 
 
 
9
  if ( $message_placement !== 'after' ) {
10
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
11
  }
6
  <?php
7
  }
8
 
9
+ $message_placement = isset( $message_placement ) ? $message_placement : 'before';
10
+
11
  if ( $message_placement !== 'after' ) {
12
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
13
  }
classes/views/frm-fields/back-end/field-options.php CHANGED
@@ -1,4 +1,4 @@
1
- <span class="frm-bulk-edit-link">
2
  <a href="#" title="<?php echo esc_attr( $option_title ); ?>" class="frm-bulk-edit-link">
3
  <?php echo esc_html( $this->get_bulk_edit_string() ); ?>
4
  </a>
@@ -10,7 +10,7 @@
10
  <?php $this->show_single_option( $args ); ?>
11
  </ul>
12
 
13
- <div class="frm6 frm_form_field">
14
  <a href="javascript:void(0);" data-opttype="single" class="frm_cb_button frm-small-add frm_add_opt frm6 frm_form_field" id="frm_add_opt_<?php echo esc_attr( $args['field']['id'] ); ?>">
15
  <span class="frm_icon_font frm_add_tag"></span>
16
  <?php echo esc_html( $this->get_add_option_string() ); ?>
1
+ <span class="frm-bulk-edit-link <?php echo empty( FrmField::get_option( $args['field'], 'image_options' ) ) ? '' : 'frm_hidden'; ?> ">
2
  <a href="#" title="<?php echo esc_attr( $option_title ); ?>" class="frm-bulk-edit-link">
3
  <?php echo esc_html( $this->get_bulk_edit_string() ); ?>
4
  </a>
10
  <?php $this->show_single_option( $args ); ?>
11
  </ul>
12
 
13
+ <div class="frm6 frm_form_field frm_add_opt_container">
14
  <a href="javascript:void(0);" data-opttype="single" class="frm_cb_button frm-small-add frm_add_opt frm6 frm_form_field" id="frm_add_opt_<?php echo esc_attr( $args['field']['id'] ); ?>">
15
  <span class="frm_icon_font frm_add_tag"></span>
16
  <?php echo esc_html( $this->get_add_option_string() ); ?>
classes/views/frm-fields/back-end/radio-images.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p class="frm6 frm_form_field frm_noallow frm_show_upgrade" data-upgrade="<?php esc_attr_e( 'Separate Values', 'formidable' ); ?>" data-message="<?php esc_attr_e( 'Add a separate value to use for calculations, email routing, saving to the database, and many other uses. The option values are saved while the option labels are shown in the form.', 'formidable' ); ?>" data-medium="builder" data-content="separate-values">
2
+ <label>
3
+ <input type="checkbox" value="1" disabled="disabled" />
4
+ <?php esc_html_e( 'Use separate values', 'formidable' ); ?>
5
+ </label>
6
+ </p>
7
+
8
+ <p class="frm6 frm_form_field frm_image_options_radio frm_noallow frm_show_upgrade" data-upgrade="<?php esc_attr_e( 'Image Options', 'formidable' ); ?>" data-message="<?php echo esc_attr( __( 'Show images instead of radio buttons or check boxes. This is ideal for polls, surveys, segmenting questionnaires and more.', 'formidable' ) . '<img src="' . FrmAppHelper::plugin_url() . '/images/image-options.png" />' ); ?>" data-medium="builder" data-content="image-options">
9
+ <label>
10
+ <input type="checkbox" value="1" disabled="disabled" />
11
+ <?php esc_html_e( 'Use images for options', 'formidable' ); ?>
12
+ </label>
13
+ </p>
classes/views/frm-fields/single-option.php CHANGED
@@ -11,4 +11,6 @@
11
  <input type="text" name="field_options[options_<?php echo esc_attr( $field['id'] ); ?>][<?php echo esc_attr( $opt_key ); ?>][value]" id="field_key_<?php echo esc_attr( $field['id'] . '-' . $opt_key ); ?>" value="<?php echo esc_attr( $field_val ); ?>" placeholder="<?php esc_attr_e( 'Saved Value', 'formidable' ); ?>" data-frmchange="trim,updateDefault" />
12
  <?php FrmAppHelper::icon_by_class( 'frmfont frm_save_icon' ); ?>
13
  </span>
 
 
14
  </li>
11
  <input type="text" name="field_options[options_<?php echo esc_attr( $field['id'] ); ?>][<?php echo esc_attr( $opt_key ); ?>][value]" id="field_key_<?php echo esc_attr( $field['id'] . '-' . $opt_key ); ?>" value="<?php echo esc_attr( $field_val ); ?>" placeholder="<?php esc_attr_e( 'Saved Value', 'formidable' ); ?>" data-frmchange="trim,updateDefault" />
12
  <?php FrmAppHelper::icon_by_class( 'frmfont frm_save_icon' ); ?>
13
  </span>
14
+
15
+ <?php do_action( 'frm_admin_single_opt', compact( 'field', 'opt', 'opt_key' ) ); ?>
16
  </li>
classes/views/frm-settings/general.php CHANGED
@@ -27,9 +27,10 @@
27
  </p>
28
 
29
  <p>
30
- <label for="frm_old_css" class="frm_help" title="<?php esc_attr_e( 'Form layouts built using CSS grids that are not fully supported by older browsers like Internet Explorer. Leave this box unchecked for your layouts to look best in current browsers, but show in a single column in older browsers.', 'formidable' ); ?>">
31
  <input type="checkbox" id="frm_old_css" name="frm_old_css" value="1" <?php checked( $frm_settings->old_css, 1 ); ?> />
32
  <?php esc_html_e( 'Do not use CSS Grids for form layouts', 'formidable' ); ?>
 
33
  </label>
34
  </p>
35
 
27
  </p>
28
 
29
  <p>
30
+ <label for="frm_old_css">
31
  <input type="checkbox" id="frm_old_css" name="frm_old_css" value="1" <?php checked( $frm_settings->old_css, 1 ); ?> />
32
  <?php esc_html_e( 'Do not use CSS Grids for form layouts', 'formidable' ); ?>
33
+ <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Form layouts built using CSS grids that are not fully supported by older browsers like Internet Explorer. Leave this box unchecked for your layouts to look best in current browsers, but show in a single column in older browsers.', 'formidable' ); ?>"></span>
34
  </label>
35
  </p>
36
 
classes/views/inbox/list.php CHANGED
@@ -3,43 +3,21 @@
3
  <?php
4
  FrmAppHelper::get_admin_header(
5
  array(
6
- 'label' => __( 'Inbox', 'formidable' ),
 
7
  )
8
  );
9
  ?>
10
  <div id="post-body-content">
11
-
12
- <?php if ( empty( $messages ) ) { ?>
13
- <div class="frm_no_items">
14
- <h2><?php esc_html_e( 'You don\'t have any messages', 'formidable' ); ?></h2>
15
- <p>
16
- <?php esc_html_e( 'Get the details about new updates, tips, sales, and more. We\'ll keep you in the loop.', 'formidable' ); ?>
17
- <?php esc_html_e( 'Want more news and email updates?', 'formidable' ); ?>
18
- </p>
19
- <form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>" class="frm-fields frm-subscribe">
20
- <p>
21
- <input type="text" name="EMAIL" value="<?php echo esc_attr( $user->user_email ); ?>" selector="newsletter-email" placeholder="<?php esc_attr_e( 'Email', 'formidable' ); ?>"/>
22
- </p>
23
- <input type="hidden" name="group[4505]" value="4" />
24
- <p>
25
- <button type="submit" class="button-primary frm-button-primary">
26
- <?php esc_html_e( 'Subscribe', 'formidable' ); ?>
27
- </button>
28
- </p>
29
- </form>
30
- </div>
31
- <?php } ?>
32
-
33
  <?php
34
 
 
35
  foreach ( $messages as $key => $message ) {
36
  if ( ! isset( $message['icon'] ) ) {
37
  $message['icon'] = 'frm_tooltip_icon';
38
  }
39
 
40
- if ( isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user->ID ] ) ) {
41
- continue;
42
- }
43
  ?>
44
  <section class="frm_inbox_card" data-message="<?php echo esc_attr( $key ); ?>">
45
  <span class="frm_inbox_card_icon" aria-hidden="true">
@@ -76,6 +54,27 @@ foreach ( $messages as $key => $message ) {
76
  <?php
77
  }
78
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </div>
80
  </div>
81
  </div>
3
  <?php
4
  FrmAppHelper::get_admin_header(
5
  array(
6
+ 'label' => __( 'Inbox', 'formidable' ),
7
+ 'publish' => array( 'FrmInboxController::dismiss_all_button', compact( 'messages' ) ),
8
  )
9
  );
10
  ?>
11
  <div id="post-body-content">
12
+ <div id="frm_message_list">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  <?php
14
 
15
+ $has_messages = ! empty( $messages );
16
  foreach ( $messages as $key => $message ) {
17
  if ( ! isset( $message['icon'] ) ) {
18
  $message['icon'] = 'frm_tooltip_icon';
19
  }
20
 
 
 
 
21
  ?>
22
  <section class="frm_inbox_card" data-message="<?php echo esc_attr( $key ); ?>">
23
  <span class="frm_inbox_card_icon" aria-hidden="true">
54
  <?php
55
  }
56
  ?>
57
+ </div>
58
+
59
+ <div class="frm_no_items <?php echo esc_attr( $has_messages ? 'frm_hidden' : '' ); ?>" id="frm_empty_inbox">
60
+ <h2><?php esc_html_e( 'You don\'t have any messages', 'formidable' ); ?></h2>
61
+ <p>
62
+ <?php esc_html_e( 'Get the details about new updates, tips, sales, and more. We\'ll keep you in the loop.', 'formidable' ); ?>
63
+ <?php esc_html_e( 'Want more news and email updates?', 'formidable' ); ?>
64
+ </p>
65
+ <form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>" class="frm-fields frm-subscribe">
66
+ <p>
67
+ <input type="text" name="EMAIL" value="<?php echo esc_attr( $user->user_email ); ?>" selector="newsletter-email" placeholder="<?php esc_attr_e( 'Email', 'formidable' ); ?>"/>
68
+ </p>
69
+ <input type="hidden" name="group[4505]" value="4" />
70
+ <p>
71
+ <button type="submit" class="button-primary frm-button-primary">
72
+ <?php esc_html_e( 'Subscribe', 'formidable' ); ?>
73
+ </button>
74
+ </p>
75
+ </form>
76
+ </div>
77
+
78
  </div>
79
  </div>
80
  </div>
css/_single_theme.css.php CHANGED
@@ -4,7 +4,6 @@ $settings = FrmStylesHelper::get_settings_for_output( $style );
4
  extract( $settings );
5
 
6
  $important = empty( $important_style ) ? '' : ' !important';
7
- $label_margin = (int) $width + 10;
8
 
9
  $minus_icons = FrmStylesHelper::minus_icons();
10
  $arrow_icons = FrmStylesHelper::arrow_icons();
@@ -437,39 +436,4 @@ if ( '' === $field_height || 'auto' === $field_height ) {
437
  padding:0<?php echo esc_html( $important ); ?>;
438
  }
439
 
440
- .<?php echo esc_html( $style_class ); ?> .frm_button{
441
- <?php if ( ! empty( $submit_padding ) ) { ?>
442
- padding:<?php echo esc_html( $submit_padding . $important ); ?>;
443
- <?php } ?>
444
- <?php if ( ! empty( $border_radius ) ) { ?>
445
- -moz-border-radius:<?php echo esc_html( $border_radius . $important ); ?>;
446
- -webkit-border-radius:<?php echo esc_html( $border_radius . $important ); ?>;
447
- border-radius:<?php echo esc_html( $border_radius . $important ); ?>;
448
- <?php } ?>
449
- <?php if ( ! empty( $submit_font_size ) ) { ?>
450
- font-size:<?php echo esc_html( $submit_font_size . $important ); ?>;
451
- <?php } ?>
452
- <?php if ( ! empty( $font ) ) { ?>
453
- font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
454
- <?php } ?>
455
- <?php if ( ! empty( $submit_weight ) ) { ?>
456
- font-weight:<?php echo esc_html( $submit_weight . $important ); ?>;
457
- <?php } ?>
458
- <?php if ( ! empty( $submit_text_color ) ) { ?>
459
- color:<?php echo esc_html( $submit_text_color . $important ); ?>;
460
- <?php } ?>
461
- <?php if ( ! empty( $submit_bg_color ) ) { ?>
462
- background: <?php echo esc_html( $submit_bg_color . $important ); ?>;
463
- <?php } ?>
464
- <?php if ( ! empty( $submit_border_width ) ) { ?>
465
- border-width:<?php echo esc_html( $submit_border_width ); ?>;
466
- <?php } ?>
467
- <?php if ( ! empty( $submit_border_color ) ) { ?>
468
- border-color: <?php echo esc_html( $submit_border_color . $important ); ?>;
469
- <?php } ?>
470
- <?php if ( ! empty( $submit_height ) ) { ?>
471
- height:<?php echo esc_html( $submit_height . $important ); ?>;
472
- <?php } ?>
473
- }
474
-
475
  <?php do_action( 'frm_output_single_style', $settings ); ?>
4
  extract( $settings );
5
 
6
  $important = empty( $important_style ) ? '' : ' !important';
 
7
 
8
  $minus_icons = FrmStylesHelper::minus_icons();
9
  $arrow_icons = FrmStylesHelper::arrow_icons();
436
  padding:0<?php echo esc_html( $important ); ?>;
437
  }
438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  <?php do_action( 'frm_output_single_style', $settings ); ?>
css/custom_theme.css.php CHANGED
@@ -57,7 +57,8 @@ $important = empty( $defaults['important_style'] ) ? '' : ' !important';
57
  }
58
 
59
  form input.frm_verify{
60
- display:none !important;
 
61
  }
62
 
63
  .with_frm_style fieldset{
@@ -472,10 +473,60 @@ legend.frm_hidden{
472
  .with_frm_style .frm_button{
473
  text-decoration:none;
474
  border:1px solid #eee;
475
- padding:5px;
476
  display:inline;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
  }
478
 
 
 
 
 
 
 
 
479
  .with_frm_style .frm_submit{
480
  clear:both;
481
  }
@@ -574,6 +625,9 @@ foreach ( $styles as $style ) {
574
  include( dirname( __FILE__ ) . '/_single_theme.css.php' );
575
  unset( $style );
576
  }
 
 
 
577
  ?>
578
 
579
  .frm_ajax_loading{
@@ -1043,7 +1097,6 @@ select.frm_loading_lookup{
1043
  }
1044
  <?php } ?>
1045
 
1046
-
1047
  .with_frm_style .frm_grid.frm_blank_field,
1048
  .with_frm_style .frm_grid_first.frm_blank_field,
1049
  .with_frm_style .frm_grid_odd.frm_blank_field{
57
  }
58
 
59
  form input.frm_verify{
60
+ position:absolute;
61
+ left:-3000px;
62
  }
63
 
64
  .with_frm_style fieldset{
473
  .with_frm_style .frm_button{
474
  text-decoration:none;
475
  border:1px solid #eee;
 
476
  display:inline;
477
+ <?php if ( ! empty( $defaults['submit_padding'] ) ) { ?>
478
+ padding:<?php echo esc_html( $defaults['submit_padding'] . $important ); ?>;
479
+ padding:var(--submit-padding)<?php echo esc_html( $important ); ?>;
480
+ <?php } else { ?>
481
+ padding:5px;
482
+ <?php } ?>
483
+ <?php if ( ! empty( $defaults['border_radius'] ) ) { ?>
484
+ -moz-border-radius:<?php echo esc_html( $defaults['border_radius'] . $important ); ?>;
485
+ -webkit-border-radius:<?php echo esc_html( $defaults['border_radius'] . $important ); ?>;
486
+ border-radius:<?php echo esc_html( $defaults['border_radius'] . $important ); ?>;
487
+ border-radius:var(--border-radius)<?php echo esc_html( $important ); ?>;
488
+ <?php } ?>
489
+ <?php if ( ! empty( $defaults['submit_font_size'] ) ) { ?>
490
+ font-size:<?php echo esc_html( $defaults['submit_font_size'] . $important ); ?>;
491
+ font-size:var(--submit-font-size)<?php echo esc_html( $important ); ?>;
492
+ <?php } ?>
493
+ <?php if ( ! empty( $defaults['font'] ) ) { ?>
494
+ font-family:<?php echo FrmAppHelper::kses( $defaults['font'] . $important ); // WPCS: XSS ok. ?>;
495
+ font-family:var(--font)<?php echo esc_html( $important ); ?>;
496
+ <?php } ?>
497
+ <?php if ( ! empty( $defaults['submit_weight'] ) ) { ?>
498
+ font-weight:<?php echo esc_html( $defaults['submit_weight'] . $important ); ?>;
499
+ font-weight:var(--submit-weight)<?php echo esc_html( $important ); ?>;
500
+ <?php } ?>
501
+ <?php if ( ! empty( $defaults['submit_text_color'] ) ) { ?>
502
+ color:<?php echo esc_html( $defaults['submit_text_color'] . $important ); ?>;
503
+ color:var(--submit-text-color)<?php echo esc_html( $important ); ?>;
504
+ <?php } ?>
505
+ <?php if ( ! empty( $defaults['submit_bg_color'] ) ) { ?>
506
+ background:<?php echo esc_html( $defaults['submit_bg_color'] . $important ); ?>;
507
+ background:var(--submit-bg-color)<?php echo esc_html( $important ); ?>;
508
+ <?php } ?>
509
+ <?php if ( ! empty( $defaults['submit_border_width'] ) ) { ?>
510
+ border-width:<?php echo esc_html( $defaults['submit_border_width'] ); ?>;
511
+ border-width:var(--submit-border-width)<?php echo esc_html( $important ); ?>;
512
+ <?php } ?>
513
+ <?php if ( ! empty( $defaults['submit_border_color'] ) ) { ?>
514
+ border-color:<?php echo esc_html( $defaults['submit_border_color'] . $important ); ?>;
515
+ border-color:var(--submit-border-color)<?php echo esc_html( $important ); ?>;
516
+ <?php } ?>
517
+ <?php if ( ! empty( $defaults['submit_height'] ) ) { ?>
518
+ height:<?php echo esc_html( $defaults['submit_height'] . $important ); ?>;
519
+ height:var(--submit-height)<?php echo esc_html( $important ); ?>;
520
+ <?php } ?>
521
  }
522
 
523
+ <?php if ( ! empty( $defaults['submit_text_color'] ) ) { ?>
524
+ .with_frm_style .frm_button.frm_inverse{
525
+ color:var(--submit-bg-color)<?php echo esc_html( $important ); ?>;
526
+ background:var(--submit-text-color)<?php echo esc_html( $important ); ?>;
527
+ }
528
+ <?php } ?>
529
+
530
  .with_frm_style .frm_submit{
531
  clear:both;
532
  }
625
  include( dirname( __FILE__ ) . '/_single_theme.css.php' );
626
  unset( $style );
627
  }
628
+
629
+ // Set it again since it may have been overridden.
630
+ $important = empty( $defaults['important_style'] ) ? '' : ' !important';
631
  ?>
632
 
633
  .frm_ajax_loading{
1097
  }
1098
  <?php } ?>
1099
 
 
1100
  .with_frm_style .frm_grid.frm_blank_field,
1101
  .with_frm_style .frm_grid_first.frm_blank_field,
1102
  .with_frm_style .frm_grid_odd.frm_blank_field{
css/frm_admin.css CHANGED
@@ -1019,7 +1019,7 @@ h2 .frm-button-primary {
1019
  .frm-white-body .button-primary,
1020
  .frm-white-body .button-secondary,
1021
  .wp-core-ui.frm-white-body .button:not(.button-small),
1022
- .frm-white-body button:not(.wp-switch-editor):not(.dropdown-toggle) {
1023
  text-shadow: none;
1024
  box-shadow: none;
1025
  border-radius: 30px;
@@ -3325,6 +3325,7 @@ li.ui-state-default.edit_field_type_divider .frm-show-hover {
3325
  }
3326
 
3327
  .frm_product_price_wrapper,
 
3328
  #new_fields .frm_single_option select,
3329
  #new_fields .frm_single_option input[type=text] {
3330
  width: calc(100% - 73px);
@@ -3361,7 +3362,7 @@ li.ui-state-default.edit_field_type_divider .frm-show-hover {
3361
  }
3362
 
3363
  .frm_option_key input[type=text] {
3364
- margin-top: 4px !important;
3365
  }
3366
 
3367
  li.ui-state-default.selected .frm-show-click,
@@ -3381,6 +3382,140 @@ li.ui-state-default.selected.edit_field_type_divider .divider_section_only .frm-
3381
  width: 16px;
3382
  }
3383
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3384
  /* Form settings */
3385
 
3386
  #form_settings_page label,
@@ -4443,6 +4578,10 @@ table td, .form-table tr td {
4443
  max-width: 118px !important;
4444
  }
4445
 
 
 
 
 
4446
  .advanced_settings .frm_logic_row {
4447
  margin: 14px 0;
4448
  }
@@ -4580,6 +4719,15 @@ a.frm_add_logic_link.frm_hidden {
4580
  margin-left: 10px;
4581
  }
4582
 
 
 
 
 
 
 
 
 
 
4583
  .frm_action_icon {
4584
  margin: 5px 0 0 5px;
4585
  }
@@ -5314,12 +5462,17 @@ tr.frm_options_heading td {
5314
  float: right;
5315
  }
5316
 
5317
- li.frm_single_option:not(:last-child) {
5318
- padding-bottom: 11px;
5319
- margin-bottom: 10px;
5320
  border-bottom: 1px solid var(--sidebar-hover);
5321
  }
5322
 
 
 
 
 
 
5323
  .frm_prod_type_single input[type=radio],
5324
  .frm_prod_type_single .frm_drag_icon,
5325
  .frm_prod_type_single .frm_sortable_field_opts li:nth-child( n + 3 ),
@@ -6665,6 +6818,7 @@ iframe#dyncontent_ifr {
6665
  #postbox-container-2 input[type="number"],
6666
  #postbox-container-2 select,
6667
  #postbox-container-2 textarea,
 
6668
  #titlediv input[type="text"],
6669
  .frm-fields button.btn,
6670
  .frm_wrap textarea,
1019
  .frm-white-body .button-primary,
1020
  .frm-white-body .button-secondary,
1021
  .wp-core-ui.frm-white-body .button:not(.button-small),
1022
+ .frm-white-body button:not(.wp-switch-editor):not(.dropdown-toggle):not(.media-menu-item):not(.media-modal-close):not(.frm_no_style_button){
1023
  text-shadow: none;
1024
  box-shadow: none;
1025
  border-radius: 30px;
3325
  }
3326
 
3327
  .frm_product_price_wrapper,
3328
+ .frm_image_preview_wrapper,
3329
  #new_fields .frm_single_option select,
3330
  #new_fields .frm_single_option input[type=text] {
3331
  width: calc(100% - 73px);
3362
  }
3363
 
3364
  .frm_option_key input[type=text] {
3365
+ margin-top: 15px !important;
3366
  }
3367
 
3368
  li.ui-state-default.selected .frm-show-click,
3382
  width: 16px;
3383
  }
3384
 
3385
+ /* Image options for Radio and Checkbox */
3386
+
3387
+ .frm_image_options .frm_image_option_container {
3388
+ --field-border-width: 1px;
3389
+ --border-color: var(--grey-border);
3390
+ --border-color-active: var(--primary-color);
3391
+ --border-radius: var(--small-radius);
3392
+ }
3393
+
3394
+ #form_show_entry_page .frm_file_link,
3395
+ #form_show_entry_page .frm_image_option_container {
3396
+ display: inline-flex;
3397
+ flex-wrap: nowrap;
3398
+ flex-direction: column;
3399
+ text-align: center;
3400
+ align-items: center;
3401
+ width: 150px;
3402
+ margin-right: 10px;
3403
+ margin-bottom: 10px;
3404
+ }
3405
+
3406
+ #form_show_entry_page .frm_image_option_container img {
3407
+ width: 150px;
3408
+ height: 150px;
3409
+ object-fit: cover;
3410
+ }
3411
+
3412
+ #form_show_entry_page .frm_file_link img {
3413
+ max-width: 150px;
3414
+ height: auto;
3415
+ }
3416
+
3417
+ #form_show_entry_page .frm_file_link ~ br {
3418
+ display: none;
3419
+ }
3420
+
3421
+ #form_show_entry_page .frm_upload_label {
3422
+ padding: 10px;
3423
+ }
3424
+
3425
+ .frm_image_option_container .frm_image_placeholder_icon svg{
3426
+ height: 150px;
3427
+ }
3428
+
3429
+ .frm_list_entry_page .frm_file_link,
3430
+ .frm_list_entry_page .frm_image_option_container.frm_label_with_image {
3431
+ display: block;
3432
+ text-align: center;
3433
+ }
3434
+
3435
+ .frm_list_entry_page .frm_image_option_container img {
3436
+ width: 75px;
3437
+ height: 75px;
3438
+ object-fit: cover;
3439
+ }
3440
+
3441
+ .frm_list_entry_page .frm_file_link img {
3442
+ max-width: 75px;
3443
+ height: auto;
3444
+ }
3445
+
3446
+ .frm_image_option_container .frm_empty_url {
3447
+ background-color: var(--sidebar-color);
3448
+ }
3449
+
3450
+ .frm_list_entry_page .frm_image_option_container .frm_text_label_for_image {
3451
+ display: block;
3452
+ padding: 5px 0 10px;
3453
+ }
3454
+
3455
+ .frm_list_entry_page .frm_upload_label,
3456
+ .frm-summary-page-wrapper .frm_text_label_for_image {
3457
+ display: block;
3458
+ }
3459
+
3460
+ .frm_single_option .frm_option_key {
3461
+ margin-top: 17px;
3462
+ }
3463
+
3464
+ .frm_image_data {
3465
+ margin-left: 10px;
3466
+ display: flex;
3467
+ flex-direction: column;
3468
+ font-size: 14px;
3469
+ line-height: 17px;
3470
+ }
3471
+
3472
+ .frm_image_styling_frame {
3473
+ display: flex;
3474
+ align-items: stretch;
3475
+ margin-left: 1.5rem;
3476
+ }
3477
+
3478
+ .frm_image_styling_frame img{
3479
+ height: 54px;
3480
+ width: 54px;
3481
+ min-width: auto;
3482
+ min-height: auto;
3483
+ border-radius: 3px;
3484
+ object-fit: cover;
3485
+ object-position: center;
3486
+ }
3487
+
3488
+ .frm_image_preview_title{
3489
+ margin-top: 6px;
3490
+ color: rgba(40, 47, 54, 0.65);
3491
+ overflow: hidden;
3492
+ white-space: nowrap;
3493
+ text-overflow: ellipsis;
3494
+ }
3495
+
3496
+ .frm_wrap .frm_choose_image_box {
3497
+ cursor: pointer;
3498
+ color: var(--dark-grey);
3499
+ background-color: #F2F2F2;
3500
+ margin-left: 24px;
3501
+ text-align: center;
3502
+ width: 100%;
3503
+ }
3504
+
3505
+ .frm_wrap .frm_choose_image_box:hover {
3506
+ background: #fff;
3507
+ }
3508
+
3509
+ .frm_remove_image_option {
3510
+ margin-top: 9px;
3511
+ color: rgba(40, 47, 54, 0.4);
3512
+ cursor: pointer;
3513
+ }
3514
+
3515
+ .frm_remove_image_option:hover {
3516
+ color: rgba(40, 47, 54, 0.8);
3517
+ }
3518
+
3519
  /* Form settings */
3520
 
3521
  #form_settings_page label,
4578
  max-width: 118px !important;
4579
  }
4580
 
4581
+ .frm-single-settings ul.frm_sortable_field_opts {
4582
+ margin-bottom: 5px;
4583
+ }
4584
+
4585
  .advanced_settings .frm_logic_row {
4586
  margin: 14px 0;
4587
  }
4719
  margin-left: 10px;
4720
  }
4721
 
4722
+ .frm-add-other {
4723
+ text-align: right;
4724
+ }
4725
+
4726
+ .frm_add_opt .frm_add_tag,
4727
+ .frm-add-other .frm_add_tag {
4728
+ vertical-align: 20%;
4729
+ }
4730
+
4731
  .frm_action_icon {
4732
  margin: 5px 0 0 5px;
4733
  }
5462
  float: right;
5463
  }
5464
 
5465
+ .frm_priority_field_choices,
5466
+ li.frm_single_option {
5467
+ padding-bottom: 16px;
5468
  border-bottom: 1px solid var(--sidebar-hover);
5469
  }
5470
 
5471
+ .frm_priority_field_choices,
5472
+ li.frm_single_option:not(:last-child) {
5473
+ margin-bottom: 16px;
5474
+ }
5475
+
5476
  .frm_prod_type_single input[type=radio],
5477
  .frm_prod_type_single .frm_drag_icon,
5478
  .frm_prod_type_single .frm_sortable_field_opts li:nth-child( n + 3 ),
6818
  #postbox-container-2 input[type="number"],
6819
  #postbox-container-2 select,
6820
  #postbox-container-2 textarea,
6821
+ button.frm_choose_image_box,
6822
  #titlediv input[type="text"],
6823
  .frm-fields button.btn,
6824
  .frm_wrap textarea,
css/frm_grids.css CHANGED
@@ -15,6 +15,11 @@
15
  display:initial;
16
  }
17
 
 
 
 
 
 
18
  .frm_clear_none{
19
  clear:none;
20
  }
15
  display:initial;
16
  }
17
 
18
+ .frm_verify{
19
+ position:absolute;
20
+ left:-3000px;
21
+ }
22
+
23
  .frm_clear_none{
24
  clear:none;
25
  }
formidable.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Formidable Forms
4
  Description: Quickly and easily create drag-and-drop forms
5
- Version: 4.05.02
6
  Plugin URI: https://formidableforms.com/
7
  Author URI: https://formidableforms.com/
8
  Author: Strategy11
2
  /*
3
  Plugin Name: Formidable Forms
4
  Description: Quickly and easily create drag-and-drop forms
5
+ Version: 4.06
6
  Plugin URI: https://formidableforms.com/
7
  Author URI: https://formidableforms.com/
8
  Author: Strategy11
images/icons.svg CHANGED
@@ -64,6 +64,18 @@
64
  <title>checkmark</title>
65
  <path d="M17 3.3L6.7 13.5 3 9.8a.5.5 0 0 0-.7 0l-1 1c-.3.2-.3.5 0 .7l5.1 5.2c.2.2.5.2.7 0L18.8 5c.2-.2.2-.5 0-.6l-1.1-1.1a.5.5 0 0 0-.7 0z"/>
66
  </symbol>
 
 
 
 
 
 
 
 
 
 
 
 
67
  <symbol id="frm_check_icon" viewBox="0 0 20 20">
68
  <title>check</title>
69
  <path d="M19.7 10A9.7 9.7 0 1 1 .3 10a9.7 9.7 0 0 1 19.4 0zM8.9 15.1L16 8c.2-.2.2-.6 0-.8l-1-1a.6.6 0 0 0-.8 0l-5.9 6-2.7-2.8a.6.6 0 0 0-.9 0l-.9.9c-.2.2-.2.6 0 .9l4 4c.3.3.7.3 1 0z"/>
64
  <title>checkmark</title>
65
  <path d="M17 3.3L6.7 13.5 3 9.8a.5.5 0 0 0-.7 0l-1 1c-.3.2-.3.5 0 .7l5.1 5.2c.2.2.5.2.7 0L18.8 5c.2-.2.2-.5 0-.6l-1.1-1.1a.5.5 0 0 0-.7 0z"/>
66
  </symbol>
67
+ <symbol id="frm_placeholder_image_icon" viewBox="0 0 63 47.25">
68
+ <title>image</title>
69
+ <path d="M57 7.9H6a6 6 0 00-6 5.9v35.4a6 6 0 006 6h51a6 6 0 006-6V13.8a6 6 0 00-6-6zm2 41.3c0 1.1-.8 2-2 2H6c-1.2 0-2-.9-2-2V13.8c0-1.1.8-2 2-2h51c1.2 0 2 .9 2 2v35.4zM13.9 28.5a6.9 6.9 0 100-13.7 6.9 6.9 0 000 13.7zm0-9.8a3 3 0 110 6 3 3 0 010-6zm25.5 2.8L27.6 33.2l-3.9-3.8a3 3 0 00-4.1 0L8.7 40.2a3 3 0 00-.8 2.1v3.5c0 .8.6 1.5 1.5 1.5h44.2c.9 0 1.5-.7 1.5-1.5V34.5a3 3 0 00-.8-2.1L43.4 21.5a3 3 0 00-4.1 0zm11.9 21.8H11.8v-.6l9.9-9.8 5.9 5.9L41.3 25l9.9 9.9v8.4z" fill-opacity=".1"/>
70
+ </symbol>
71
+ <symbol id="frm_checkmark_circle_icon" viewBox="0 0 24 24">
72
+ <title>checkmark_circle</title>
73
+ <circle cx="12.2" cy="11.7" r="10" fill="#fff"/><path d="M23.6 12A11.6 11.6 0 11.4 12a11.6 11.6 0 0123.2 0zm-13 6.2l8.7-8.7c.3-.3.3-.7 0-1l-1-1a.7.7 0 00-1.1 0l-7 7-3.4-3.3a.8.8 0 00-1 0l-1 1c-.4.3-.4.8 0 1l4.8 5c.3.2.8.2 1 0z"/>
74
+ </symbol>
75
+ <symbol id="frm_checkmark_square_icon" viewBox="0 0 24 24">
76
+ <title>checkmark_square</title>
77
+ <rect width="24" height="24" rx="3"/><path d="M10.7 18.2l8.6-8.7c.3-.3.3-.7 0-1l-1-1a.7.7 0 00-1.1 0l-7 7-3.4-3.3a.8.8 0 00-1 0l-1 1c-.4.3-.4.8 0 1l4.8 5c.3.2.8.2 1 0z" fill="#fff"/>
78
+ </symbol>
79
  <symbol id="frm_check_icon" viewBox="0 0 20 20">
80
  <title>check</title>
81
  <path d="M19.7 10A9.7 9.7 0 1 1 .3 10a9.7 9.7 0 0 1 19.4 0zM8.9 15.1L16 8c.2-.2.2-.6 0-.8l-1-1a.6.6 0 0 0-.8 0l-5.9 6-2.7-2.8a.6.6 0 0 0-.9 0l-.9.9c-.2.2-.2.6 0 .9l4 4c.3.3.7.3 1 0z"/>
images/image-options.png ADDED
Binary file
js/formidable.js CHANGED
@@ -1159,6 +1159,7 @@ function frmFrontFormJS() {
1159
  scrollObj = id;
1160
  }
1161
 
 
1162
  newPos = scrollObj.offset().top;
1163
  if ( ! newPos || frm_js.offset === '-1' ) {
1164
  return;
1159
  scrollObj = id;
1160
  }
1161
 
1162
+ scrollObj.focus();
1163
  newPos = scrollObj.offset().top;
1164
  if ( ! newPos || frm_js.offset === '-1' ) {
1165
  return;
js/formidable.min.js CHANGED
@@ -42,9 +42,9 @@ afterRecaptcha:function(token,formID){var object=jQuery("#frm_form_"+formID+"_co
42
  if(classList.indexOf("frm_ajax_submit")>-1){hasFileFields=jQuery(object).find('input[type="file"]').filter(function(){return!!this.value}).length;if(hasFileFields<1){action=jQuery(object).find('input[name="frm_action"]').val();frmFrontForm.checkFormErrors(object,action)}else object.submit()}else object.submit()},validateFormSubmit:function(object){if(typeof tinyMCE!=="undefined"&&jQuery(object).find(".wp-editor-wrap").length)tinyMCE.triggerSave();jsErrors=[];if(shouldJSValidate(object)){frmFrontForm.getAjaxFormErrors(object);
43
  if(Object.keys(jsErrors).length)frmFrontForm.addAjaxFormErrors(object)}return jsErrors},getAjaxFormErrors:function(object){var customErrors,key;jsErrors=validateForm(object);if(typeof frmThemeOverride_jsErrors==="function"){action=jQuery(object).find('input[name="frm_action"]').val();customErrors=frmThemeOverride_jsErrors(action,object);if(Object.keys(customErrors).length)for(key in customErrors)jsErrors[key]=customErrors[key]}return jsErrors},addAjaxFormErrors:function(object){var key,$fieldCont;
44
  removeAllErrors();for(key in jsErrors){$fieldCont=jQuery(object).find("#frm_field_"+key+"_container");if($fieldCont.length)addFieldError($fieldCont,key,jsErrors);else delete jsErrors[key]}scrollToFirstField(object)},checkFormErrors:function(object,action){getFormErrors(object,action)},checkRequiredField:function(field,errors){return checkRequiredField(field,errors)},showSubmitLoading:function($object){showSubmitLoading($object)},removeSubmitLoading:function($object,enable,processesRunning){removeSubmitLoading($object,
45
- enable,processesRunning)},scrollToID:function(id){var object=jQuery(document.getElementById(id));frmFrontForm.scrollMsg(object,false)},scrollMsg:function(id,object,animate){var newPos,m,b,screenTop,screenBottom,scrollObj="";if(typeof object==="undefined"){scrollObj=jQuery(document.getElementById("frm_form_"+id+"_container"));if(scrollObj.length<1)return}else if(typeof id==="string")scrollObj=jQuery(object).find("#frm_field_"+id+"_container");else scrollObj=id;newPos=scrollObj.offset().top;if(!newPos||
46
- frm_js.offset==="-1")return;newPos=newPos-frm_js.offset;m=jQuery("html").css("margin-top");b=jQuery("body").css("margin-top");if(m||b)newPos=newPos-parseInt(m)-parseInt(b);if(newPos&&window.innerHeight){screenTop=document.documentElement.scrollTop||document.body.scrollTop;screenBottom=screenTop+window.innerHeight;if(newPos>screenBottom||newPos<screenTop){if(typeof animate==="undefined")jQuery(window).scrollTop(newPos);else jQuery("html,body").animate({scrollTop:newPos},500);return false}}},fieldValueChanged:function(e){var fieldId=
47
- frmFrontForm.getFieldId(this,false);if(!fieldId||typeof fieldId==="undefined")return;if(e.frmTriggered&&e.frmTriggered==fieldId)return;jQuery(document).trigger("frmFieldChanged",[this,fieldId,e]);if(e.selfTriggered!==true)maybeValidateChange(fieldId,this)},savingDraft:function(object){console.warn("DEPRECATED: function frmFrontForm.savingDraft in v3.0 use frmProForm.savingDraft");if(typeof frmProForm!=="undefined")return frmProForm.savingDraft(object)},goingToPreviousPage:function(object){console.warn("DEPRECATED: function frmFrontForm.goingToPreviousPage in v3.0 use frmProForm.goingToPreviousPage");
48
  if(typeof frmProForm!=="undefined")return frmProForm.goingToPreviousPage(object)},hideOrShowFields:function(){console.warn("DEPRECATED: function frmFrontForm.hideOrShowFields in v3.0 use frmProForm.hideOrShowFields");if(typeof frmProForm!=="undefined")frmProForm.hideOrShowFields()},hidePreviouslyHiddenFields:function(){console.warn("DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields");if(typeof frmProForm!=="undefined")frmProForm.hidePreviouslyHiddenFields()},
49
  checkDependentDynamicFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentDynamicFields(ids)},checkDependentLookupFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentLookupFields(ids)},loadGoogle:function(){console.warn("DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle");
50
  frmProForm.loadGoogle()},escapeHtml:function(text){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},invisible:function(classes){jQuery(classes).css("visibility","hidden")},visible:function(classes){jQuery(classes).css("visibility","visible")}}}frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(){frmFrontForm.init()});
42
  if(classList.indexOf("frm_ajax_submit")>-1){hasFileFields=jQuery(object).find('input[type="file"]').filter(function(){return!!this.value}).length;if(hasFileFields<1){action=jQuery(object).find('input[name="frm_action"]').val();frmFrontForm.checkFormErrors(object,action)}else object.submit()}else object.submit()},validateFormSubmit:function(object){if(typeof tinyMCE!=="undefined"&&jQuery(object).find(".wp-editor-wrap").length)tinyMCE.triggerSave();jsErrors=[];if(shouldJSValidate(object)){frmFrontForm.getAjaxFormErrors(object);
43
  if(Object.keys(jsErrors).length)frmFrontForm.addAjaxFormErrors(object)}return jsErrors},getAjaxFormErrors:function(object){var customErrors,key;jsErrors=validateForm(object);if(typeof frmThemeOverride_jsErrors==="function"){action=jQuery(object).find('input[name="frm_action"]').val();customErrors=frmThemeOverride_jsErrors(action,object);if(Object.keys(customErrors).length)for(key in customErrors)jsErrors[key]=customErrors[key]}return jsErrors},addAjaxFormErrors:function(object){var key,$fieldCont;
44
  removeAllErrors();for(key in jsErrors){$fieldCont=jQuery(object).find("#frm_field_"+key+"_container");if($fieldCont.length)addFieldError($fieldCont,key,jsErrors);else delete jsErrors[key]}scrollToFirstField(object)},checkFormErrors:function(object,action){getFormErrors(object,action)},checkRequiredField:function(field,errors){return checkRequiredField(field,errors)},showSubmitLoading:function($object){showSubmitLoading($object)},removeSubmitLoading:function($object,enable,processesRunning){removeSubmitLoading($object,
45
+ enable,processesRunning)},scrollToID:function(id){var object=jQuery(document.getElementById(id));frmFrontForm.scrollMsg(object,false)},scrollMsg:function(id,object,animate){var newPos,m,b,screenTop,screenBottom,scrollObj="";if(typeof object==="undefined"){scrollObj=jQuery(document.getElementById("frm_form_"+id+"_container"));if(scrollObj.length<1)return}else if(typeof id==="string")scrollObj=jQuery(object).find("#frm_field_"+id+"_container");else scrollObj=id;scrollObj.focus();newPos=scrollObj.offset().top;
46
+ if(!newPos||frm_js.offset==="-1")return;newPos=newPos-frm_js.offset;m=jQuery("html").css("margin-top");b=jQuery("body").css("margin-top");if(m||b)newPos=newPos-parseInt(m)-parseInt(b);if(newPos&&window.innerHeight){screenTop=document.documentElement.scrollTop||document.body.scrollTop;screenBottom=screenTop+window.innerHeight;if(newPos>screenBottom||newPos<screenTop){if(typeof animate==="undefined")jQuery(window).scrollTop(newPos);else jQuery("html,body").animate({scrollTop:newPos},500);return false}}},
47
+ fieldValueChanged:function(e){var fieldId=frmFrontForm.getFieldId(this,false);if(!fieldId||typeof fieldId==="undefined")return;if(e.frmTriggered&&e.frmTriggered==fieldId)return;jQuery(document).trigger("frmFieldChanged",[this,fieldId,e]);if(e.selfTriggered!==true)maybeValidateChange(fieldId,this)},savingDraft:function(object){console.warn("DEPRECATED: function frmFrontForm.savingDraft in v3.0 use frmProForm.savingDraft");if(typeof frmProForm!=="undefined")return frmProForm.savingDraft(object)},goingToPreviousPage:function(object){console.warn("DEPRECATED: function frmFrontForm.goingToPreviousPage in v3.0 use frmProForm.goingToPreviousPage");
48
  if(typeof frmProForm!=="undefined")return frmProForm.goingToPreviousPage(object)},hideOrShowFields:function(){console.warn("DEPRECATED: function frmFrontForm.hideOrShowFields in v3.0 use frmProForm.hideOrShowFields");if(typeof frmProForm!=="undefined")frmProForm.hideOrShowFields()},hidePreviouslyHiddenFields:function(){console.warn("DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields");if(typeof frmProForm!=="undefined")frmProForm.hidePreviouslyHiddenFields()},
49
  checkDependentDynamicFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentDynamicFields(ids)},checkDependentLookupFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentLookupFields(ids)},loadGoogle:function(){console.warn("DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle");
50
  frmProForm.loadGoogle()},escapeHtml:function(text){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},invisible:function(classes){jQuery(classes).css("visibility","hidden")},visible:function(classes){jQuery(classes).css("visibility","visible")}}}frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(){frmFrontForm.init()});
js/formidable_admin.js CHANGED
@@ -1087,7 +1087,8 @@ function frmAdminBuildJS() {
1087
  }
1088
 
1089
  function maybeDisableAddSummaryBtn() {
1090
- if ( formHasSummaryField() ) {
 
1091
  disableAddSummaryBtn();
1092
  }
1093
  }
@@ -1974,6 +1975,117 @@ function frmAdminBuildJS() {
1974
  jQuery( '.field_' + fieldId + '_option' ).toggleClass( 'frm_with_key' );
1975
  }
1976
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1977
  function toggleMultiselect() {
1978
  /*jshint validthis:true */
1979
  var dropdown = jQuery( this ).closest( 'li' ).find( '.frm_form_fields select' );
@@ -2522,11 +2634,11 @@ function frmAdminBuildJS() {
2522
  }
2523
 
2524
  function resetSingleOpt( fieldId, fieldKey, thisOpt ) {
2525
- var saved, text, defaultVal, previewInput,
2526
  optKey = thisOpt.data( 'optkey' ),
2527
  separateValues = usingSeparateValues( fieldId ),
2528
  single = jQuery( 'label[for="field_' + fieldKey + '-' + optKey + '"]' ),
2529
- baseName = 'field_options[options_' + fieldId + '][' + optKey + ']';
2530
  label = jQuery( 'input[name="' + baseName + '[label]"]' );
2531
 
2532
  if ( single.length < 1 ) {
@@ -2552,18 +2664,64 @@ function frmAdminBuildJS() {
2552
  saved = label.val();
2553
  }
2554
 
2555
- if ( label.length ) {
2556
- // Set the displayed value.
2557
- text = single[0].childNodes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2558
  text[ text.length - 1 ].nodeValue = ' ' + label.val();
 
2559
 
2560
- // Set saved value.
2561
- previewInput.val( saved );
2562
 
2563
- // Set the default value.
2564
- defaultVal = thisOpt.find( 'input[name^="default_value_"]' );
2565
- previewInput.prop( 'checked', defaultVal.is( ':checked' ) ? true : false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2566
  }
 
 
2567
  }
2568
 
2569
  function resetDisplayedOpts( fieldId ) {
@@ -2589,26 +2747,31 @@ function frmAdminBuildJS() {
2589
  type = input.attr( 'type' );
2590
  jQuery( '#field_' + fieldId + '_inner_container > .frm_form_fields' ).html( '' );
2591
  fieldInfo = getFieldKeyFromOpt( jQuery( '#frm_delete_field_' + fieldId + '-000_container' ) );
 
2592
  var container = jQuery( '#field_' + fieldId + '_inner_container > .frm_form_fields' ),
 
 
 
2593
  isProduct = isProductField( fieldId );
2594
 
2595
  for ( i = 0; i < opts.length; i++ ) {
2596
- container.append( addRadioCheckboxOpt( type, opts[ i ], fieldId, fieldInfo.fieldKey, isProduct ) );
2597
  }
2598
  }
2599
  }
2600
 
2601
- function addRadioCheckboxOpt( type, opt, fieldId, fieldKey, isProduct ) {
2602
  var other, single,
2603
  isOther = opt.key.indexOf( 'other' ) !== -1,
2604
- id = 'field_' + fieldKey + '-' + opt.key;
 
2605
 
2606
  other = '<input type="text" id="field_' + fieldKey + '-' + opt.key + '-otext" class="frm_other_input frm_pos_none" name="item_meta[other][' + fieldId + '][' + opt.key + ']" value="" />';
2607
 
2608
- single = '<div class="frm_' + type + ' ' + type + '" id="frm_' + type + '_' + fieldId + '-' + opt.key + '"><label for="' + id +
2609
  '"><input type="' + type +
2610
  '" name="item_meta[' + fieldId + ']' + ( type === 'checkbox' ? '[]' : '' ) +
2611
- '" value="' + opt.saved + '" id="' + id + '"' + ( isProduct ? ' data-price="' + opt.price + '"' : '' ) + '> ' + opt.label + '</label>' +
2612
  ( isOther ? other : '' ) +
2613
  '</div>';
2614
 
@@ -2669,13 +2832,19 @@ function frmAdminBuildJS() {
2669
 
2670
  function getMultipleOpts( fieldId ) {
2671
  var i, saved, labelName, label, key, optObj,
 
 
2672
  opts = [],
 
 
2673
  optVals = jQuery( 'input[name^="field_options[options_' + fieldId + ']"]' ),
2674
  separateValues = usingSeparateValues( fieldId ),
 
 
2675
  isProduct = isProductField( fieldId );
2676
 
2677
  for ( i = 0; i < optVals.length; i++ ) {
2678
- if ( optVals[ i ].name.indexOf( '[000]' ) > 0 || optVals[ i ].name.indexOf( '[value]' ) > 0 || optVals[ i ].name.indexOf( '[price]' ) > 0 ) {
2679
  continue;
2680
  }
2681
  saved = optVals[ i ].value;
@@ -2687,9 +2856,18 @@ function frmAdminBuildJS() {
2687
  saved = jQuery( 'input[name="' + labelName + '"]' ).val();
2688
  }
2689
 
 
 
 
 
 
 
 
 
2690
  optObj = {
2691
  saved: saved,
2692
  label: label,
 
2693
  key: key
2694
  };
2695
 
@@ -2704,6 +2882,63 @@ function frmAdminBuildJS() {
2704
  return opts;
2705
  }
2706
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2707
  function removeDropdownOpts( field ) {
2708
  var i;
2709
  if ( typeof field.options === 'undefined' ) {
@@ -2719,7 +2954,22 @@ function frmAdminBuildJS() {
2719
  * Is the box checked to use separate values?
2720
  */
2721
  function usingSeparateValues( fieldId ) {
2722
- var field = document.getElementById( 'separate_value_' + fieldId );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2723
  if ( field === null ) {
2724
  return false;
2725
  } else {
@@ -3039,7 +3289,9 @@ function frmAdminBuildJS() {
3039
  fieldId = getOptionFieldId( parentLi, key ),
3040
  defaultRadio = parentLi.querySelector( 'input[name="default_value_' + fieldId + '"]' );
3041
 
3042
- defaultRadio.value = input.value;
 
 
3043
  }
3044
 
3045
  /**
@@ -3605,7 +3857,7 @@ function frmAdminBuildJS() {
3605
  if ( editable !== null ) {
3606
  show = editable.checked && jQuery( document.getElementById( 'edit_action' ) ).val() === 'message';
3607
  if ( ! show ) {
3608
- show = document.getElementById( 'save_draft' ).checked;
3609
  }
3610
  }
3611
  return show;
@@ -4997,6 +5249,7 @@ function frmAdminBuildJS() {
4997
  delay: 100,
4998
  minLength: 0,
4999
  source: ajaxurl + '?action=frm_' + type + '_search&nonce=' + frmGlobal.nonce,
 
5000
  select: autoCompleteSelectFromResults,
5001
  focus: autoCompleteFocus,
5002
  position: {
@@ -5035,6 +5288,12 @@ function frmAdminBuildJS() {
5035
  return false;
5036
  }
5037
 
 
 
 
 
 
 
5038
  function autoCompleteSelectFromResults( e, ui ) {
5039
  e.preventDefault();
5040
 
@@ -5524,6 +5783,11 @@ function frmAdminBuildJS() {
5524
  $builderForm.on( 'click', '.frm-single-settings h3', maybeCollapseSettings );
5525
 
5526
  $builderForm.on( 'click', '.frm_toggle_sep_values', toggleSepValues );
 
 
 
 
 
5527
  $builderForm.on( 'click', '.frm_multiselect_opt', toggleMultiselect );
5528
  $newFields.on( 'mousedown', 'input, textarea, select', stopFieldFocus );
5529
  $newFields.on( 'click', 'input[type=radio], input[type=checkbox]', stopFieldFocus );
@@ -5533,6 +5797,7 @@ function frmAdminBuildJS() {
5533
  $builderForm.on( 'focusin', '.frm_single_option input[type=text]', maybeClearOptText );
5534
  $builderForm.on( 'click', '.frm_add_opt', addFieldOption );
5535
  $builderForm.on( 'change', '.frm_single_option input', resetOptOnChange );
 
5536
  $builderForm.on( 'change', '.frm_toggle_mult_sel', toggleMultSel );
5537
  $builderForm.on( 'focusin', '.frm_classes', showBuilderModal );
5538
 
@@ -5839,6 +6104,18 @@ function frmAdminBuildJS() {
5839
  });
5840
  });
5841
  });
 
 
 
 
 
 
 
 
 
 
 
 
5842
  },
5843
 
5844
  styleInit: function() {
1087
  }
1088
 
1089
  function maybeDisableAddSummaryBtn() {
1090
+ var summary = document.getElementById( 'summary' );
1091
+ if ( summary && ! summary.classList.contains( 'frm_show_upgrade' ) && formHasSummaryField() ) {
1092
  disableAddSummaryBtn();
1093
  }
1094
  }
1975
  jQuery( '.field_' + fieldId + '_option' ).toggleClass( 'frm_with_key' );
1976
  }
1977
 
1978
+ function toggleImageOptions() {
1979
+ /*jshint validthis:true */
1980
+ var hasImageOptions, imageSize,
1981
+ $field = jQuery( this ).closest( '.frm-single-settings' ),
1982
+ fieldId = $field.data( 'fid' ),
1983
+ displayField = document.getElementById( 'frm_field_id_' + fieldId );
1984
+
1985
+ refreshOptionDisplayNow( jQuery( this ) );
1986
+
1987
+ toggle( jQuery( '.field_' + fieldId + '_image_id' ) );
1988
+ toggle( jQuery( '.frm_toggle_image_options_' + fieldId ) );
1989
+ toggle( jQuery( '.frm_image_size_' + fieldId ) );
1990
+ toggle( jQuery( '.frm_alignment_' + fieldId ) );
1991
+ toggle( jQuery( '.frm-add-other#frm_add_field_' + fieldId ) );
1992
+
1993
+ hasImageOptions = imagesAsOptions( fieldId );
1994
+
1995
+ if ( hasImageOptions ) {
1996
+ setAlignment( fieldId, 'inline' );
1997
+ removeImageSizeClasses( displayField );
1998
+ imageSize = getImageOptionSize( fieldId );
1999
+ displayField.classList.add( 'frm_image_options' );
2000
+ displayField.classList.add( 'frm_image_size_' + imageSize );
2001
+ $field.find( '.frm-bulk-edit-link' ).hide();
2002
+ } else {
2003
+ displayField.classList.remove( 'frm_image_options' );
2004
+ removeImageSizeClasses( displayField );
2005
+ setAlignment( fieldId, 'block' );
2006
+ $field.find( '.frm-bulk-edit-link' ).show();
2007
+ }
2008
+ }
2009
+
2010
+ function removeImageSizeClasses( field ) {
2011
+ field.classList.remove( 'frm_image_size_', 'frm_image_size_small', 'frm_image_size_medium', 'frm_image_size_large', 'frm_image_size_xlarge' );
2012
+ }
2013
+
2014
+ function setAlignment( fieldId, alignment ) {
2015
+ jQuery( '#field_options_align_' + fieldId ).val( alignment ).change();
2016
+ }
2017
+
2018
+ function setImageSize() {
2019
+ var $field = jQuery( this ).closest( '.frm-single-settings' ),
2020
+ fieldId = $field.data( 'fid' ),
2021
+ displayField = document.getElementById( 'frm_field_id_' + fieldId );
2022
+
2023
+ refreshOptionDisplay();
2024
+
2025
+ if ( imagesAsOptions( fieldId ) ) {
2026
+ removeImageSizeClasses( displayField );
2027
+ displayField.classList.add( 'frm_image_options' );
2028
+ displayField.classList.add( 'frm_image_size_' + getImageOptionSize( fieldId ) );
2029
+ }
2030
+ }
2031
+
2032
+ function refreshOptionDisplayNow( object ) {
2033
+ var $field = object.closest( '.frm-single-settings' ),
2034
+ fieldID = $field.data( 'fid' );
2035
+ jQuery( '.field_' + fieldID + '_option' ).change();
2036
+ }
2037
+
2038
+ function refreshOptionDisplay() {
2039
+ /*jshint validthis:true */
2040
+ refreshOptionDisplayNow( jQuery( this ) );
2041
+ }
2042
+
2043
+ function addImageToOption( event ) {
2044
+ var fileFrame,
2045
+ $this = jQuery( this ),
2046
+ $field = $this.closest( '.frm-single-settings' ),
2047
+ $imagePreview = $this.closest( '.frm_image_preview_wrapper' ),
2048
+ fieldId = $field.data( 'fid' ),
2049
+ postID = 0;
2050
+
2051
+ event.preventDefault();
2052
+
2053
+ wp.media.model.settings.post.id = postID;
2054
+
2055
+ fileFrame = wp.media.frames.file_frame = wp.media({
2056
+ multiple: false
2057
+ });
2058
+
2059
+ fileFrame.on( 'select', function() {
2060
+ attachment = fileFrame.state().get( 'selection' ).first().toJSON();
2061
+ $imagePreview.find( 'img' ).attr( 'src', attachment.url );
2062
+ $imagePreview.find( '.frm_image_preview_frame' ).show();
2063
+ $imagePreview.find( '.frm_image_preview_title' ).text( attachment.filename );
2064
+ $imagePreview.siblings( 'input[name*="[label]"]' ).data( 'frmimgurl', attachment.url );
2065
+ $imagePreview.find( '.frm_choose_image_box' ).hide();
2066
+ $imagePreview.find( 'input.frm_image_id' ).val( attachment.id ).change();
2067
+ wp.media.model.settings.post.id = postID;
2068
+ });
2069
+
2070
+ fileFrame.open();
2071
+ }
2072
+
2073
+ function removeImageFromOption( event ) {
2074
+ var $this = jQuery( this ),
2075
+ $field = $this.closest( '.frm-single-settings' ),
2076
+ fieldId = $field.data( 'fid' ),
2077
+ previewWrapper = $this.closest( '.frm_image_preview_wrapper' );
2078
+
2079
+ event.preventDefault();
2080
+ event.stopPropagation();
2081
+
2082
+ previewWrapper.find( 'img' ).attr( 'src', '' );
2083
+ previewWrapper.find( '.frm_image_preview_frame' ).hide();
2084
+ previewWrapper.find( '.frm_choose_image_box' ).show();
2085
+ previewWrapper.find( 'input.frm_image_id' ).val( 0 ).change();
2086
+ }
2087
+
2088
+
2089
  function toggleMultiselect() {
2090
  /*jshint validthis:true */
2091
  var dropdown = jQuery( this ).closest( 'li' ).find( '.frm_form_fields select' );
2634
  }
2635
 
2636
  function resetSingleOpt( fieldId, fieldKey, thisOpt ) {
2637
+ var saved, text, defaultVal, previewInput, labelForDisplay, optContainer,
2638
  optKey = thisOpt.data( 'optkey' ),
2639
  separateValues = usingSeparateValues( fieldId ),
2640
  single = jQuery( 'label[for="field_' + fieldKey + '-' + optKey + '"]' ),
2641
+ baseName = 'field_options[options_' + fieldId + '][' + optKey + ']',
2642
  label = jQuery( 'input[name="' + baseName + '[label]"]' );
2643
 
2644
  if ( single.length < 1 ) {
2664
  saved = label.val();
2665
  }
2666
 
2667
+ if ( label.length < 1 ) {
2668
+ return;
2669
+ }
2670
+
2671
+ // Set the displayed value.
2672
+ text = single[0].childNodes;
2673
+
2674
+ if ( imagesAsOptions( fieldId ) ) {
2675
+ labelForDisplay = getImageDisplayValue( thisOpt, fieldId, label );
2676
+ optContainer = single.find( '.frm_image_option_container' );
2677
+
2678
+ if ( optContainer.length > 0 ) {
2679
+ optContainer.replaceWith( labelForDisplay );
2680
+ } else {
2681
+ text[ text.length - 1 ].nodeValue = '';
2682
+ single.append( labelForDisplay );
2683
+ }
2684
+ } else {
2685
  text[ text.length - 1 ].nodeValue = ' ' + label.val();
2686
+ }
2687
 
2688
+ // Set saved value.
2689
+ previewInput.val( saved );
2690
 
2691
+ // Set the default value.
2692
+ defaultVal = thisOpt.find( 'input[name^="default_value_"]' );
2693
+ previewInput.prop( 'checked', defaultVal.is( ':checked' ) ? true : false );
2694
+ }
2695
+
2696
+ /**
2697
+ * Set the displayed value for an image option.
2698
+ */
2699
+ function getImageDisplayValue( thisOpt, fieldId, label ) {
2700
+ var image, imageUrl, showLabelWithImage, fieldType;
2701
+
2702
+ image = thisOpt.find( 'img' );
2703
+ if ( image ) {
2704
+ imageUrl = image.attr( 'src' );
2705
+ }
2706
+
2707
+