Formidable Forms – Form Builder for WordPress - Version 2.0.23

Version Description

  • Add support for multiple reCaptchas on a page
  • Make sure the screen options for the form listings only shows when needed
  • Make sure a value is selected when it includes an &
  • Load grid CSS on the back-end entries and form builder pages
  • Allow transparent background color on fields and form
  • Don't update clear on click options until whole form is saved
  • Don't force an array to be a string before going through get_display_value function
  • Added frm_trigger_create_action hook to alter action triggering
  • Added frm_csv_format hook for changing the exported CSV format
  • Added frm_is_field_required hook for allowing a field to be conditionally required
  • Added frm_field_options_to_update hook for setting more field options to update
  • Added frm_display_FIELDTYPE_value_custom hook
  • Added frm_get_FIELDTYPE_display_value
  • Added frm_csv_field_columns hook. Once the columns are added, if a field value is an array, it will automatically fill added csv columns
  • Pro Features: *
  • Added straight up client-side validation
  • Added Credit card and Address field types. Enable the Credit card field with add_filter( 'frm_include_credit_card', '__return_true );
  • Allow actions to be triggered when a draft is saved
  • Allow free text in user id field filtering in views
  • Improved the unique filter in Views
  • Add Entry ID filter to all existing single entry Views instead of always checking for the entry param in the url
  • Allow "any" for the number step
  • Updated Chosen script to 1.5.1
  • Correctly check for multisite sitewide activation
  • Fixed the problem with the file upload attachment option not staying checked
  • Fixed filtering by entry ID and fields together in Views
  • Make sure the limit setting doesn't affect calendar Views, and show empty calendar for Calendar views with no entries
  • Make sure closing shortcodes in After Content are filtered
  • Make sure Dynamic List fields show up in default html email
  • Make sure we are jumping to the first field in the form after validation instead of the field with the lowest id
  • Fix field ID issue in repeating sections across pages
Download this release

Release Info

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

Code changes from version 2.0.22 to 2.0.23

Files changed (73) hide show
  1. classes/controllers/FrmAddonsController.php +3 -3
  2. classes/controllers/FrmAppController.php +7 -3
  3. classes/controllers/FrmEntriesController.php +28 -27
  4. classes/controllers/FrmFieldsController.php +31 -34
  5. classes/controllers/FrmFormActionsController.php +12 -7
  6. classes/controllers/FrmFormsController.php +58 -38
  7. classes/controllers/FrmStylesController.php +13 -11
  8. classes/controllers/FrmXMLController.php +13 -13
  9. classes/helpers/FrmAppHelper.php +28 -21
  10. classes/helpers/FrmCSVExportHelper.php +29 -10
  11. classes/helpers/FrmEntriesHelper.php +2 -0
  12. classes/helpers/FrmEntriesListHelper.php +9 -9
  13. classes/helpers/FrmFieldsHelper.php +52 -45
  14. classes/helpers/FrmFormsHelper.php +7 -7
  15. classes/helpers/FrmFormsListHelper.php +15 -14
  16. classes/helpers/FrmListHelper.php +1 -1
  17. classes/helpers/FrmStylesHelper.php +9 -9
  18. classes/helpers/FrmTipsHelper.php +34 -4
  19. classes/helpers/FrmXMLHelper.php +8 -8
  20. classes/models/FrmAddon.php +2 -2
  21. classes/models/FrmDb.php +24 -24
  22. classes/models/FrmEntry.php +48 -25
  23. classes/models/FrmEntryFormat.php +32 -11
  24. classes/models/FrmEntryMeta.php +20 -20
  25. classes/models/FrmEntryValidate.php +3 -2
  26. classes/models/FrmField.php +27 -27
  27. classes/models/FrmForm.php +23 -17
  28. classes/models/FrmFormAction.php +10 -6
  29. classes/models/FrmNotification.php +10 -9
  30. classes/models/FrmPointers.php +1 -1
  31. classes/models/FrmSettings.php +6 -1
  32. classes/models/FrmStyle.php +9 -9
  33. classes/views/addons/settings.php +2 -2
  34. classes/views/frm-entries/list.php +2 -2
  35. classes/views/frm-entries/new.php +2 -2
  36. classes/views/frm-entries/no_entries.php +2 -2
  37. classes/views/frm-entries/show.php +1 -1
  38. classes/views/frm-entries/sidebar-shared.php +8 -2
  39. classes/views/frm-entries/sidebar-show.php +7 -3
  40. classes/views/frm-fields/import_choices.php +2 -2
  41. classes/views/frm-fields/input.php +5 -4
  42. classes/views/frm-fields/radio.php +2 -2
  43. classes/views/frm-fields/show-build.php +5 -3
  44. classes/views/frm-form-actions/email_action.php +1 -1
  45. classes/views/frm-form-actions/form_action.php +3 -3
  46. classes/views/frm-forms/add_field.php +9 -5
  47. classes/views/frm-forms/add_field_links.php +14 -6
  48. classes/views/frm-forms/edit.php +3 -3
  49. classes/views/frm-forms/form.php +5 -5
  50. classes/views/frm-forms/new.php +4 -4
  51. classes/views/frm-forms/settings.php +20 -12
  52. classes/views/frm-forms/shortcode_opts.php +19 -12
  53. classes/views/frm-forms/sidebar-settings.php +2 -2
  54. classes/views/frm-settings/form.php +20 -10
  55. classes/views/frm-settings/license_box.php +1 -1
  56. classes/views/shared/mb_adv_info.php +7 -5
  57. classes/views/styles/_sample_form.php +6 -2
  58. classes/views/styles/custom_css.php +2 -2
  59. classes/views/styles/manage.php +4 -2
  60. classes/views/styles/show.php +3 -3
  61. classes/views/xml/import_form.php +4 -2
  62. classes/views/xml/xml.php +6 -6
  63. css/_single_theme.css.php +33 -32
  64. css/custom_theme.css.php +17 -246
  65. css/frm_admin.css +16 -9
  66. css/frm_grids.css +242 -0
  67. formidable.php +4 -4
  68. js/formidable.js +159 -37
  69. js/formidable.min.js +82 -76
  70. js/formidable_admin.js +18 -12
  71. languages/formidable-de_DE.po +1 -1
  72. languages/formidable-en_US.po +1388 -1121
  73. readme.txt +34 -1
classes/controllers/FrmAddonsController.php CHANGED
@@ -3,11 +3,11 @@
3
  class FrmAddonsController {
4
 
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
  }
13
 
@@ -91,7 +91,7 @@ class FrmAddonsController {
91
 
92
  $license = get_option('frmpro-credentials');
93
  if ( $license && is_array( $license ) && isset( $license['license'] ) ) {
94
- $url = 'http://formidablepro.com/frm-edd-api/licenses?l='. urlencode( base64_encode( $license['license'] ) );
95
  $licenses = self::send_api_request( $url, array( 'name' => 'frm_api_licence', 'expires' => 60 * 60 * 5 ) );
96
  echo json_encode( $licenses );
97
  }
3
  class FrmAddonsController {
4
 
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
  }
13
 
91
 
92
  $license = get_option('frmpro-credentials');
93
  if ( $license && is_array( $license ) && isset( $license['license'] ) ) {
94
+ $url = 'http://formidablepro.com/frm-edd-api/licenses?l=' . urlencode( base64_encode( $license['license'] ) );
95
  $licenses = self::send_api_request( $url, array( 'name' => 'frm_api_licence', 'expires' => 60 * 60 * 5 ) );
96
  echo json_encode( $licenses );
97
  }
classes/controllers/FrmAppController.php CHANGED
@@ -8,8 +8,8 @@ class FrmAppController {
8
  return;
9
  }
10
 
11
- $frm_settings = FrmAppHelper::get_settings();
12
- add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
  }
14
 
15
  private static function get_menu_position() {
@@ -133,7 +133,9 @@ class FrmAppController {
133
  $tip = FrmTipsHelper::get_banner_tip();
134
  ?>
135
  <div class="update-nag frm-update-to-pro">
136
- <?php echo FrmAppHelper::kses( $tip['tip'] ) ?> <span><?php echo FrmAppHelper::kses( $tip['call'] ) ?></span> <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com?banner=1&tip='. absint( $tip['num'] ) ) ) ?>" class="button">Upgrade to Pro</a>
 
 
137
  </div>
138
  <?php
139
  }
@@ -228,6 +230,7 @@ class FrmAppController {
228
  ), $version, true );
229
  wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
230
  wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
 
231
 
232
  // load multselect js
233
  wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
@@ -245,6 +248,7 @@ class FrmAppController {
245
  FrmAppHelper::localize_script( 'admin' );
246
 
247
  wp_enqueue_style( 'formidable-admin' );
 
248
  add_thickbox();
249
 
250
  wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
8
  return;
9
  }
10
 
11
+ $menu_name = FrmAppHelper::get_menu_name();
12
+ add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
  }
14
 
15
  private static function get_menu_position() {
133
  $tip = FrmTipsHelper::get_banner_tip();
134
  ?>
135
  <div class="update-nag frm-update-to-pro">
136
+ <?php echo FrmAppHelper::kses( $tip['tip'] ) ?>
137
+ <span><?php echo FrmAppHelper::kses( $tip['call'] ) ?></span>
138
+ <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com?banner=1&tip=' . absint( $tip['num'] ) ) ) ?>" class="button">Upgrade to Pro</a>
139
  </div>
140
  <?php
141
  }
230
  ), $version, true );
231
  wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
232
  wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
233
+ wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
234
 
235
  // load multselect js
236
  wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
248
  FrmAppHelper::localize_script( 'admin' );
249
 
250
  wp_enqueue_style( 'formidable-admin' );
251
+ wp_enqueue_style( 'formidable-grids' );
252
  add_thickbox();
253
 
254
  wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
classes/controllers/FrmEntriesController.php CHANGED
@@ -5,13 +5,13 @@ class FrmEntriesController {
5
  public static function menu() {
6
  FrmAppHelper::force_capability( 'frm_view_entries' );
7
 
8
- add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9
 
10
  if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11
- $frm_settings = FrmAppHelper::get_settings();
12
- add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13
- add_filter( 'get_user_option_manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14
- add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
  }
16
  }
17
 
@@ -52,13 +52,13 @@ class FrmEntriesController {
52
  $screen->add_help_tab( array(
53
  'id' => 'formidable-entries-tab',
54
  'title' => __( 'Overview', 'formidable' ),
55
- 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
  ));
57
 
58
  $screen->set_help_sidebar(
59
  '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60
  '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61
- '<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
  );
63
 
64
  return $help;
@@ -68,7 +68,7 @@ class FrmEntriesController {
68
  global $frm_vars, $wpdb;
69
  $form_id = FrmForm::get_current_form_id();
70
 
71
- $columns[ $form_id .'_id' ] = 'ID';
72
  $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
73
 
74
  if ( ! $form_id ) {
@@ -99,19 +99,19 @@ class FrmEntriesController {
99
  } else {
100
  $col_id = $form_col->field_key;
101
  if ( $form_col->form_id != $form_id ) {
102
- $col_id .= '-_-form'. $form_col->form_id;
103
  }
104
 
105
  if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
- $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
  }
108
- $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
  }
110
  }
111
 
112
- $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
113
- $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
114
- $columns[ $form_id .'_ip' ] = 'IP';
115
 
116
  $frm_vars['cols'] = $columns;
117
 
@@ -124,8 +124,9 @@ class FrmEntriesController {
124
  }
125
 
126
  public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127
- $frm_settings = FrmAppHelper::get_settings();
128
- if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
 
129
  return $check;
130
  }
131
 
@@ -142,10 +143,10 @@ class FrmEntriesController {
142
 
143
  //add hidden columns back from other forms
144
  public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
145
- $frm_settings = FrmAppHelper::get_settings();
146
-
147
- $sanitized = sanitize_title($frm_settings->menu);
148
- if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) {
149
  return;
150
  }
151
 
@@ -186,7 +187,7 @@ class FrmEntriesController {
186
 
187
  if ( $save ) {
188
  $user = wp_get_current_user();
189
- update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true );
190
  }
191
  }
192
 
@@ -261,10 +262,10 @@ class FrmEntriesController {
261
  $cols = $frm_vars['cols'];
262
  $cols = array_reverse($cols, true);
263
 
264
- $result[] = $form_id .'_id';
265
  $i--;
266
 
267
- $result[] = $form_id .'_item_key';
268
  $i--;
269
 
270
  foreach ( $cols as $col_key => $col ) {
@@ -321,7 +322,7 @@ class FrmEntriesController {
321
  $message = __( 'Your import is complete', 'formidable' );
322
  }
323
 
324
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
325
  }
326
 
327
  /* Back End CRUD */
@@ -346,7 +347,7 @@ class FrmEntriesController {
346
  $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
347
  $to_emails = array();
348
 
349
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
350
  }
351
 
352
  public static function destroy() {
@@ -357,7 +358,7 @@ class FrmEntriesController {
357
  if ( isset($params['keep_post']) && $params['keep_post'] ) {
358
  //unlink entry from post
359
  global $wpdb;
360
- $wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
361
  }
362
 
363
  $message = '';
@@ -561,6 +562,6 @@ class FrmEntriesController {
561
  $browser = FrmEntryFormat::get_browser( $data['browser'] );
562
  }
563
 
564
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
565
  }
566
  }
5
  public static function menu() {
6
  FrmAppHelper::force_capability( 'frm_view_entries' );
7
 
8
+ add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9
 
10
  if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11
+ $menu_name = FrmAppHelper::get_menu_name();
12
+ add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13
+ add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14
+ add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
  }
16
  }
17
 
52
  $screen->add_help_tab( array(
53
  'id' => 'formidable-entries-tab',
54
  'title' => __( 'Overview', 'formidable' ),
55
+ 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
  ));
57
 
58
  $screen->set_help_sidebar(
59
  '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60
  '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61
+ '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
  );
63
 
64
  return $help;
68
  global $frm_vars, $wpdb;
69
  $form_id = FrmForm::get_current_form_id();
70
 
71
+ $columns[ $form_id . '_id' ] = 'ID';
72
  $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
73
 
74
  if ( ! $form_id ) {
99
  } else {
100
  $col_id = $form_col->field_key;
101
  if ( $form_col->form_id != $form_id ) {
102
+ $col_id .= '-_-form' . $form_col->form_id;
103
  }
104
 
105
  if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
+ $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
  }
108
+ $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
  }
110
  }
111
 
112
+ $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
113
+ $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
114
+ $columns[ $form_id . '_ip' ] = 'IP';
115
 
116
  $frm_vars['cols'] = $columns;
117
 
124
  }
125
 
126
  public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127
+ $menu_name = FrmAppHelper::get_menu_name();
128
+ $this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
129
+ if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
130
  return $check;
131
  }
132
 
143
 
144
  //add hidden columns back from other forms
145
  public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
146
+ $menu_name = FrmAppHelper::get_menu_name();
147
+ $sanitized = sanitize_title( $menu_name );
148
+ $this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden';
149
+ if ( $meta_key != $this_page_name ) {
150
  return;
151
  }
152
 
187
 
188
  if ( $save ) {
189
  $user = wp_get_current_user();
190
+ update_user_option( $user->ID, $this_page_name, $meta_value, true );
191
  }
192
  }
193
 
262
  $cols = $frm_vars['cols'];
263
  $cols = array_reverse($cols, true);
264
 
265
+ $result[] = $form_id . '_id';
266
  $i--;
267
 
268
+ $result[] = $form_id . '_item_key';
269
  $i--;
270
 
271
  foreach ( $cols as $col_key => $col ) {
322
  $message = __( 'Your import is complete', 'formidable' );
323
  }
324
 
325
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
326
  }
327
 
328
  /* Back End CRUD */
347
  $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
348
  $to_emails = array();
349
 
350
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
351
  }
352
 
353
  public static function destroy() {
358
  if ( isset($params['keep_post']) && $params['keep_post'] ) {
359
  //unlink entry from post
360
  global $wpdb;
361
+ $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
362
  }
363
 
364
  $message = '';
562
  $browser = FrmEntryFormat::get_browser( $data['browser'] );
563
  }
564
 
565
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
566
  }
567
  }
classes/controllers/FrmFieldsController.php CHANGED
@@ -33,11 +33,11 @@ class FrmFieldsController {
33
  $field['value'] = '';
34
  }
35
 
36
- $field_name = 'item_meta['. $field_id .']';
37
  $html_id = FrmFieldsHelper::get_html_id($field);
38
 
39
  ob_start();
40
- include($path .'/classes/views/frm-forms/add_field.php');
41
  $field_html[ $field_id ] = ob_get_contents();
42
  ob_end_clean();
43
  }
@@ -141,20 +141,11 @@ class FrmFieldsController {
141
 
142
  $field = FrmField::getOne( $field_id );
143
 
144
- foreach ( array( 'clear_on_focus', 'separate_value', 'default_blank' ) as $val ) {
145
- if ( isset($_POST[ $val ]) ) {
146
- // all three of these options are boolean
147
- $new_val = FrmAppHelper::get_post_param( $val, 0, 'absint' );
148
-
149
- if ( $val == 'separate_value' ) {
150
- $new_val = FrmField::is_option_true( $field, $val ) ? 0 : 1;
151
- }
152
-
153
- $field->field_options[ $val ] = $new_val;
154
- unset($new_val);
155
- }
156
- unset($val);
157
- }
158
 
159
  FrmField::update( $field_id, array(
160
  'field_options' => $field->field_options,
@@ -177,13 +168,13 @@ class FrmFieldsController {
177
  wp_die();
178
  }
179
 
180
- do_action('frm_duplicate_field', $copy_field, $form_id);
181
- do_action('frm_duplicate_field_'. $copy_field->type, $copy_field, $form_id);
182
 
183
  $values = array( 'id' => $form_id );
184
  FrmFieldsHelper::fill_field( $values, $copy_field, $form_id );
185
 
186
- $field_count = FrmDb::get_count( $wpdb->prefix .'frm_fields fi LEFT JOIN '. $wpdb->prefix .'frm_forms fr ON (fi.form_id = fr.id)', array( 'or' => 1, 'fr.id' => $form_id, 'fr.parent_form_id' => $form_id ) );
187
 
188
  $values['field_order'] = $field_count + 1;
189
 
@@ -201,14 +192,14 @@ class FrmFieldsController {
201
  */
202
  public static function include_single_field( $field_id, $values, $form_id = 0 ) {
203
  $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id));
204
- $field_name = 'item_meta['. $field_id .']';
205
  $html_id = FrmFieldsHelper::get_html_id($field);
206
  $id = $form_id ? $form_id : $field['form_id'];
207
  if ( $field['type'] == 'html' ) {
208
  $field['stop_filter'] = true;
209
  }
210
 
211
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/add_field.php');
212
 
213
  return $field;
214
  }
@@ -258,7 +249,7 @@ class FrmFieldsController {
258
  if ( $first_opt != '' ) {
259
  $next_opt++;
260
  }
261
- $opt = esc_html__( 'Option', 'formidable' ) .' '. $next_opt;
262
  unset($next_opt);
263
  }
264
  $field_val = $opt;
@@ -276,14 +267,14 @@ class FrmFieldsController {
276
  'field_key' => $field_data->field_key,
277
  );
278
 
279
- $field_name = 'item_meta['. $id .']';
280
  $html_id = FrmFieldsHelper::get_html_id($field);
281
  $checked = '';
282
 
283
  if ( 'other' == $opt_type ) {
284
- require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
285
  } else {
286
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
287
  }
288
  wp_die();
289
  }
@@ -413,10 +404,10 @@ class FrmFieldsController {
413
  $field = FrmField::getOne($field_id);
414
 
415
  wp_enqueue_script( 'utils' );
416
- wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url(). '/css/frm_admin.css' );
417
  FrmAppHelper::load_admin_wide_js();
418
 
419
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/import_choices.php');
420
  wp_die();
421
  }
422
 
@@ -474,7 +465,7 @@ class FrmFieldsController {
474
  $html_id = FrmFieldsHelper::get_html_id( $field );
475
 
476
  if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) {
477
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/radio.php');
478
  } else {
479
  FrmFieldsHelper::show_single_option($field);
480
  }
@@ -551,7 +542,7 @@ class FrmFieldsController {
551
  self::add_html_size($field, $add_html);
552
  self::add_html_length($field, $add_html);
553
  self::add_html_placeholder($field, $add_html, $class);
554
- //self::add_validation_messages( $field, $add_html ); uncomment this when the js validation is complete
555
 
556
  $class = apply_filters('frm_field_classes', implode(' ', $class), $field);
557
 
@@ -603,7 +594,7 @@ class FrmFieldsController {
603
 
604
  $important = apply_filters('frm_use_important_width', 1, $field);
605
  // Note: This inline styling must stay since we cannot realistically set a class for every possible field size
606
- $add_html['style'] = 'style="width:'. esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) .'"';
607
 
608
  self::add_html_cols($field, $add_html);
609
  }
@@ -652,23 +643,29 @@ class FrmFieldsController {
652
  return;
653
  }
654
 
 
655
  if ( ! FrmField::is_option_true( $field, 'clear_on_focus' ) ) {
656
- if ( is_array( $field['default_value'] ) ) {
657
  $field['default_value'] = json_encode( $field['default_value'] );
658
  }
659
  $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $field['default_value'] ) . '"';
660
  return;
661
  }
662
 
 
 
 
 
 
663
  $frm_settings = FrmAppHelper::get_settings();
664
 
665
  if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) {
666
  // use HMTL5 placeholder with js fallback
667
- $add_html['placeholder'] = 'placeholder="'. esc_attr($field['default_value']) .'"';
668
  wp_enqueue_script('jquery-placeholder');
669
  } else if ( ! $frm_settings->use_html ) {
670
  $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( '&#039;', "'", esc_attr( $field['default_value'] ) ) ) );
671
- $add_html['data-frmval'] = 'data-frmval="'. esc_attr($val) .'"';
672
  $class[] = 'frm_toggle_default';
673
 
674
  if ( $field['value'] == $field['default_value'] ) {
@@ -709,7 +706,7 @@ class FrmFieldsController {
709
  if ( is_numeric($k) && strpos($v, '=') ) {
710
  $add_html[] = $v;
711
  } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
712
- $add_html[ $k ] = str_replace( $k .'="', $k .'="'. $v, $add_html[ $k ] );
713
  } else {
714
  $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
715
  }
33
  $field['value'] = '';
34
  }
35
 
36
+ $field_name = 'item_meta[' . $field_id . ']';
37
  $html_id = FrmFieldsHelper::get_html_id($field);
38
 
39
  ob_start();
40
+ include( $path . '/classes/views/frm-forms/add_field.php' );
41
  $field_html[ $field_id ] = ob_get_contents();
42
  ob_end_clean();
43
  }
141
 
142
  $field = FrmField::getOne( $field_id );
143
 
144
+ if ( isset( $_POST['separate_value'] ) ) {
145
+ $new_val = FrmField::is_option_true( $field, 'separate_value' ) ? 0 : 1;
146
+ $field->field_options['separate_value'] = $new_val;
147
+ unset($new_val);
148
+ }
 
 
 
 
 
 
 
 
 
149
 
150
  FrmField::update( $field_id, array(
151
  'field_options' => $field->field_options,
168
  wp_die();
169
  }
170
 
171
+ do_action( 'frm_duplicate_field', $copy_field, $form_id );
172
+ do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id );
173
 
174
  $values = array( 'id' => $form_id );
175
  FrmFieldsHelper::fill_field( $values, $copy_field, $form_id );
176
 
177
+ $field_count = FrmDb::get_count( $wpdb->prefix . 'frm_fields fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id)', array( 'or' => 1, 'fr.id' => $form_id, 'fr.parent_form_id' => $form_id ) );
178
 
179
  $values['field_order'] = $field_count + 1;
180
 
192
  */
193
  public static function include_single_field( $field_id, $values, $form_id = 0 ) {
194
  $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id));
195
+ $field_name = 'item_meta[' . $field_id . ']';
196
  $html_id = FrmFieldsHelper::get_html_id($field);
197
  $id = $form_id ? $form_id : $field['form_id'];
198
  if ( $field['type'] == 'html' ) {
199
  $field['stop_filter'] = true;
200
  }
201
 
202
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php' );
203
 
204
  return $field;
205
  }
249
  if ( $first_opt != '' ) {
250
  $next_opt++;
251
  }
252
+ $opt = esc_html__( 'Option', 'formidable' ) . ' ' . $next_opt;
253
  unset($next_opt);
254
  }
255
  $field_val = $opt;
267
  'field_key' => $field_data->field_key,
268
  );
269
 
270
+ $field_name = 'item_meta[' . $id . ']';
271
  $html_id = FrmFieldsHelper::get_html_id($field);
272
  $checked = '';
273
 
274
  if ( 'other' == $opt_type ) {
275
+ require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
276
  } else {
277
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
278
  }
279
  wp_die();
280
  }
404
  $field = FrmField::getOne($field_id);
405
 
406
  wp_enqueue_script( 'utils' );
407
+ wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' );
408
  FrmAppHelper::load_admin_wide_js();
409
 
410
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php' );
411
  wp_die();
412
  }
413
 
465
  $html_id = FrmFieldsHelper::get_html_id( $field );
466
 
467
  if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) {
468
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' );
469
  } else {
470
  FrmFieldsHelper::show_single_option($field);
471
  }
542
  self::add_html_size($field, $add_html);
543
  self::add_html_length($field, $add_html);
544
  self::add_html_placeholder($field, $add_html, $class);
545
+ self::add_validation_messages( $field, $add_html );
546
 
547
  $class = apply_filters('frm_field_classes', implode(' ', $class), $field);
548
 
594
 
595
  $important = apply_filters('frm_use_important_width', 1, $field);
596
  // Note: This inline styling must stay since we cannot realistically set a class for every possible field size
597
+ $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"';
598
 
599
  self::add_html_cols($field, $add_html);
600
  }
643
  return;
644
  }
645
 
646
+ $default_value_array = is_array( $field['default_value'] );
647
  if ( ! FrmField::is_option_true( $field, 'clear_on_focus' ) ) {
648
+ if ( $default_value_array ) {
649
  $field['default_value'] = json_encode( $field['default_value'] );
650
  }
651
  $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $field['default_value'] ) . '"';
652
  return;
653
  }
654
 
655
+ if ( $default_value_array ) {
656
+ // don't include a json placeholder
657
+ return;
658
+ }
659
+
660
  $frm_settings = FrmAppHelper::get_settings();
661
 
662
  if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) {
663
  // use HMTL5 placeholder with js fallback
664
+ $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"';
665
  wp_enqueue_script('jquery-placeholder');
666
  } else if ( ! $frm_settings->use_html ) {
667
  $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( '&#039;', "'", esc_attr( $field['default_value'] ) ) ) );
668
+ $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $val ) . '"';
669
  $class[] = 'frm_toggle_default';
670
 
671
  if ( $field['value'] == $field['default_value'] ) {
706
  if ( is_numeric($k) && strpos($v, '=') ) {
707
  $add_html[] = $v;
708
  } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
709
+ $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
710
  } else {
711
  $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
712
  }
classes/controllers/FrmFormActionsController.php CHANGED
@@ -133,7 +133,7 @@ class FrmFormActionsController {
133
 
134
  public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
135
  $action_control->_set($action_key);
136
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
137
  }
138
 
139
  public static function add_form_action() {
@@ -155,7 +155,7 @@ class FrmFormActionsController {
155
  $values = array();
156
  $form = self::fields_to_values($form_id, $values);
157
 
158
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
159
  wp_die();
160
  }
161
 
@@ -176,7 +176,7 @@ class FrmFormActionsController {
176
  $values = array();
177
  $form = self::fields_to_values($form_action->menu_order, $values);
178
 
179
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/_action_inside.php');
180
  wp_die();
181
  }
182
 
@@ -234,7 +234,12 @@ class FrmFormActionsController {
234
  }
235
 
236
  public static function trigger_create_actions( $entry_id, $form_id, $args = array() ) {
237
- self::trigger_actions( 'create', $form_id, $entry_id, 'all', $args );
 
 
 
 
 
238
  }
239
 
240
  /**
@@ -268,7 +273,7 @@ class FrmFormActionsController {
268
  $entry = FrmEntry::getOne( $entry, true );
269
  }
270
 
271
- if ( empty( $entry ) || $entry->is_draft ) {
272
  continue;
273
  }
274
 
@@ -300,8 +305,8 @@ class FrmFormActionsController {
300
 
301
  foreach ( $action_priority as $action_id => $priority ) {
302
  $action = $stored_actions[ $action_id ];
303
- do_action('frm_trigger_'. $action->post_excerpt .'_action', $action, $entry, $form, $event);
304
- do_action('frm_trigger_'. $action->post_excerpt .'_'. $event .'_action', $action, $entry, $form);
305
 
306
  // If post is created, get updated $entry object
307
  if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
133
 
134
  public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
135
  $action_control->_set($action_key);
136
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
137
  }
138
 
139
  public static function add_form_action() {
155
  $values = array();
156
  $form = self::fields_to_values($form_id, $values);
157
 
158
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
159
  wp_die();
160
  }
161
 
176
  $values = array();
177
  $form = self::fields_to_values($form_action->menu_order, $values);
178
 
179
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
180
  wp_die();
181
  }
182
 
234
  }
235
 
236
  public static function trigger_create_actions( $entry_id, $form_id, $args = array() ) {
237
+ $filter_args = $args;
238
+ $filter_args['entry_id'] = $entry_id;
239
+ $filter_args['form_id'] = $form_id;
240
+ $event = apply_filters( 'frm_trigger_create_action', 'create', $args );
241
+
242
+ self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
243
  }
244
 
245
  /**
273
  $entry = FrmEntry::getOne( $entry, true );
274
  }
275
 
276
+ if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
277
  continue;
278
  }
279
 
305
 
306
  foreach ( $action_priority as $action_id => $priority ) {
307
  $action = $stored_actions[ $action_id ];
308
+ do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
309
+ do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
310
 
311
  // If post is created, get updated $entry object
312
  if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
classes/controllers/FrmFormsController.php CHANGED
@@ -7,13 +7,22 @@ class FrmFormsController {
7
  if ( ! FrmAppHelper::pro_is_installed() ) {
8
  $menu_label .= ' (Lite)';
9
  }
10
- add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11
 
12
- add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
 
 
 
 
 
 
 
 
 
13
 
14
- add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15
  add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
16
- }
17
 
18
  public static function head() {
19
  wp_enqueue_script('formidable-editinplace');
@@ -61,7 +70,7 @@ class FrmFormsController {
61
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
62
 
63
  $values['id'] = $id;
64
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
65
  }
66
  }
67
 
@@ -96,10 +105,11 @@ class FrmFormsController {
96
  $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
97
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
98
 
99
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
100
  } else {
101
  FrmForm::update( $id, $values, true );
102
- die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
 
103
  }
104
  }
105
 
@@ -258,14 +268,14 @@ class FrmFormsController {
258
  if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
259
  global $wp;
260
  $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
261
- include_once( $root.'/wp-config.php' );
262
  $wp->init();
263
  $wp->register_globals();
264
  }
265
 
266
  self::register_pro_scripts();
267
 
268
- header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
269
 
270
  $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
271
  if ( $key == '' ) {
@@ -277,7 +287,7 @@ class FrmFormsController {
277
  $form = FrmForm::getAll( array(), '', 1 );
278
  }
279
 
280
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
281
  wp_die();
282
  }
283
 
@@ -285,7 +295,7 @@ class FrmFormsController {
285
  if ( FrmAppHelper::pro_is_installed() ) {
286
  wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true );
287
  wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true );
288
- wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() .'/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
289
  }
290
  }
291
 
@@ -326,7 +336,7 @@ class FrmFormsController {
326
  $params = FrmForm::list_page_params();
327
 
328
  //check nonce url
329
- check_admin_referer($status .'_form_' . $params['id']);
330
 
331
  $count = 0;
332
  if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
@@ -334,7 +344,7 @@ class FrmFormsController {
334
  }
335
 
336
  $available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
337
- $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type='. ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
338
 
339
  $message = $available_status[ $status ]['message'];
340
 
@@ -352,7 +362,7 @@ class FrmFormsController {
352
  }
353
 
354
  $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
355
- $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' );
356
 
357
  return $message;
358
  }
@@ -418,8 +428,10 @@ class FrmFormsController {
418
  */
419
  public static function insert_form_button() {
420
  if ( current_user_can('frm_view_forms') ) {
421
- $frm_settings = FrmAppHelper::get_settings();
422
- $content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"><span class="frm-buttons-icon wp-media-buttons-icon"></span> '. $frm_settings->menu .'</a>';
 
 
423
  echo wp_kses_post( $content );
424
  }
425
  }
@@ -438,7 +450,7 @@ class FrmFormsController {
438
 
439
  $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
440
 
441
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
442
  }
443
 
444
  public static function get_shortcode_opts() {
@@ -450,8 +462,8 @@ class FrmFormsController {
450
  wp_die();
451
  }
452
 
453
- echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
454
- echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
455
 
456
  $form_id = '';
457
  $opts = array();
@@ -474,7 +486,7 @@ class FrmFormsController {
474
  unset( $opts['form_id'] );
475
  }
476
 
477
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
478
 
479
  echo '</div>';
480
 
@@ -506,7 +518,7 @@ class FrmFormsController {
506
  die();
507
  }
508
 
509
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
510
  }
511
 
512
  public static function get_columns( $columns ) {
@@ -583,7 +595,7 @@ class FrmFormsController {
583
  }
584
 
585
  if ( $form->parent_form_id ) {
586
- wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id='. $form->parent_form_id ) ) . '">', '</a>' ));
587
  }
588
 
589
  $frm_field_selection = FrmField::field_selection();
@@ -613,9 +625,9 @@ class FrmFormsController {
613
  } else if ( defined('DOING_AJAX') ) {
614
  wp_die();
615
  } else if ( $create_link ) {
616
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
617
  } else {
618
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
619
  }
620
  }
621
 
@@ -640,7 +652,7 @@ class FrmFormsController {
640
 
641
  $styles = apply_filters('frm_get_style_opts', array());
642
 
643
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
644
  }
645
 
646
  public static function mb_tags_box( $form_id, $class = '' ) {
@@ -829,10 +841,10 @@ class FrmFormsController {
829
  _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
830
 
831
  $path = untrailingslashit(trim($path));
832
- $templates = glob( $path .'/*.php' );
833
 
834
  for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
835
- $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
836
  $template_query = array( 'form_key' => $filename );
837
  if ( $template ) {
838
  $template_query['is_template'] = 1;
@@ -916,8 +928,8 @@ class FrmFormsController {
916
  case 'update_settings':
917
  return self::$action( $vars );
918
  default:
919
- do_action('frm_form_action_'. $action);
920
- if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
921
  return;
922
  }
923
 
@@ -976,14 +988,14 @@ class FrmFormsController {
976
  if ( count($actions) == 1 ) {
977
  $wp_admin_bar->add_menu( array(
978
  'title' => 'Edit Form',
979
- 'href' => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
980
  'id' => 'frm-forms',
981
  ) );
982
  } else {
983
  $wp_admin_bar->add_menu( array(
984
  'id' => 'frm-forms',
985
  'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
986
- 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
987
  'meta' => array(
988
  'title' => __( 'Edit Forms', 'formidable' ),
989
  ),
@@ -993,7 +1005,7 @@ class FrmFormsController {
993
 
994
  $wp_admin_bar->add_menu( array(
995
  'parent' => 'frm-forms',
996
- 'id' => 'edit_form_'. $form_id,
997
  'title' => empty($name) ? __( '(no title)') : $name,
998
  'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
999
  ) );
@@ -1011,7 +1023,7 @@ class FrmFormsController {
1011
  $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1012
  }
1013
  }
1014
- return $sc .']';
1015
  }
1016
 
1017
  $shortcode_atts = shortcode_atts( array(
@@ -1124,14 +1136,14 @@ class FrmFormsController {
1124
  do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1125
  if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1126
  $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1127
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1128
  }
1129
  return;
1130
  }
1131
 
1132
  if ( ! empty($errors) ) {
1133
  $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1134
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1135
  return;
1136
  }
1137
 
@@ -1165,13 +1177,13 @@ class FrmFormsController {
1165
  $message = apply_filters('frm_main_feedback', $message, $form, $created);
1166
 
1167
  if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1168
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1169
  } else {
1170
  global $frm_vars;
1171
  self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1172
 
1173
- $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1174
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1175
  }
1176
 
1177
  do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
@@ -1182,6 +1194,7 @@ class FrmFormsController {
1182
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
1183
  wp_register_script( 'formidable', FrmAppHelper::plugin_url() . "/js/formidable{$suffix}.js", array( 'jquery' ), $version, true );
1184
  wp_register_script( 'jquery-placeholder', FrmAppHelper::plugin_url() . '/js/jquery/jquery.placeholder.js', array( 'jquery' ), '2.0.7', true );
 
1185
 
1186
  if ( FrmAppHelper::is_admin() ) {
1187
  // don't load this in back-end
@@ -1202,6 +1215,13 @@ class FrmFormsController {
1202
  }
1203
  }
1204
 
 
 
 
 
 
 
 
1205
  public static function footer_js( $location = 'footer' ) {
1206
  global $frm_vars;
1207
 
7
  if ( ! FrmAppHelper::pro_is_installed() ) {
8
  $menu_label .= ' (Lite)';
9
  }
10
+ add_submenu_page('formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11
 
12
+ self::maybe_load_listing_hooks();
13
+ }
14
+
15
+ public static function maybe_load_listing_hooks() {
16
+ $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
17
+ if ( ! empty( $action ) && ! in_array( $action, array( 'list', 'trash', 'untrash' ) ) ) {
18
+ return;
19
+ }
20
+
21
+ add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
22
 
23
+ add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
24
  add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25
+ }
26
 
27
  public static function head() {
28
  wp_enqueue_script('formidable-editinplace');
70
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
71
 
72
  $values['id'] = $id;
73
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
74
  }
75
  }
76
 
105
  $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
106
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
107
 
108
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
109
  } else {
110
  FrmForm::update( $id, $values, true );
111
+ $url = admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id );
112
+ die( FrmAppHelper::js_redirect( $url ) );
113
  }
114
  }
115
 
268
  if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
269
  global $wp;
270
  $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
271
+ include_once( $root . '/wp-config.php' );
272
  $wp->init();
273
  $wp->register_globals();
274
  }
275
 
276
  self::register_pro_scripts();
277
 
278
+ header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
279
 
280
  $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
281
  if ( $key == '' ) {
287
  $form = FrmForm::getAll( array(), '', 1 );
288
  }
289
 
290
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
291
  wp_die();
292
  }
293
 
295
  if ( FrmAppHelper::pro_is_installed() ) {
296
  wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true );
297
  wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true );
298
+ wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() . '/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.5.1', true );
299
  }
300
  }
301
 
336
  $params = FrmForm::list_page_params();
337
 
338
  //check nonce url
339
+ check_admin_referer( $status . '_form_' . $params['id'] );
340
 
341
  $count = 0;
342
  if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
344
  }
345
 
346
  $available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
347
+ $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
348
 
349
  $message = $available_status[ $status ]['message'];
350
 
362
  }
363
 
364
  $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
365
+ $message = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type=' . $current_page . '&item-action[]=' . implode( 'item-action[]=', $ids ), 'bulk-toplevel_page_formidable' ) ) . '">', '</a>' );
366
 
367
  return $message;
368
  }
428
  */
429
  public static function insert_form_button() {
430
  if ( current_user_can('frm_view_forms') ) {
431
+ $menu_name = FrmAppHelper::get_menu_name();
432
+ $content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '">
433
+ <span class="frm-buttons-icon wp-media-buttons-icon"></span> ' .
434
+ $menu_name . '</a>';
435
  echo wp_kses_post( $content );
436
  }
437
  }
450
 
451
  $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
452
 
453
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
454
  }
455
 
456
  public static function get_shortcode_opts() {
462
  wp_die();
463
  }
464
 
465
+ echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
466
+ echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
467
 
468
  $form_id = '';
469
  $opts = array();
486
  unset( $opts['form_id'] );
487
  }
488
 
489
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
490
 
491
  echo '</div>';
492
 
518
  die();
519
  }
520
 
521
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
522
  }
523
 
524
  public static function get_columns( $columns ) {
595
  }
596
 
597
  if ( $form->parent_form_id ) {
598
+ wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' ));
599
  }
600
 
601
  $frm_field_selection = FrmField::field_selection();
625
  } else if ( defined('DOING_AJAX') ) {
626
  wp_die();
627
  } else if ( $create_link ) {
628
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
629
  } else {
630
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
631
  }
632
  }
633
 
652
 
653
  $styles = apply_filters('frm_get_style_opts', array());
654
 
655
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
656
  }
657
 
658
  public static function mb_tags_box( $form_id, $class = '' ) {
841
  _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
842
 
843
  $path = untrailingslashit(trim($path));
844
+ $templates = glob( $path . '/*.php' );
845
 
846
  for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
847
+ $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[ $i ] ) );
848
  $template_query = array( 'form_key' => $filename );
849
  if ( $template ) {
850
  $template_query['is_template'] = 1;
928
  case 'update_settings':
929
  return self::$action( $vars );
930
  default:
931
+ do_action( 'frm_form_action_' . $action );
932
+ if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
933
  return;
934
  }
935
 
988
  if ( count($actions) == 1 ) {
989
  $wp_admin_bar->add_menu( array(
990
  'title' => 'Edit Form',
991
+ 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
992
  'id' => 'frm-forms',
993
  ) );
994
  } else {
995
  $wp_admin_bar->add_menu( array(
996
  'id' => 'frm-forms',
997
  'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
998
+ 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
999
  'meta' => array(
1000
  'title' => __( 'Edit Forms', 'formidable' ),
1001
  ),
1005
 
1006
  $wp_admin_bar->add_menu( array(
1007
  'parent' => 'frm-forms',
1008
+ 'id' => 'edit_form_' . $form_id,
1009
  'title' => empty($name) ? __( '(no title)') : $name,
1010
  'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
1011
  ) );
1023
  $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1024
  }
1025
  }
1026
+ return $sc . ']';
1027
  }
1028
 
1029
  $shortcode_atts = shortcode_atts( array(
1136
  do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1137
  if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1138
  $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1139
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1140
  }
1141
  return;
1142
  }
1143
 
1144
  if ( ! empty($errors) ) {
1145
  $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1146
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1147
  return;
1148
  }
1149
 
1177
  $message = apply_filters('frm_main_feedback', $message, $form, $created);
1178
 
1179
  if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1180
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1181
  } else {
1182
  global $frm_vars;
1183
  self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1184
 
1185
+ $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values );
1186
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
1187
  }
1188
 
1189
  do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1194
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
1195
  wp_register_script( 'formidable', FrmAppHelper::plugin_url() . "/js/formidable{$suffix}.js", array( 'jquery' ), $version, true );
1196
  wp_register_script( 'jquery-placeholder', FrmAppHelper::plugin_url() . '/js/jquery/jquery.placeholder.js', array( 'jquery' ), '2.0.7', true );
1197
+ add_filter( 'script_loader_tag', 'FrmFormsController::defer_script_loading', 10, 2 );
1198
 
1199
  if ( FrmAppHelper::is_admin() ) {
1200
  // don't load this in back-end
1215
  }
1216
  }
1217
 
1218
+ public static function defer_script_loading( $tag, $handle ) {
1219
+ if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1220
+ $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1221
+ }
1222
+ return $tag;
1223
+ }
1224
+
1225
  public static function footer_js( $location = 'footer' ) {
1226
  global $frm_vars;
1227
 
classes/controllers/FrmStylesController.php CHANGED
@@ -41,7 +41,7 @@ class FrmStylesController {
41
  }
42
 
43
  public static function menu() {
44
- add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route');
45
  }
46
 
47
  public static function admin_init() {
@@ -59,13 +59,15 @@ class FrmStylesController {
59
 
60
  $style = apply_filters('frm_style_head', false);
61
  if ( $style ) {
62
- wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) .'&'. http_build_query( $style->post_content ) );
63
  }
64
  }
65
 
66
  public static function enqueue_css( $register = 'enqueue' ) {
67
  global $frm_vars;
 
68
  $register_css = ( $register == 'register' );
 
69
  if ( ( $frm_vars['load_css'] || $register_css ) && ! FrmAppHelper::is_admin() ) {
70
  $frm_settings = FrmAppHelper::get_settings();
71
  if ( $frm_settings->load_style == 'none' ) {
@@ -78,7 +80,7 @@ class FrmStylesController {
78
  $version = FrmAppHelper::plugin_version();
79
 
80
  foreach ( (array) $css as $css_key => $file ) {
81
- if ( $register == 'register' ) {
82
  $this_version = self::get_css_version( $css_key, $version );
83
  wp_register_style( $css_key, $file, array(), $this_version );
84
  }
@@ -201,7 +203,7 @@ class FrmStylesController {
201
 
202
  self::add_meta_boxes();
203
 
204
- include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php');
205
  }
206
 
207
  /**
@@ -217,7 +219,7 @@ class FrmStylesController {
217
  $forms = FrmForm::get_published_forms();
218
  }
219
 
220
- include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php');
221
  }
222
 
223
  private static function manage_styles() {
@@ -254,7 +256,7 @@ class FrmStylesController {
254
  $style = $frm_style->get_default_style();
255
  }
256
 
257
- include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php');
258
  }
259
 
260
  public static function save_css() {
@@ -321,7 +323,7 @@ class FrmStylesController {
321
  }
322
 
323
  echo '<style type="text/css">';
324
- include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
325
  echo '</style>';
326
  wp_die();
327
  }
@@ -345,7 +347,7 @@ class FrmStylesController {
345
  );
346
 
347
  foreach ( $meta_boxes as $nicename => $name ) {
348
- add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
349
  unset($nicename, $name);
350
  }
351
  }
@@ -353,7 +355,7 @@ class FrmStylesController {
353
  public static function include_style_section( $atts, $sec ) {
354
  extract($atts);
355
  $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
356
- include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php');
357
  }
358
 
359
  public static function load_css() {
@@ -362,7 +364,7 @@ class FrmStylesController {
362
  $frm_style = new FrmStyle();
363
  $defaults = $frm_style->get_defaults();
364
 
365
- include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
366
  wp_die();
367
  }
368
 
@@ -425,7 +427,7 @@ class FrmStylesController {
425
  $style = $frm_style->get_one();
426
 
427
  if ( $style ) {
428
- $class .= ' frm_style_'. $style->post_name;
429
  }
430
 
431
  return $class;
41
  }
42
 
43
  public static function menu() {
44
+ add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
45
  }
46
 
47
  public static function admin_init() {
59
 
60
  $style = apply_filters('frm_style_head', false);
61
  if ( $style ) {
62
+ wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) );
63
  }
64
  }
65
 
66
  public static function enqueue_css( $register = 'enqueue' ) {
67
  global $frm_vars;
68
+
69
  $register_css = ( $register == 'register' );
70
+
71
  if ( ( $frm_vars['load_css'] || $register_css ) && ! FrmAppHelper::is_admin() ) {
72
  $frm_settings = FrmAppHelper::get_settings();
73
  if ( $frm_settings->load_style == 'none' ) {
80
  $version = FrmAppHelper::plugin_version();
81
 
82
  foreach ( (array) $css as $css_key => $file ) {
83
+ if ( $register_css ) {
84
  $this_version = self::get_css_version( $css_key, $version );
85
  wp_register_style( $css_key, $file, array(), $this_version );
86
  }
203
 
204
  self::add_meta_boxes();
205
 
206
+ include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' );
207
  }
208
 
209
  /**
219
  $forms = FrmForm::get_published_forms();
220
  }
221
 
222
+ include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' );
223
  }
224
 
225
  private static function manage_styles() {
256
  $style = $frm_style->get_default_style();
257
  }
258
 
259
+ include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' );
260
  }
261
 
262
  public static function save_css() {
323
  }
324
 
325
  echo '<style type="text/css">';
326
+ include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
327
  echo '</style>';
328
  wp_die();
329
  }
347
  );
348
 
349
  foreach ( $meta_boxes as $nicename => $name ) {
350
+ add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
351
  unset($nicename, $name);
352
  }
353
  }
355
  public static function include_style_section( $atts, $sec ) {
356
  extract($atts);
357
  $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
358
+ include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' );
359
  }
360
 
361
  public static function load_css() {
364
  $frm_style = new FrmStyle();
365
  $defaults = $frm_style->get_defaults();
366
 
367
+ include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
368
  wp_die();
369
  }
370
 
427
  $style = $frm_style->get_one();
428
 
429
  if ( $style ) {
430
+ $class .= ' frm_style_' . $style->post_name;
431
  }
432
 
433
  return $class;
classes/controllers/FrmXMLController.php CHANGED
@@ -3,7 +3,7 @@
3
  class FrmXMLController {
4
 
5
  public static function menu() {
6
- add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route');
7
  }
8
 
9
  public static function add_default_templates() {
@@ -64,7 +64,7 @@ class FrmXMLController {
64
  'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ),
65
  ) );
66
 
67
- include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php');
68
  }
69
 
70
  public static function import_xml() {
@@ -102,7 +102,7 @@ class FrmXMLController {
102
  $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
103
  if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
104
  // allow other file types to be imported
105
- do_action('frm_before_import_'. $file_type );
106
  return;
107
  }
108
  unset($file_type);
@@ -147,7 +147,7 @@ class FrmXMLController {
147
  } if ( $format == 'csv' ) {
148
  self::generate_csv( compact('ids') );
149
  } else {
150
- do_action('frm_export_format_'. $format, compact('ids'));
151
  }
152
 
153
  wp_die();
@@ -168,8 +168,8 @@ class FrmXMLController {
168
  }
169
 
170
  $tables = array(
171
- 'items' => $wpdb->prefix .'frm_items',
172
- 'forms' => $wpdb->prefix .'frm_forms',
173
  'posts' => $wpdb->posts,
174
  'styles' => $wpdb->posts,
175
  'actions' => $wpdb->posts,
@@ -201,20 +201,20 @@ class FrmXMLController {
201
  $join = '';
202
  $table = $tables[ $tb_type ];
203
 
204
- $select = $table .'.id';
205
  $query_vars = array();
206
 
207
  switch ( $tb_type ) {
208
  case 'forms':
209
  //add forms
210
  if ( $args['ids'] ) {
211
- $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] );
212
  } else {
213
  $where[ $table . '.status !' ] = 'draft';
214
  }
215
  break;
216
  case 'actions':
217
- $select = $table .'.ID';
218
  $where['post_type'] = FrmFormActionsController::$action_post_type;
219
  if ( ! empty($args['ids']) ) {
220
  $where['menu_order'] = $args['ids'];
@@ -238,7 +238,7 @@ class FrmXMLController {
238
  }
239
  unset( $form_id, $form_data );
240
  }
241
- $select = $table .'.ID';
242
  $where['post_type'] = 'frm_styles';
243
 
244
  // Only export selected styles
@@ -247,7 +247,7 @@ class FrmXMLController {
247
  }
248
  break;
249
  default:
250
- $select = $table .'.ID';
251
  $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
252
  $where['pm.meta_key'] = 'frm_form_id';
253
 
@@ -264,7 +264,7 @@ class FrmXMLController {
264
  }
265
 
266
  echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
267
- include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php');
268
  }
269
 
270
 
@@ -323,7 +323,7 @@ class FrmXMLController {
323
  */
324
  $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) );
325
 
326
- $entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query );
327
  unset( $query );
328
 
329
  if ( empty( $entry_ids ) ) {
3
  class FrmXMLController {
4
 
5
  public static function menu() {
6
+ add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' );
7
  }
8
 
9
  public static function add_default_templates() {
64
  'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ),
65
  ) );
66
 
67
+ include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' );
68
  }
69
 
70
  public static function import_xml() {
102
  $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
103
  if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
104
  // allow other file types to be imported
105
+ do_action( 'frm_before_import_' . $file_type );
106
  return;
107
  }
108
  unset($file_type);
147
  } if ( $format == 'csv' ) {
148
  self::generate_csv( compact('ids') );
149
  } else {
150
+ do_action( 'frm_export_format_' . $format, compact('ids') );
151
  }
152
 
153
  wp_die();
168
  }
169
 
170
  $tables = array(
171
+ 'items' => $wpdb->prefix . 'frm_items',
172
+ 'forms' => $wpdb->prefix . 'frm_forms',
173
  'posts' => $wpdb->posts,
174
  'styles' => $wpdb->posts,
175
  'actions' => $wpdb->posts,
201
  $join = '';
202
  $table = $tables[ $tb_type ];
203
 
204
+ $select = $table . '.id';
205
  $query_vars = array();
206
 
207
  switch ( $tb_type ) {
208
  case 'forms':
209
  //add forms
210
  if ( $args['ids'] ) {
211
+ $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] );
212
  } else {
213
  $where[ $table . '.status !' ] = 'draft';
214
  }
215
  break;
216
  case 'actions':
217
+ $select = $table . '.ID';
218
  $where['post_type'] = FrmFormActionsController::$action_post_type;
219
  if ( ! empty($args['ids']) ) {
220
  $where['menu_order'] = $args['ids'];
238
  }
239
  unset( $form_id, $form_data );
240
  }
241
+ $select = $table . '.ID';
242
  $where['post_type'] = 'frm_styles';
243
 
244
  // Only export selected styles
247
  }
248
  break;
249
  default:
250
+ $select = $table . '.ID';
251
  $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
252
  $where['pm.meta_key'] = 'frm_form_id';
253
 
264
  }
265
 
266
  echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
267
+ include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
268
  }
269
 
270
 
323
  */
324
  $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) );
325
 
326
+ $entry_ids = FrmDb::get_col( $wpdb->prefix . 'frm_items it', $query );
327
  unset( $query );
328
 
329
  if ( empty( $entry_ids ) ) {
classes/helpers/FrmAppHelper.php CHANGED
@@ -4,13 +4,13 @@ if ( ! defined('ABSPATH') ) {
4
  }
5
 
6
  class FrmAppHelper {
7
- public static $db_version = 27; //version of the database we are moving to
8
- public static $pro_db_version = 31;
9
 
10
  /**
11
  * @since 2.0
12
  */
13
- public static $plug_version = '2.0.22';
14
 
15
  /**
16
  * @since 1.07.02
@@ -32,7 +32,7 @@ class FrmAppHelper {
32
 
33
  public static function plugin_url() {
34
  //prevously FRM_URL constant
35
- return plugins_url( '', self::plugin_path() .'/formidable.php' );
36
  }
37
 
38
  public static function relative_plugin_url() {
@@ -91,6 +91,11 @@ class FrmAppHelper {
91
  return $frm_settings;
92
  }
93
 
 
 
 
 
 
94
  /**
95
  * Show a message in place of pro features
96
  *
@@ -406,9 +411,9 @@ class FrmAppHelper {
406
  */
407
  public static function trigger_hook_load( $type, $object = null ) {
408
  // only load the form hooks once
409
- $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
410
  if ( ! $hooks_loaded ) {
411
- do_action('frm_load_'. $type .'_hooks');
412
  }
413
  }
414
 
@@ -551,7 +556,8 @@ class FrmAppHelper {
551
  public static function post_edit_link( $post_id ) {
552
  $post = get_post($post_id);
553
  if ( $post ) {
554
- return '<a href="'. esc_url( admin_url('post.php?post='. $post_id .'&action=edit') ) .'">'. self::truncate( $post->post_title, 50 ) .'</a>';
 
555
  }
556
  return '';
557
  }
@@ -710,11 +716,12 @@ class FrmAppHelper {
710
  }
711
 
712
  public static function check_selected( $values, $current ) {
713
- $values = self::recursive_function_map( $values, 'trim' );
714
- $current = trim($current);
 
715
 
716
- return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
717
- }
718
 
719
  /**
720
  * Check if current field option is an "other" option
@@ -838,7 +845,7 @@ class FrmAppHelper {
838
  * @return string The base Google APIS url for the current version of jQuery UI
839
  */
840
  public static function jquery_ui_base_url() {
841
- $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
842
  $url = apply_filters('frm_jquery_ui_base_url', $url);
843
  return $url;
844
  }
@@ -926,7 +933,7 @@ class FrmAppHelper {
926
  }
927
 
928
  if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
929
- $key = $key .'a';
930
  }
931
 
932
  $key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
@@ -1005,7 +1012,7 @@ class FrmAppHelper {
1005
  }
1006
  }
1007
 
1008
- $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1009
  $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1010
 
1011
  $field_array = array(
@@ -1042,7 +1049,7 @@ class FrmAppHelper {
1042
  $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1043
 
1044
  foreach ( $opt_defaults as $opt => $default_opt ) {
1045
- $field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt .'_'. $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt .'_'. $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1046
  if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1047
  $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1048
  } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
@@ -1108,8 +1115,8 @@ class FrmAppHelper {
1108
  }
1109
 
1110
  foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1111
- if ( ! isset( $values[ $h .'_html' ] ) ) {
1112
- $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1113
  }
1114
  unset($h);
1115
  }
@@ -1350,7 +1357,7 @@ class FrmAppHelper {
1350
  self::esc_order_by( $order_by );
1351
  }
1352
 
1353
- return ' ORDER BY '. $order . ' '. $order_by;
1354
  }
1355
 
1356
  /**
@@ -1373,7 +1380,7 @@ class FrmAppHelper {
1373
 
1374
  $limit = trim(str_replace(' limit', '', strtolower($limit)));
1375
  if ( is_numeric($limit) ) {
1376
- return ' LIMIT '. $limit;
1377
  }
1378
 
1379
  $limit = explode(',', trim($limit));
@@ -1384,7 +1391,7 @@ class FrmAppHelper {
1384
  }
1385
 
1386
  $limit = implode(',', $limit);
1387
- return ' LIMIT '. $limit;
1388
  }
1389
 
1390
  /**
@@ -1534,7 +1541,7 @@ class FrmAppHelper {
1534
  echo ' class="frm_help"';
1535
  }
1536
 
1537
- echo ' title="'. esc_attr( $tooltips[ $name ] );
1538
 
1539
  if ( 'open' != $class ) {
1540
  echo '"';
4
  }
5
 
6
  class FrmAppHelper {
7
+ public static $db_version = 29; //version of the database we are moving to
8
+ public static $pro_db_version = 32;
9
 
10
  /**
11
  * @since 2.0
12
  */
13
+ public static $plug_version = '2.0.23';
14
 
15
  /**
16
  * @since 1.07.02
32
 
33
  public static function plugin_url() {
34
  //prevously FRM_URL constant
35
+ return plugins_url( '', self::plugin_path() . '/formidable.php' );
36
  }
37
 
38
  public static function relative_plugin_url() {
91
  return $frm_settings;
92
  }
93
 
94
+ public static function get_menu_name() {
95
+ $frm_settings = FrmAppHelper::get_settings();
96
+ return $frm_settings->menu;
97
+ }
98
+
99
  /**
100
  * Show a message in place of pro features
101
  *
411
  */
412
  public static function trigger_hook_load( $type, $object = null ) {
413
  // only load the form hooks once
414
+ $hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
415
  if ( ! $hooks_loaded ) {
416
+ do_action( 'frm_load_' . $type . '_hooks' );
417
  }
418
  }
419
 
556
  public static function post_edit_link( $post_id ) {
557
  $post = get_post($post_id);
558
  if ( $post ) {
559
+ $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
560
+ return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
561
  }
562
  return '';
563
  }
716
  }
717
 
718
  public static function check_selected( $values, $current ) {
719
+ $values = self::recursive_function_map( $values, 'trim' );
720
+ $values = self::recursive_function_map( $values, 'htmlspecialchars_decode' );
721
+ $current = htmlspecialchars_decode( trim( $current ) );
722
 
723
+ return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
724
+ }
725
 
726
  /**
727
  * Check if current field option is an "other" option
845
  * @return string The base Google APIS url for the current version of jQuery UI
846
  */
847
  public static function jquery_ui_base_url() {
848
+ $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version('jquery-ui-core');
849
  $url = apply_filters('frm_jquery_ui_base_url', $url);
850
  return $url;
851
  }
933
  }
934
 
935
  if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
936
+ $key = $key . 'a';
937
  }
938
 
939
  $key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
1012
  }
1013
  }
1014
 
1015
+ $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1016
  $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1017
 
1018
  $field_array = array(
1049
  $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1050
 
1051
  foreach ( $opt_defaults as $opt => $default_opt ) {
1052
+ $field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt . '_' . $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt . '_' . $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1053
  if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1054
  $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1055
  } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1115
  }
1116
 
1117
  foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1118
+ if ( ! isset( $values[ $h . '_html' ] ) ) {
1119
+ $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1120
  }
1121
  unset($h);
1122
  }
1357
  self::esc_order_by( $order_by );
1358
  }
1359
 
1360
+ return ' ORDER BY ' . $order . ' ' . $order_by;
1361
  }
1362
 
1363
  /**
1380
 
1381
  $limit = trim(str_replace(' limit', '', strtolower($limit)));
1382
  if ( is_numeric($limit) ) {
1383
+ return ' LIMIT ' . $limit;
1384
  }
1385
 
1386
  $limit = explode(',', trim($limit));
1391
  }
1392
 
1393
  $limit = implode(',', $limit);
1394
+ return ' LIMIT ' . $limit;
1395
  }
1396
 
1397
  /**
1541
  echo ' class="frm_help"';
1542
  }
1543
 
1544
+ echo ' title="' . esc_attr( $tooltips[ $name ] );
1545
 
1546
  if ( 'open' != $class ) {
1547
  echo '"';
classes/helpers/FrmCSVExportHelper.php CHANGED
@@ -72,13 +72,15 @@ class FrmCSVExportHelper{
72
  }
73
 
74
  public static function get_csv_format() {
75
- self::$to_encoding = FrmAppHelper::get_post_param( 'csv_format', 'UTF-8', 'sanitize_text_field' );
 
 
76
  }
77
 
78
  private static function prepare_csv_headings() {
79
  $headings = array();
80
  self::csv_headings( $headings );
81
- $headings = apply_filters( 'frm_csv_columns', $headings, self::$form_id );
82
  self::$headings = $headings;
83
 
84
  self::print_csv_row( $headings );
@@ -86,11 +88,14 @@ class FrmCSVExportHelper{
86
 
87
  private static function csv_headings( &$headings ) {
88
  foreach ( self::$fields as $col ) {
 
89
  if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) {
90
- $headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
91
  }
92
 
93
- $headings[ $col->id ] = strip_tags( $col->name );
 
 
94
  }
95
 
96
  if ( self::$comment_count ) {
@@ -172,6 +177,8 @@ class FrmCSVExportHelper{
172
  $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
173
 
174
  $field_value = maybe_unserialize( $field_value );
 
 
175
  $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator ) );
176
 
177
  if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) {
@@ -190,6 +197,20 @@ class FrmCSVExportHelper{
190
  }
191
  }
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  private static function add_entry_data_to_csv( &$row ) {
194
  $row['created_at'] = FrmAppHelper::get_formatted_time( self::$entry->created_at, self::$wp_date_format, ' ' );
195
  $row['updated_at'] = FrmAppHelper::get_formatted_time( self::$entry->updated_at, self::$wp_date_format, ' ' );
@@ -204,14 +225,11 @@ class FrmCSVExportHelper{
204
  private static function print_csv_row( $rows ) {
205
  $col_count = count( $rows );
206
  $this_col = 0;
207
- foreach ( $rows as $k => $row ) {
208
- $this_col++;
209
 
210
- if ( ! isset( self::$headings[ $k ] ) ) {
211
- // this column has been removed from the csv, so skip it
212
- continue;
213
- }
214
 
 
215
  if ( is_array( $row ) ) {
216
  // implode the repeated field values
217
  $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) );
@@ -221,6 +239,7 @@ class FrmCSVExportHelper{
221
  if ( self::$line_break != 'return' ) {
222
  $val = str_replace( array( "\r\n", "\r", "\n" ), self::$line_break, $val );
223
  }
 
224
  echo '"' . $val . '"';
225
  if ( $this_col != $col_count ) {
226
  echo self::$column_separator;
72
  }
73
 
74
  public static function get_csv_format() {
75
+ $csv_format = FrmAppHelper::get_post_param( 'csv_format', 'UTF-8', 'sanitize_text_field' );
76
+ $csv_format = apply_filters( 'frm_csv_format', $csv_format );
77
+ self::$to_encoding = $csv_format;
78
  }
79
 
80
  private static function prepare_csv_headings() {
81
  $headings = array();
82
  self::csv_headings( $headings );
83
+ $headings = apply_filters( 'frm_csv_columns', $headings, self::$form_id, array( 'fields' => self::$fields ) );
84
  self::$headings = $headings;
85
 
86
  self::print_csv_row( $headings );
88
 
89
  private static function csv_headings( &$headings ) {
90
  foreach ( self::$fields as $col ) {
91
+ $field_headings = array();
92
  if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) {
93
+ $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
94
  }
95
 
96
+ $field_headings[ $col->id ] = strip_tags( $col->name );
97
+ $field_headings = apply_filters( 'frm_csv_field_columns', $field_headings, array( 'field' => $col ) );
98
+ $headings += $field_headings;
99
  }
100
 
101
  if ( self::$comment_count ) {
177
  $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
178
 
179
  $field_value = maybe_unserialize( $field_value );
180
+ self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) );
181
+
182
  $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator ) );
183
 
184
  if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) {
197
  }
198
  }
199
 
200
+ /**
201
+ * @since 2.0.23
202
+ */
203
+ private static function add_array_values_to_columns( &$row, $atts ) {
204
+ if ( is_array( $atts['field_value'] ) ) {
205
+ foreach ( $atts['field_value'] as $key => $sub_value ) {
206
+ $column_key = $atts['col']->id . '_' . $key;
207
+ if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) {
208
+ $row[ $column_key ] = $sub_value;
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
  private static function add_entry_data_to_csv( &$row ) {
215
  $row['created_at'] = FrmAppHelper::get_formatted_time( self::$entry->created_at, self::$wp_date_format, ' ' );
216
  $row['updated_at'] = FrmAppHelper::get_formatted_time( self::$entry->updated_at, self::$wp_date_format, ' ' );
225
  private static function print_csv_row( $rows ) {
226
  $col_count = count( $rows );
227
  $this_col = 0;
 
 
228
 
229
+ foreach ( self::$headings as $k => $heading ) {
230
+ $this_col++;
 
 
231
 
232
+ $row = isset( $rows[ $k ] ) ? $rows[ $k ] : '';
233
  if ( is_array( $row ) ) {
234
  // implode the repeated field values
235
  $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) );
239
  if ( self::$line_break != 'return' ) {
240
  $val = str_replace( array( "\r\n", "\r", "\n" ), self::$line_break, $val );
241
  }
242
+
243
  echo '"' . $val . '"';
244
  if ( $this_col != $col_count ) {
245
  echo self::$column_separator;
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -180,6 +180,7 @@ class FrmEntriesHelper {
180
 
181
  public static function prepare_display_value( $entry, $field, $atts ) {
182
  $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
 
183
  if ( FrmAppHelper::pro_is_installed() ) {
184
  FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
185
  }
@@ -268,6 +269,7 @@ class FrmEntriesHelper {
268
  }
269
 
270
  $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
 
271
 
272
  $new_value = '';
273
 
180
 
181
  public static function prepare_display_value( $entry, $field, $atts ) {
182
  $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
183
+
184
  if ( FrmAppHelper::pro_is_installed() ) {
185
  FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
186
  }
269
  }
270
 
271
  $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
272
+ $value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
273
 
274
  $new_value = '';
275
 
classes/helpers/FrmEntriesListHelper.php CHANGED
@@ -44,7 +44,7 @@ class FrmEntriesListHelper extends FrmListHelper {
44
  $page = $this->get_pagenum();
45
  $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page );
46
 
47
- $this->items = FrmEntry::getAll($s_query, $order, ' LIMIT '. $start .','. $per_page, true, false);
48
  $total_items = FrmEntry::getRecordCount($s_query);
49
 
50
  $this->set_pagination_args( array(
@@ -66,7 +66,7 @@ class FrmEntriesListHelper extends FrmListHelper {
66
  }
67
  $colspan = $this->get_column_count();
68
 
69
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/no_entries.php');
70
  }
71
 
72
  public function search_box( $text, $input_id ) {
@@ -99,7 +99,7 @@ class FrmEntriesListHelper extends FrmListHelper {
99
  public function single_row( $item, $style = '' ) {
100
  // Set up the hover actions for this user
101
  $actions = array();
102
- $view_link = '?page=formidable-entries&frm_action=show&id='. $item->id;
103
 
104
  $this->get_actions( $actions, $item, $view_link );
105
 
@@ -114,7 +114,7 @@ class FrmEntriesListHelper extends FrmListHelper {
114
  $action_col = false;
115
 
116
  foreach ( $columns as $column_name => $column_display_name ) {
117
- $class = $column_name .' column-'. $column_name;
118
 
119
  if ( $column_name === $primary ) {
120
  $class .= ' column-primary';
@@ -128,9 +128,9 @@ class FrmEntriesListHelper extends FrmListHelper {
128
 
129
  $attributes = 'class="' . esc_attr( $class ) . '"';
130
  unset($class);
131
- $attributes .= ' data-colname="' . $column_display_name . '"';
132
 
133
- $col_name = preg_replace('/^('. $this->params['form'] .'_)/', '', $column_name);
134
  $this->column_name = $col_name;
135
 
136
  switch ( $col_name ) {
@@ -175,7 +175,7 @@ class FrmEntriesListHelper extends FrmListHelper {
175
  if ( isset( $val ) ) {
176
  $r .= "<td $attributes>";
177
  if ( $column_name == $action_col ) {
178
- $edit_link = '?page=formidable-entries&frm_action=edit&id='. $item->id;
179
  $r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> ';
180
  $r .= $action_links;
181
  } else {
@@ -194,10 +194,10 @@ class FrmEntriesListHelper extends FrmListHelper {
194
  * @param string $view_link
195
  */
196
  private function get_actions( &$actions, $item, $view_link ) {
197
- $actions['view'] = '<a href="' . esc_url( $view_link ) . '">'. __( 'View', 'formidable' ) .'</a>';
198
 
199
  if ( current_user_can('frm_delete_entries') ) {
200
- $delete_link = '?page=formidable-entries&frm_action=destroy&id='. $item->id .'&form='. $this->params['form'];
201
  $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>';
202
  }
203
 
44
  $page = $this->get_pagenum();
45
  $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page );
46
 
47
+ $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false );
48
  $total_items = FrmEntry::getRecordCount($s_query);
49
 
50
  $this->set_pagination_args( array(
66
  }
67
  $colspan = $this->get_column_count();
68
 
69
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' );
70
  }
71
 
72
  public function search_box( $text, $input_id ) {
99
  public function single_row( $item, $style = '' ) {
100
  // Set up the hover actions for this user
101
  $actions = array();
102
+ $view_link = '?page=formidable-entries&frm_action=show&id=' . $item->id;
103
 
104
  $this->get_actions( $actions, $item, $view_link );
105
 
114
  $action_col = false;
115
 
116
  foreach ( $columns as $column_name => $column_display_name ) {
117
+ $class = $column_name . ' column-' . $column_name;
118
 
119
  if ( $column_name === $primary ) {
120
  $class .= ' column-primary';
128
 
129
  $attributes = 'class="' . esc_attr( $class ) . '"';
130
  unset($class);
131
+ $attributes .= ' data-colname="' . $column_display_name . '"';
132
 
133
+ $col_name = preg_replace( '/^(' . $this->params['form'] . '_)/', '', $column_name );
134
  $this->column_name = $col_name;
135
 
136
  switch ( $col_name ) {
175
  if ( isset( $val ) ) {
176
  $r .= "<td $attributes>";
177
  if ( $column_name == $action_col ) {
178
+ $edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id;
179
  $r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> ';
180
  $r .= $action_links;
181
  } else {
194
  * @param string $view_link
195
  */
196
  private function get_actions( &$actions, $item, $view_link ) {
197
+ $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>';
198
 
199
  if ( current_user_can('frm_delete_entries') ) {
200
+ $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form'];
201
  $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>';
202
  }
203
 
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -68,7 +68,7 @@ class FrmFieldsHelper {
68
  }
69
 
70
  public static function get_html_id( $field, $plus = '' ) {
71
- return apply_filters('frm_field_html_id', 'field_'. $field['field_key'] . $plus, $field);
72
  }
73
 
74
  public static function setup_edit_vars( $record, $doing_ajax = false ) {
@@ -133,7 +133,7 @@ class FrmFieldsHelper {
133
 
134
  $form_id = (is_numeric($field)) ? $field : $field->form_id;
135
 
136
- $key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_fields', 'field_key') : $field->field_key;
137
 
138
  $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
139
 
@@ -151,7 +151,7 @@ class FrmFieldsHelper {
151
  public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
  global $wpdb;
153
 
154
- $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix .'frm_fields', 'field_key');
155
  $values['form_id'] = $form_id;
156
  $values['options'] = maybe_serialize($field->options);
157
  $values['default_value'] = maybe_serialize($field->default_value);
@@ -177,6 +177,7 @@ class FrmFieldsHelper {
177
 
178
  $msg = FrmField::get_option( $field, $error );
179
  $msg = ( $msg == $defaults[ $error ]['full'] || empty( $msg ) ) ? $defaults[ $error ]['part'] : $msg;
 
180
  return $msg;
181
  }
182
 
@@ -215,8 +216,8 @@ DEFAULT_HTML;
215
  $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
216
 
217
  $defaults = array(
218
- 'field_name' => 'item_meta['. $field['id'] .']',
219
- 'field_id' => $field['id'],
220
  'field_plus_id' => '',
221
  'section_id' => '',
222
  );
@@ -311,7 +312,7 @@ DEFAULT_HTML;
311
 
312
  $field['shortcodes'] = $atts;
313
  ob_start();
314
- include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/input.php');
315
  $replace_with = ob_get_contents();
316
  ob_end_clean();
317
  } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
@@ -363,10 +364,10 @@ DEFAULT_HTML;
363
  * @param $html string
364
  */
365
  private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) {
366
- $error_class .= ' frm_'. $field['label'] .'_container';
367
  if ( $field['id'] != $field_id ) {
368
  // add a class for repeating/embedded fields
369
- $error_class .= ' frm_field_'. $field['id'] .'_container';
370
  }
371
 
372
  // Add class to embedded form field
@@ -421,19 +422,19 @@ DEFAULT_HTML;
421
  if ( ! strpos( $html, 'frm_form_field ') ) {
422
  $error_class .= ' frm_form_field';
423
  }
424
- $error_class .= ' '. $field['classes'];
425
  }
426
  }
427
 
428
  public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
429
  if ( $no_vars ) {
430
- $html = str_replace( '[if '. $code.']', '', $html );
431
- $html = str_replace( '[/if '. $code.']', '', $html );
432
  } else {
433
- $html = preg_replace( '/(\[if\s+'. $code .'\])(.*?)(\[\/if\s+'. $code .'\])/mis', '', $html );
434
  }
435
 
436
- $html = str_replace( '['. $code .']', $replace_with, $html );
437
  }
438
 
439
  public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
@@ -480,9 +481,9 @@ DEFAULT_HTML;
480
  $frm_settings = FrmAppHelper::get_settings();
481
  $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
482
 
483
- $api_js_url = 'https://www.google.com/recaptcha/api.js';
484
  if ( $lang != 'en' ) {
485
- $api_js_url .= '?hl='. $lang;
486
  }
487
  $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
488
 
@@ -490,7 +491,7 @@ DEFAULT_HTML;
490
  wp_enqueue_script('recaptcha-api');
491
 
492
  ?>
493
- <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div>
494
  <?php
495
  }
496
 
@@ -505,9 +506,9 @@ DEFAULT_HTML;
505
  if ( self::is_other_opt( $opt_key ) ) {
506
  // Get string for Other text field, if needed
507
  $other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
508
- require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
509
  } else {
510
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
511
  }
512
  }
513
  }
@@ -521,7 +522,7 @@ DEFAULT_HTML;
521
  }
522
 
523
  if ( ! $args['name'] ) {
524
- $args['name'] = 'item_meta['. $args['field']['id'] .']';
525
  }
526
 
527
  $id = self::get_html_id($args['field']);
@@ -568,7 +569,7 @@ DEFAULT_HTML;
568
  $add_html .= FrmProFieldsController::input_html($args['field'], false);
569
  }
570
 
571
- $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 );
572
 
573
  if ( is_array($args['field']['value']) ) {
574
  $skip = true;
@@ -593,7 +594,7 @@ DEFAULT_HTML;
593
 
594
  $link = sprintf(
595
  __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
596
- '<a href="'. esc_url( admin_url( 'edit-tags.php?taxonomy='. $tax->name ) ) .'" target="_blank">'. ( empty($tax->labels->name) ? __( 'Categories' ) : $tax->labels->name ) .'</a>'
597
  );
598
  unset($tax);
599
 
@@ -790,21 +791,23 @@ DEFAULT_HTML;
790
 
791
  $atts['entry_id'] = $entry->id;
792
  $atts['entry_key'] = $entry->item_key;
793
- //$replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field);
794
-
795
- if ( is_array($replace_with) ) {
796
- $replace_with = implode($sep, $replace_with);
797
- }
798
 
799
  if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
800
  $replace_with = $field->name;
801
  } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
802
  $replace_with = $field->description;
803
- } else if ( empty($replace_with) && $replace_with != '0' ) {
804
- $replace_with = '';
805
- } else {
806
- $replace_with = self::get_display_value($replace_with, $field, $atts);
807
- }
 
 
 
 
 
 
 
808
 
809
  unset($field);
810
  break;
@@ -886,6 +889,7 @@ DEFAULT_HTML;
886
  public static function get_display_value( $replace_with, $field, $atts = array() ) {
887
  $atts['sep'] = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
888
 
 
889
  $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
890
 
891
  if ( $field->type == 'textarea' || $field->type == 'rte' ) {
@@ -1164,8 +1168,11 @@ DEFAULT_HTML;
1164
 
1165
  if ( $display['default_blank'] ) {
1166
  self::show_default_blank_js( $field['default_blank'] );
 
1167
  }
 
1168
  self::show_onfocus_js( $field['clear_on_focus'] );
 
1169
 
1170
  echo '</span>';
1171
  }
@@ -1199,20 +1206,20 @@ DEFAULT_HTML;
1199
  $replace = array();
1200
  $replace_with = array();
1201
  foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1202
- $replace[] = '[if '. $old .']';
1203
- $replace_with[] = '[if '. $new .']';
1204
- $replace[] = '[if '. $old .' ';
1205
- $replace_with[] = '[if '. $new .' ';
1206
- $replace[] = '[/if '. $old .']';
1207
- $replace_with[] = '[/if '. $new .']';
1208
- $replace[] = '[foreach '. $old .']';
1209
- $replace_with[] = '[foreach '. $new .']';
1210
- $replace[] = '[/foreach '. $old .']';
1211
- $replace_with[] = '[/foreach '. $new .']';
1212
- $replace[] = '['. $old .']';
1213
- $replace_with[] = '['. $new .']';
1214
- $replace[] = '['. $old .' ';
1215
- $replace_with[] = '['. $new .' ';
1216
  unset($old, $new);
1217
  }
1218
  if ( is_array( $val ) ) {
68
  }
69
 
70
  public static function get_html_id( $field, $plus = '' ) {
71
+ return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
72
  }
73
 
74
  public static function setup_edit_vars( $record, $doing_ajax = false ) {
133
 
134
  $form_id = (is_numeric($field)) ? $field : $field->form_id;
135
 
136
+ $key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key;
137
 
138
  $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
139
 
151
  public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
  global $wpdb;
153
 
154
+ $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
155
  $values['form_id'] = $form_id;
156
  $values['options'] = maybe_serialize($field->options);
157
  $values['default_value'] = maybe_serialize($field->default_value);
177
 
178
  $msg = FrmField::get_option( $field, $error );
179
  $msg = ( $msg == $defaults[ $error ]['full'] || empty( $msg ) ) ? $defaults[ $error ]['part'] : $msg;
180
+ $msg = do_shortcode( $msg );
181
  return $msg;
182
  }
183
 
216
  $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
217
 
218
  $defaults = array(
219
+ 'field_name' => 'item_meta[' . $field['id'] . ']',
220
+ 'field_id' => $field['id'],
221
  'field_plus_id' => '',
222
  'section_id' => '',
223
  );
312
 
313
  $field['shortcodes'] = $atts;
314
  ob_start();
315
+ include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' );
316
  $replace_with = ob_get_contents();
317
  ob_end_clean();
318
  } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
364
  * @param $html string
365
  */
366
  private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) {
367
+ $error_class .= ' frm_' . $field['label'] . '_container';
368
  if ( $field['id'] != $field_id ) {
369
  // add a class for repeating/embedded fields
370
+ $error_class .= ' frm_field_' . $field['id'] . '_container';
371
  }
372
 
373
  // Add class to embedded form field
422
  if ( ! strpos( $html, 'frm_form_field ') ) {
423
  $error_class .= ' frm_form_field';
424
  }
425
+ $error_class .= ' ' . $field['classes'];
426
  }
427
  }
428
 
429
  public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
430
  if ( $no_vars ) {
431
+ $html = str_replace( '[if ' . $code . ']', '', $html );
432
+ $html = str_replace( '[/if ' . $code . ']', '', $html );
433
  } else {
434
+ $html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html );
435
  }
436
 
437
+ $html = str_replace( '[' . $code . ']', $replace_with, $html );
438
  }
439
 
440
  public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
481
  $frm_settings = FrmAppHelper::get_settings();
482
  $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
483
 
484
+ $api_js_url = 'https://www.google.com/recaptcha/api.js?onload=frmRecaptcha&render=explicit';
485
  if ( $lang != 'en' ) {
486
+ $api_js_url .= '&hl=' . $lang;
487
  }
488
  $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
489
 
491
  wp_enqueue_script('recaptcha-api');
492
 
493
  ?>
494
+ <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="frm-g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div>
495
  <?php
496
  }
497
 
506
  if ( self::is_other_opt( $opt_key ) ) {
507
  // Get string for Other text field, if needed
508
  $other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
509
+ require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
510
  } else {
511
+ require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
512
  }
513
  }
514
  }
522
  }
523
 
524
  if ( ! $args['name'] ) {
525
+ $args['name'] = 'item_meta[' . $args['field']['id'] . ']';
526
  }
527
 
528
  $id = self::get_html_id($args['field']);
569
  $add_html .= FrmProFieldsController::input_html($args['field'], false);
570
  }
571
 
572
+ $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 );
573
 
574
  if ( is_array($args['field']['value']) ) {
575
  $skip = true;
594
 
595
  $link = sprintf(
596
  __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
597
+ '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
598
  );
599
  unset($tax);
600
 
791
 
792
  $atts['entry_id'] = $entry->id;
793
  $atts['entry_key'] = $entry->item_key;
 
 
 
 
 
794
 
795
  if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
796
  $replace_with = $field->name;
797
  } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
798
  $replace_with = $field->description;
799
+ } else {
800
+ $string_value = $replace_with;
801
+ if ( is_array( $replace_with ) ) {
802
+ $string_value = implode( $sep, $replace_with );
803
+ }
804
+
805
+ if ( empty( $string_value ) && $string_value != '0' ) {
806
+ $replace_with = '';
807
+ } else {
808
+ $replace_with = self::get_display_value( $replace_with, $field, $atts );
809
+ }
810
+ }
811
 
812
  unset($field);
813
  break;
889
  public static function get_display_value( $replace_with, $field, $atts = array() ) {
890
  $atts['sep'] = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
891
 
892
+ $replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts );
893
  $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
894
 
895
  if ( $field->type == 'textarea' || $field->type == 'rte' ) {
1168
 
1169
  if ( $display['default_blank'] ) {
1170
  self::show_default_blank_js( $field['default_blank'] );
1171
+ echo '<input type="hidden" name="field_options[default_blank_' . esc_attr( $field['id'] ) . ']" value="' . esc_attr( $field['default_blank'] ) . '" />';
1172
  }
1173
+
1174
  self::show_onfocus_js( $field['clear_on_focus'] );
1175
+ echo '<input type="hidden" name="field_options[clear_on_focus_' . esc_attr( $field['id'] ) . ']" value="' . esc_attr( $field['default_blank'] ) . '" />';
1176
 
1177
  echo '</span>';
1178
  }
1206
  $replace = array();
1207
  $replace_with = array();
1208
  foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1209
+ $replace[] = '[if ' . $old . ']';
1210
+ $replace_with[] = '[if ' . $new . ']';
1211
+ $replace[] = '[if ' . $old . ' ';
1212
+ $replace_with[] = '[if ' . $new . ' ';
1213
+ $replace[] = '[/if ' . $old . ']';
1214
+ $replace_with[] = '[/if ' . $new . ']';
1215
+ $replace[] = '[foreach ' . $old . ']';
1216
+ $replace_with[] = '[foreach ' . $new . ']';
1217
+ $replace[] = '[/foreach ' . $old . ']';
1218
+ $replace_with[] = '[/foreach ' . $new . ']';
1219
+ $replace[] = '[' . $old . ']';
1220
+ $replace_with[] = '[' . $new . ']';
1221
+ $replace[] = '[' . $old . ' ';
1222
+ $replace_with[] = '[' . $new . ' ';
1223
  unset($old, $new);
1224
  }
1225
  if ( is_array( $val ) ) {
classes/helpers/FrmFormsHelper.php CHANGED
@@ -11,7 +11,7 @@ class FrmFormsHelper {
11
  }
12
 
13
  public static function get_direct_link( $key, $form = false ) {
14
- $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form='. $key ) );
15
  $target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
16
 
17
  return $target_url;
@@ -50,7 +50,7 @@ class FrmFormsHelper {
50
  <?php } ?>
51
  <?php foreach ( $forms as $form ) { ?>
52
  <option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
53
- echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 33 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ;
54
  ?></option>
55
  <?php } ?>
56
  </select>
@@ -105,7 +105,7 @@ class FrmFormsHelper {
105
  $args['form'] = $form->id;
106
  }
107
  ?>
108
- <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
109
  <?php
110
  unset( $form );
111
  } ?>
@@ -154,7 +154,7 @@ class FrmFormsHelper {
154
  }
155
 
156
  if ( ! isset( $values['form_key'] ) ) {
157
- $values['form_key'] = ($post_values && isset($post_values['form_key'])) ? $post_values['form_key'] : FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_forms', 'form_key');
158
  }
159
 
160
  $values = self::fill_default_opts($values, false, $post_values);
@@ -577,14 +577,14 @@ BEFORE_HTML;
577
  );
578
 
579
  $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
580
- $base_url = '?page=formidable&form_type='. $current_page .'&id='. $id;
581
  if ( 'trash' == $status ) {
582
- $link = '<a href="'. esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>';
583
  } else if ( current_user_can('frm_delete_forms') ) {
584
  if ( EMPTY_TRASH_DAYS ) {
585
  $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>';
586
  } else {
587
- $link = '<a href="' . esc_url( wp_nonce_url( $base_url .'&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>';
588
  }
589
  }
590
 
11
  }
12
 
13
  public static function get_direct_link( $key, $form = false ) {
14
+ $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) );
15
  $target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
16
 
17
  return $target_url;
50
  <?php } ?>
51
  <?php foreach ( $forms as $form ) { ?>
52
  <option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
53
+ echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ;
54
  ?></option>
55
  <?php } ?>
56
  </select>
105
  $args['form'] = $form->id;
106
  }
107
  ?>
108
+ <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li>
109
  <?php
110
  unset( $form );
111
  } ?>
154
  }
155
 
156
  if ( ! isset( $values['form_key'] ) ) {
157
+ $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' );
158
  }
159
 
160
  $values = self::fill_default_opts($values, false, $post_values);
577
  );
578
 
579
  $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
580
+ $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id;
581
  if ( 'trash' == $status ) {
582
+ $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>';
583
  } else if ( current_user_can('frm_delete_forms') ) {
584
  if ( EMPTY_TRASH_DAYS ) {
585
  $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>';
586
  } else {
587
+ $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>';
588
  }
589
  }
590
 
classes/helpers/FrmFormsListHelper.php CHANGED
@@ -60,7 +60,7 @@ class FrmFormsListHelper extends FrmListHelper {
60
  }
61
  }
62
 
63
- $this->items = FrmForm::getAll($s_query, $orderby .' '. $order, $start .','. $per_page);
64
  $total_items = FrmDb::get_count( 'frm_forms', $s_query );
65
 
66
  $this->set_pagination_args( array(
@@ -73,7 +73,7 @@ class FrmFormsListHelper extends FrmListHelper {
73
  if ( 'template' == $this->status ) {
74
  _e( 'No Templates Found.', 'formidable' ) ?>
75
  <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?>
76
- <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li>
77
  <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li>
78
  <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li>
79
  </ol>
@@ -204,8 +204,8 @@ class FrmFormsListHelper extends FrmListHelper {</