Formidable Forms – Form Builder for WordPress - Version 3.01.01

Version Description

  • New: Replace the jQuery colorpicker with the WordPress colorpicker in the visual form styler
  • New: Process shortcodes in the redirect url after form submission
  • New: frm_override_default_styles and frm_default_style_settings hooks
  • Fix: Prevent shortcodes inside field values from being processed in more places including the redirect url. This is a security precaution.
  • Fix: A default contact form was being added with each update. This update ensures the contact form is only generated once.
  • Fix: Allow the visual form styler to show instant changes to the sample contact form since server limits of url size were being hit in some cases.
  • Fix: HTML was being stripped from some field settings on the form creator page like validation messages
Download this release

Release Info

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

Code changes from version 3.01 to 3.01.01

Files changed (78) hide show
  1. classes/controllers/FrmAppController.php +13 -7
  2. classes/controllers/FrmFieldsController.php +1 -1
  3. classes/controllers/FrmFormActionsController.php +23 -23
  4. classes/controllers/FrmFormsController.php +91 -90
  5. classes/controllers/FrmSettingsController.php +1 -1
  6. classes/controllers/FrmStylesController.php +4 -12
  7. classes/helpers/FrmAppHelper.php +143 -139
  8. classes/helpers/FrmEntriesHelper.php +35 -35
  9. classes/helpers/FrmEntriesListHelper.php +7 -7
  10. classes/helpers/FrmFieldsHelper.php +96 -91
  11. classes/helpers/FrmFormActionsHelper.php +1 -1
  12. classes/helpers/FrmFormsHelper.php +49 -49
  13. classes/helpers/FrmFormsListHelper.php +26 -26
  14. classes/helpers/FrmListHelper.php +1 -1
  15. classes/helpers/FrmShortcodeHelper.php +2 -2
  16. classes/helpers/FrmStylesHelper.php +36 -22
  17. classes/helpers/FrmXMLHelper.php +92 -92
  18. classes/models/FrmAddon.php +1 -1
  19. classes/models/FrmCreateFile.php +8 -8
  20. classes/models/FrmDb.php +11 -11
  21. classes/models/FrmDbDeprecated.php +2 -2
  22. classes/models/FrmEntry.php +51 -51
  23. classes/models/FrmEntryMeta.php +54 -54
  24. classes/models/FrmEntryValidate.php +7 -7
  25. classes/models/FrmField.php +43 -43
  26. classes/models/FrmFieldFormHtml.php +12 -12
  27. classes/models/FrmForm.php +73 -73
  28. classes/models/FrmFormAction.php +54 -54
  29. classes/models/FrmMigrate.php +28 -21
  30. classes/models/FrmSettings.php +55 -55
  31. classes/models/FrmStyle.php +52 -36
  32. classes/models/fields/FrmFieldCheckbox.php +1 -1
  33. classes/models/fields/FrmFieldRadio.php +1 -1
  34. classes/models/fields/FrmFieldTextarea.php +1 -1
  35. classes/models/fields/FrmFieldType.php +17 -10
  36. classes/views/addons/upgrade_to_pro.php +3 -3
  37. classes/views/frm-entries/_sidebar-shared-pub.php +2 -2
  38. classes/views/frm-entries/errors.php +4 -4
  39. classes/views/frm-entries/form.php +15 -15
  40. classes/views/frm-entries/sidebar-shared.php +4 -4
  41. classes/views/frm-fields/back-end/field-captcha.php +3 -2
  42. classes/views/frm-fields/front-end/checkbox-field.php +1 -1
  43. classes/views/frm-fields/front-end/dropdown-field.php +3 -3
  44. classes/views/frm-fields/front-end/radio-field.php +2 -2
  45. classes/views/frm-form-actions/_action_inside.php +8 -7
  46. classes/views/frm-form-actions/default_actions.php +6 -6
  47. classes/views/frm-form-actions/email_action.php +3 -3
  48. classes/views/frm-form-actions/form_action.php +3 -3
  49. classes/views/frm-forms/add_field.php +2 -2
  50. classes/views/frm-forms/form.php +3 -3
  51. classes/views/frm-forms/mb_html_tab.php +2 -2
  52. classes/views/frm-forms/settings.php +8 -6
  53. classes/views/frm-forms/shortcode_opts.php +1 -1
  54. classes/views/frm-forms/sidebar-settings.php +1 -1
  55. classes/views/frm-settings/form.php +8 -8
  56. classes/views/shared/mb_adv_info.php +11 -11
  57. classes/views/styles/_field-colors.php +2 -2
  58. classes/views/styles/_field-labels.php +9 -9
  59. classes/views/styles/_field-sizes.php +8 -8
  60. classes/views/styles/_general.php +10 -9
  61. classes/views/styles/custom_css.php +5 -5
  62. classes/views/styles/manage.php +1 -1
  63. classes/views/xml/forms_xml.php +12 -12
  64. classes/views/xml/import_form.php +1 -1
  65. classes/widgets/FrmShowForm.php +1 -1
  66. css/_single_theme.css.php +20 -36
  67. css/custom_theme.css.php +2 -2
  68. css/frm_admin.css +15 -47
  69. formidable.php +4 -4
  70. images/styler/marker.png +0 -0
  71. images/styler/mask.png +0 -0
  72. images/styler/wheel.png +0 -0
  73. js/formidable.js +11 -1
  74. js/formidable.min.js +35 -35
  75. js/formidable_admin.js +157 -5
  76. js/jquery/jquery-ui-themepicker.js +0 -395
  77. js/jquery/jquery-ui-themepicker.min.js +0 -1
  78. readme.txt +10 -1
classes/controllers/FrmAppController.php CHANGED
@@ -177,7 +177,7 @@ class FrmAppController {
177
  <div class="update-nag frm-update-to-pro">
178
  <?php echo FrmAppHelper::kses( $tip['tip'] ); ?>
179
  <span><?php echo FrmAppHelper::kses( $tip['call'] ); ?></span>
180
- <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidableforms.com?banner=1&tip=' . absint( $tip['num'] ) ) ); ?>" class="button">Upgrade to Pro</a>
181
  </div>
182
  <?php
183
  }
@@ -291,7 +291,7 @@ class FrmAppController {
291
  $version = FrmAppHelper::plugin_version();
292
  FrmAppHelper::load_admin_wide_js( false );
293
 
294
- wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', array(
295
  'formidable_admin_global',
296
  'formidable',
297
  'jquery',
@@ -300,7 +300,13 @@ class FrmAppController {
300
  'jquery-ui-sortable',
301
  'bootstrap_tooltip',
302
  'bootstrap-multiselect',
303
- ), $version, true );
 
 
 
 
 
 
304
  wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
305
  wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
306
  wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
@@ -467,13 +473,13 @@ class FrmAppController {
467
  self::install();
468
  }
469
 
470
- public static function install( $old_db_version = false ) {
471
  $frmdb = new FrmMigrate();
472
- $frmdb->upgrade( $old_db_version );
473
  }
474
 
475
  public static function uninstall() {
476
- FrmAppHelper::permission_check('administrator');
477
  check_ajax_referer( 'frm_ajax', 'nonce' );
478
 
479
  $frmdb = new FrmMigrate();
@@ -513,7 +519,7 @@ class FrmAppController {
513
  }
514
 
515
  public static function deauthorize() {
516
- FrmAppHelper::permission_check('frm_change_settings');
517
  check_ajax_referer( 'frm_ajax', 'nonce' );
518
 
519
  delete_option( 'frmpro-credentials' );
177
  <div class="update-nag frm-update-to-pro">
178
  <?php echo FrmAppHelper::kses( $tip['tip'] ); ?>
179
  <span><?php echo FrmAppHelper::kses( $tip['call'] ); ?></span>
180
+ <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com?banner=1&tip=' . absint( $tip['num'] ) ) ); ?>" class="button">Upgrade to Pro</a>
181
  </div>
182
  <?php
183
  }
291
  $version = FrmAppHelper::plugin_version();
292
  FrmAppHelper::load_admin_wide_js( false );
293
 
294
+ $dependecies = array(
295
  'formidable_admin_global',
296
  'formidable',
297
  'jquery',
300
  'jquery-ui-sortable',
301
  'bootstrap_tooltip',
302
  'bootstrap-multiselect',
303
+ );
304
+
305
+ if ( FrmAppHelper::is_admin_page( 'formidable-styles' ) ) {
306
+ $dependecies[] = 'wp-color-picker';
307
+ }
308
+
309
+ wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true );
310
  wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
311
  wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
312
  wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
473
  self::install();
474
  }
475
 
476
+ public static function install() {
477
  $frmdb = new FrmMigrate();
478
+ $frmdb->upgrade();
479
  }
480
 
481
  public static function uninstall() {
482
+ FrmAppHelper::permission_check( 'administrator' );
483
  check_ajax_referer( 'frm_ajax', 'nonce' );
484
 
485
  $frmdb = new FrmMigrate();
519
  }
520
 
521
  public static function deauthorize() {
522
+ FrmAppHelper::permission_check( 'frm_change_settings' );
523
  check_ajax_referer( 'frm_ajax', 'nonce' );
524
 
525
  delete_option( 'frmpro-credentials' );
classes/controllers/FrmFieldsController.php CHANGED
@@ -530,7 +530,7 @@ class FrmFieldsController {
530
  return;
531
  }
532
 
533
- if ( FrmAppHelper::is_admin_page('formidable' ) ) {
534
  return;
535
  }
536
 
530
  return;
531
  }
532
 
533
+ if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
534
  return;
535
  }
536
 
classes/controllers/FrmFormActionsController.php CHANGED
@@ -45,17 +45,17 @@ class FrmFormActionsController {
45
  'highrise' => 'FrmDefHrsAction',
46
  ) );
47
 
48
- include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
49
- include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
50
 
51
  foreach ( $action_classes as $action_class ) {
52
- self::$registered_actions->register($action_class);
53
  }
54
  }
55
 
56
  public static function get_form_actions( $action = 'all' ) {
57
  $temp_actions = self::$registered_actions;
58
- if ( empty($temp_actions) ) {
59
  self::actions_init();
60
  $temp_actions = self::$registered_actions->actions;
61
  } else {
@@ -129,12 +129,12 @@ class FrmFormActionsController {
129
  }
130
 
131
  public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
132
- $action_control->_set($action_key);
133
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
134
  }
135
 
136
  public static function add_form_action() {
137
- FrmAppHelper::permission_check('frm_edit_forms');
138
  check_ajax_referer( 'frm_ajax', 'nonce' );
139
 
140
  global $frm_vars;
@@ -143,58 +143,58 @@ class FrmFormActionsController {
143
  $action_type = sanitize_text_field( $_POST['type'] );
144
 
145
  $action_control = self::get_form_actions( $action_type );
146
- $action_control->_set($action_key);
147
 
148
  $form_id = absint( $_POST['form_id'] );
149
 
150
- $form_action = $action_control->prepare_new($form_id);
151
 
152
  $values = array();
153
- $form = self::fields_to_values($form_id, $values);
154
 
155
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
156
  wp_die();
157
  }
158
 
159
  public static function fill_action() {
160
- FrmAppHelper::permission_check('frm_edit_forms');
161
  check_ajax_referer( 'frm_ajax', 'nonce' );
162
 
163
  $action_key = absint( $_POST['action_id'] );
164
  $action_type = sanitize_text_field( $_POST['action_type'] );
165
 
166
  $action_control = self::get_form_actions( $action_type );
167
- if ( empty($action_control) ) {
168
  wp_die();
169
  }
170
 
171
  $form_action = $action_control->get_single_action( $action_key );
172
 
173
  $values = array();
174
- $form = self::fields_to_values($form_action->menu_order, $values);
175
 
176
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
177
  wp_die();
178
  }
179
 
180
  private static function fields_to_values( $form_id, array &$values ) {
181
- $form = FrmForm::getOne($form_id);
182
 
183
  $values = array(
184
  'fields' => array(),
185
  'id' => $form->id,
186
  );
187
 
188
- $fields = FrmField::get_all_for_form($form->id);
189
  foreach ( $fields as $k => $f ) {
190
  $f = (array) $f;
191
  $opts = (array) $f['field_options'];
192
- $f = array_merge($opts, $f);
193
  if ( ! isset( $f['post_field'] ) ) {
194
  $f['post_field'] = '';
195
  }
196
  $values['fields'][] = $f;
197
- unset($k, $f);
198
  }
199
 
200
  return $form;
@@ -212,7 +212,7 @@ class FrmFormActionsController {
212
  $new_actions = array();
213
 
214
  foreach ( $registered_actions as $registered_action ) {
215
- $action_ids = $registered_action->update_callback($form_id);
216
  if ( ! empty( $action_ids ) ) {
217
  $new_actions[] = $action_ids;
218
  }
@@ -307,11 +307,11 @@ class FrmFormActionsController {
307
  $stored_actions[ $action->ID ] = $action;
308
  $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
309
 
310
- unset($action);
311
  }
312
 
313
  if ( ! empty( $stored_actions ) ) {
314
- asort($action_priority);
315
 
316
  // make sure hooks are loaded
317
  new FrmNotification();
@@ -323,14 +323,14 @@ class FrmFormActionsController {
323
 
324
  // If post is created, get updated $entry object
325
  if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
326
- $entry = FrmEntry::getOne($entry->id, true);
327
  }
328
  }
329
  }
330
  }
331
 
332
  public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
333
- if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
334
  // continue if we know which actions to copy
335
  return;
336
  }
@@ -369,12 +369,12 @@ class Frm_Form_Action_Factory {
369
 
370
  public function unregister( $action_class ) {
371
  if ( isset( $this->actions[ $action_class ] ) ) {
372
- unset($this->actions[ $action_class ]);
373
  }
374
  }
375
 
376
  public function _register_actions() {
377
- $keys = array_keys($this->actions);
378
 
379
  foreach ( $keys as $key ) {
380
  // don't register new action if old action with the same id is already registered
45
  'highrise' => 'FrmDefHrsAction',
46
  ) );
47
 
48
+ include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
49
+ include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
50
 
51
  foreach ( $action_classes as $action_class ) {
52
+ self::$registered_actions->register( $action_class );
53
  }
54
  }
55
 
56
  public static function get_form_actions( $action = 'all' ) {
57
  $temp_actions = self::$registered_actions;
58
+ if ( empty( $temp_actions ) ) {
59
  self::actions_init();
60
  $temp_actions = self::$registered_actions->actions;
61
  } else {
129
  }
130
 
131
  public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
132
+ $action_control->_set( $action_key );
133
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
134
  }
135
 
136
  public static function add_form_action() {
137
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
138
  check_ajax_referer( 'frm_ajax', 'nonce' );
139
 
140
  global $frm_vars;
143
  $action_type = sanitize_text_field( $_POST['type'] );
144
 
145
  $action_control = self::get_form_actions( $action_type );
146
+ $action_control->_set( $action_key );
147
 
148
  $form_id = absint( $_POST['form_id'] );
149
 
150
+ $form_action = $action_control->prepare_new( $form_id );
151
 
152
  $values = array();
153
+ $form = self::fields_to_values( $form_id, $values );
154
 
155
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
156
  wp_die();
157
  }
158
 
159
  public static function fill_action() {
160
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
161
  check_ajax_referer( 'frm_ajax', 'nonce' );
162
 
163
  $action_key = absint( $_POST['action_id'] );
164
  $action_type = sanitize_text_field( $_POST['action_type'] );
165
 
166
  $action_control = self::get_form_actions( $action_type );
167
+ if ( empty( $action_control ) ) {
168
  wp_die();
169
  }
170
 
171
  $form_action = $action_control->get_single_action( $action_key );
172
 
173
  $values = array();
174
+ $form = self::fields_to_values( $form_action->menu_order, $values );
175
 
176
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
177
  wp_die();
178
  }
179
 
180
  private static function fields_to_values( $form_id, array &$values ) {
181
+ $form = FrmForm::getOne( $form_id );
182
 
183
  $values = array(
184
  'fields' => array(),
185
  'id' => $form->id,
186
  );
187
 
188
+ $fields = FrmField::get_all_for_form( $form->id );
189
  foreach ( $fields as $k => $f ) {
190
  $f = (array) $f;
191
  $opts = (array) $f['field_options'];
192
+ $f = array_merge( $opts, $f );
193
  if ( ! isset( $f['post_field'] ) ) {
194
  $f['post_field'] = '';
195
  }
196
  $values['fields'][] = $f;
197
+ unset( $k, $f );
198
  }
199
 
200
  return $form;
212
  $new_actions = array();
213
 
214
  foreach ( $registered_actions as $registered_action ) {
215
+ $action_ids = $registered_action->update_callback( $form_id );
216
  if ( ! empty( $action_ids ) ) {
217
  $new_actions[] = $action_ids;
218
  }
307
  $stored_actions[ $action->ID ] = $action;
308
  $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
309
 
310
+ unset( $action );
311
  }
312
 
313
  if ( ! empty( $stored_actions ) ) {
314
+ asort( $action_priority );
315
 
316
  // make sure hooks are loaded
317
  new FrmNotification();
323
 
324
  // If post is created, get updated $entry object
325
  if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
326
+ $entry = FrmEntry::getOne( $entry->id, true );
327
  }
328
  }
329
  }
330
  }
331
 
332
  public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
333
+ if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
334
  // continue if we know which actions to copy
335
  return;
336
  }
369
 
370
  public function unregister( $action_class ) {
371
  if ( isset( $this->actions[ $action_class ] ) ) {
372
+ unset( $this->actions[ $action_class ] );
373
  }
374
  }
375
 
376
  public function _register_actions() {
377
+ $keys = array_keys( $this->actions );
378
 
379
  foreach ( $keys as $key ) {
380
  // don't register new action if old action with the same id is already registered
classes/controllers/FrmFormsController.php CHANGED
@@ -7,7 +7,7 @@ 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
  self::maybe_load_listing_hooks();
13
  }
@@ -25,17 +25,17 @@ class FrmFormsController {
25
  }
26
 
27
  public static function head() {
28
- wp_enqueue_script('formidable-editinplace');
29
 
30
  if ( wp_is_mobile() ) {
31
  wp_enqueue_script( 'jquery-touch-punch' );
32
  }
33
  }
34
 
35
- public static function register_widgets() {
36
- require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
37
- register_widget('FrmShowForm');
38
- }
39
 
40
  /**
41
  * By default, Divi processes form shortcodes on the edit post page.
@@ -48,32 +48,32 @@ class FrmFormsController {
48
  return $shortcodes;
49
  }
50
 
51
- public static function list_form() {
52
- FrmAppHelper::permission_check('frm_view_forms');
53
 
54
  $params = FrmForm::list_page_params();
55
- $errors = self::process_bulk_form_actions( array());
56
- $errors = apply_filters('frm_admin_list_form_action', $errors);
57
 
58
  return self::display_forms_list( $params, '', $errors );
59
- }
60
 
61
  public static function new_form( $values = array() ) {
62
- FrmAppHelper::permission_check('frm_edit_forms');
63
 
64
  global $frm_vars;
65
 
66
- $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
67
  $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
68
 
69
  if ( $action == 'create' ) {
70
- self::create($values);
71
  return;
72
  } else if ( $action == 'new' ) {
73
  $frm_field_selection = FrmField::field_selection();
74
- $values = FrmFormsHelper::setup_new_vars($values);
75
  $id = FrmForm::create( $values );
76
- $form = FrmForm::getOne($id);
77
 
78
  self::create_default_email_action( $form );
79
 
@@ -101,7 +101,7 @@ class FrmFormsController {
101
  }
102
 
103
  public static function create( $values = array() ) {
104
- FrmAppHelper::permission_check('frm_edit_forms');
105
 
106
  global $frm_vars;
107
  if ( empty( $values ) ) {
@@ -113,22 +113,22 @@ class FrmFormsController {
113
  $values = FrmProEntry::mod_other_vals( $values, 'back' );
114
  }
115
 
116
- $id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
117
 
118
  if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
119
  $frm_settings = FrmAppHelper::get_settings();
120
  $errors = array( 'form' => $frm_settings->admin_permission );
121
  } else {
122
- $errors = FrmForm::validate($values);
123
  }
124
 
125
- if ( count($errors) > 0 ) {
126
  $hide_preview = true;
127
  $frm_field_selection = FrmField::field_selection();
128
  $form = FrmForm::getOne( $id );
129
- $fields = FrmField::get_all_for_form($id);
130
 
131
- $values = FrmAppHelper::setup_edit_vars($form, 'forms', '', true);
132
  $values['fields'] = $fields;
133
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
134
 
@@ -141,32 +141,32 @@ class FrmFormsController {
141
  }
142
 
143
  public static function edit( $values = false ) {
144
- FrmAppHelper::permission_check('frm_edit_forms');
145
 
146
  $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
147
- return self::get_edit_vars($id);
148
  }
149
 
150
  public static function settings( $id = false, $message = '' ) {
151
- FrmAppHelper::permission_check('frm_edit_forms');
152
 
153
- if ( ! $id || ! is_numeric($id) ) {
154
  $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
155
  }
156
  return self::get_settings_vars( $id, array(), $message );
157
  }
158
 
159
  public static function update_settings() {
160
- FrmAppHelper::permission_check('frm_edit_forms');
161
 
162
  $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
163
 
164
- $errors = FrmForm::validate($_POST);
165
- if ( count($errors) > 0 ) {
166
- return self::get_settings_vars($id, $errors);
167
- }
168
 
169
- do_action('frm_before_update_form_settings', $id);
170
 
171
  FrmForm::update( $id, $_POST );
172
 
@@ -210,7 +210,7 @@ class FrmFormsController {
210
  * @since 2.0
211
  */
212
  public static function _create_from_template() {
213
- FrmAppHelper::permission_check('frm_edit_forms');
214
  check_ajax_referer( 'frm_ajax', 'nonce' );
215
 
216
  $current_form = FrmAppHelper::get_param( 'this_form', '', 'get', 'absint' );
@@ -225,7 +225,7 @@ class FrmFormsController {
225
  }
226
 
227
  public static function duplicate() {
228
- FrmAppHelper::permission_check('frm_edit_forms');
229
 
230
  $params = FrmForm::list_page_params();
231
  $form = FrmForm::duplicate( $params['id'], $params['template'], true );
@@ -233,7 +233,7 @@ class FrmFormsController {
233
  if ( $form ) {
234
  return self::get_edit_vars( $form, array(), $message, true );
235
  } else {
236
- return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
237
  }
238
  }
239
 
@@ -375,11 +375,11 @@ class FrmFormsController {
375
  }
376
 
377
  public static function bulk_untrash( $ids ) {
378
- FrmAppHelper::permission_check('frm_edit_forms');
379
 
380
  $count = FrmForm::set_status( $ids, 'published' );
381
 
382
- $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
383
  return $message;
384
  }
385
 
@@ -425,7 +425,7 @@ class FrmFormsController {
425
  'type' => 'request',
426
  ) );
427
 
428
- $available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
429
  $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=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
430
 
431
  $message = $available_status[ $status ]['message'];
@@ -434,7 +434,7 @@ class FrmFormsController {
434
  }
435
 
436
  public static function bulk_trash( $ids ) {
437
- FrmAppHelper::permission_check('frm_delete_forms');
438
 
439
  $count = 0;
440
  foreach ( $ids as $id ) {
@@ -453,25 +453,25 @@ class FrmFormsController {
453
  }
454
 
455
  public static function destroy() {
456
- FrmAppHelper::permission_check('frm_delete_forms');
457
 
458
  $params = FrmForm::list_page_params();
459
 
460
  //check nonce url
461
- check_admin_referer('destroy_form_' . $params['id']);
462
 
463
  $count = 0;
464
  if ( FrmForm::destroy( $params['id'] ) ) {
465
  $count++;
466
  }
467
 
468
- $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
469
 
470
  self::display_forms_list( $params, $message );
471
  }
472
 
473
  public static function bulk_destroy( $ids ) {
474
- FrmAppHelper::permission_check('frm_delete_forms');
475
 
476
  $count = 0;
477
  foreach ( $ids as $id ) {
@@ -481,21 +481,21 @@ class FrmFormsController {
481
  }
482
  }
483
 
484
- $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
485
 
486
  return $message;
487
  }
488
 
489
  private static function delete_all() {
490
  //check nonce url
491
- $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
492
  if ( $permission_error !== false ) {
493
  self::display_forms_list( array(), '', array( $permission_error ) );
494
  return;
495
  }
496
 
497
  $count = FrmForm::scheduled_delete( time() );
498
- $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
499
 
500
  self::display_forms_list( array(), $message );
501
  }
@@ -507,7 +507,7 @@ class FrmFormsController {
507
  * @since 2.0.15
508
  */
509
  public static function insert_form_button() {
510
- if ( current_user_can('frm_view_forms') ) {
511
  $menu_name = FrmAppHelper::get_menu_name();
512
  $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' ) . '">
513
  <span class="frm-buttons-icon wp-media-buttons-icon"></span> ' .
@@ -531,17 +531,17 @@ class FrmFormsController {
531
  ),
532
  );
533
 
534
- $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
535
 
536
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
537
  }
538
 
539
  public static function get_shortcode_opts() {
540
- FrmAppHelper::permission_check('frm_view_forms');
541
  check_ajax_referer( 'frm_ajax', 'nonce' );
542
 
543
  $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
544
- if ( empty($shortcode) ) {
545
  wp_die();
546
  }
547
 
@@ -680,11 +680,11 @@ class FrmFormsController {
680
  }
681
 
682
  if ( $form->parent_form_id ) {
683
- 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>' ));
684
  }
685
 
686
  $frm_field_selection = FrmField::field_selection();
687
- $fields = FrmField::get_all_for_form($form->id);
688
 
689
  // Automatically add end section fields if they don't exist (2.0 migration)
690
  $reset_fields = false;
@@ -694,7 +694,7 @@ class FrmFormsController {
694
  $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
695
  }
696
 
697
- unset($end_section_values, $last_order, $open, $reset_fields);
698
 
699
  $args = array( 'parent_form_id' => $form->id );
700
  $values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true, array(), $args );
@@ -708,8 +708,8 @@ class FrmFormsController {
708
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
709
 
710
  if ( $form->default_template ) {
711
- wp_die(__( 'That template cannot be edited', 'formidable' ));
712
- } else if ( defined('DOING_AJAX') ) {
713
  wp_die();
714
  } else if ( $create_link ) {
715
  require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
@@ -725,21 +725,21 @@ class FrmFormsController {
725
 
726
  $form = FrmForm::getOne( $id );
727
 
728
- $fields = FrmField::get_all_for_form($id);
729
- $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
730
 
731
- if ( isset($values['default_template']) && $values['default_template'] ) {
732
- wp_die(__( 'That template cannot be edited', 'formidable' ));
733
- }
734
 
735
  self::clean_submit_html( $values );
736
 
737
  $action_controls = FrmFormActionsController::get_form_actions();
738
 
739
- $sections = apply_filters('frm_add_form_settings_section', array(), $values);
740
  $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
741
 
742
- $styles = apply_filters('frm_get_style_opts', array());
743
 
744
  $first_h3 = 'frm_first_h3';
745
 
@@ -760,10 +760,10 @@ class FrmFormsController {
760
  }
761
 
762
  public static function mb_tags_box( $form_id, $class = '' ) {
763
- $fields = FrmField::get_all_for_form($form_id, '', 'include');
764
  $linked_forms = array();
765
  $col = 'one';
766
- $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
767
 
768
  $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
769
  $adv_shortcodes = self::get_advanced_shortcodes();
@@ -838,7 +838,7 @@ class FrmFormsController {
838
  * Insert the form class setting into the form
839
  */
840
  public static function form_classes( $form ) {
841
- if ( isset($form->options['form_class']) ) {
842
  echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
843
  }
844
 
@@ -946,7 +946,7 @@ class FrmFormsController {
946
  public static function add_default_templates( $path, $default = true, $template = true ) {
947
  _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
948
 
949
- $path = untrailingslashit(trim($path));
950
  $templates = glob( $path . '/*.php' );
951
 
952
  for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
@@ -971,9 +971,9 @@ class FrmFormsController {
971
  include( $templates[ $i ] );
972
 
973
  //get updated form
974
- if ( isset($form) && ! empty($form) ) {
975
  $old_id = $form->id;
976
- $form = FrmForm::getOne($form->id);
977
  } else {
978
  $old_id = false;
979
  $form = FrmForm::getAll( $template_query, '', 1 );
@@ -986,23 +986,23 @@ class FrmFormsController {
986
  }
987
 
988
  public static function route() {
989
- $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
990
  $vars = array();
991
  if ( isset( $_POST['frm_compact_fields'] ) ) {
992
  FrmAppHelper::permission_check( 'frm_edit_forms' );
993
 
994
- $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
995
- $json_vars = json_decode($json_vars, true);
996
- if ( empty($json_vars) ) {
997
  // json decoding failed so we should return an error message
998
  $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
999
  if ( 'edit' == $action ) {
1000
  $action = 'update';
1001
  }
1002
 
1003
- add_filter('frm_validate_form', 'FrmFormsController::json_error');
1004
  } else {
1005
- $vars = FrmAppHelper::json_to_array($json_vars);
1006
  $action = $vars[ $action ];
1007
  unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1008
  $_REQUEST = array_merge( $_REQUEST, $vars );
@@ -1021,7 +1021,7 @@ class FrmFormsController {
1021
 
1022
  switch ( $action ) {
1023
  case 'new':
1024
- return self::new_form($vars);
1025
  case 'create':
1026
  case 'edit':
1027
  case 'update':
@@ -1044,7 +1044,7 @@ class FrmFormsController {
1044
  $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1045
  }
1046
 
1047
- if ( strpos($action, 'bulk_') === 0 ) {
1048
  FrmAppHelper::remove_get_action();
1049
  return self::list_form();
1050
  }
@@ -1071,21 +1071,21 @@ class FrmFormsController {
1071
 
1072
  public static function admin_bar_configure() {
1073
  global $frm_vars;
1074
- if ( empty($frm_vars['forms_loaded']) ) {
1075
  return;
1076
  }
1077
 
1078
  $actions = array();
1079
- foreach ( $frm_vars['forms_loaded'] as $form ) {
1080
- if ( is_object($form) ) {
1081
- $actions[ $form->id ] = $form->name;
1082
- }
1083
- unset($form);
1084
- }
1085
 
1086
- if ( empty($actions) ) {
1087
- return;
1088
- }
1089
 
1090
  self::add_menu_to_admin_bar();
1091
  self::add_forms_to_admin_bar( $actions );
@@ -1129,7 +1129,7 @@ class FrmFormsController {
1129
  //formidable shortcode
1130
  public static function get_form_shortcode( $atts ) {
1131
  global $frm_vars;
1132
- if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1133
  $sc = '[formidable';
1134
  if ( ! empty( $atts ) ) {
1135
  foreach ( $atts as $k => $v ) {
@@ -1399,6 +1399,7 @@ class FrmFormsController {
1399
  $opt = $args['success_opt'];
1400
  $success_url = trim( $args['form']->options[ $opt . '_url' ] );
1401
  $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
 
1402
 
1403
  $success_msg = isset( $args['form']->options[ $opt . '_msg' ] ) ? $args['form']->options[ $opt . '_msg' ] : __( 'Please wait while you are redirected.', 'formidable' );
1404
 
@@ -1408,7 +1409,7 @@ class FrmFormsController {
1408
  FrmEntriesController::delete_entry_before_redirect( $success_url, $args['form'], $args );
1409
 
1410
  add_filter( 'frm_redirect_url', 'FrmEntriesController::prepare_redirect_url' );
1411
- $success_url = apply_filters( 'frm_redirect_url', $success_url, $args['form'], $args);
1412
 
1413
  $doing_ajax = FrmAppHelper::doing_ajax();
1414
 
@@ -1434,7 +1435,7 @@ class FrmFormsController {
1434
  */
1435
  private static function get_redirect_message( $success_url, $success_msg, $args ) {
1436
  $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg frm_message">' . $success_msg . '<br/>' .
1437
- sprintf( __( '%1$sClick here%2$s if you are not automatically redirected.', 'formidable' ), '<a href="' . esc_url( $success_url ) . '">', '</a>') .
1438
  '</div></div>';
1439
 
1440
  return apply_filters( 'frm_redirect_msg', $redirect_msg, array(
@@ -1668,7 +1669,7 @@ class FrmFormsController {
1668
  private static function edit_in_place_value( $field ) {
1669
  _deprecated_function( __METHOD__, '3.0' );
1670
  check_ajax_referer( 'frm_ajax', 'nonce' );
1671
- FrmAppHelper::permission_check('frm_edit_forms', 'hide');
1672
 
1673
  $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
1674
  $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
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
  }
25
  }
26
 
27
  public static function head() {
28
+ wp_enqueue_script( 'formidable-editinplace' );
29
 
30
  if ( wp_is_mobile() ) {
31
  wp_enqueue_script( 'jquery-touch-punch' );
32
  }
33
  }
34
 
35
+ public static function register_widgets() {
36
+ require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
37
+ register_widget( 'FrmShowForm' );
38
+ }
39
 
40
  /**
41
  * By default, Divi processes form shortcodes on the edit post page.
48
  return $shortcodes;
49
  }
50
 
51
+ public static function list_form() {
52
+ FrmAppHelper::permission_check( 'frm_view_forms' );
53
 
54
  $params = FrmForm::list_page_params();
55
+ $errors = self::process_bulk_form_actions( array() );
56
+ $errors = apply_filters( 'frm_admin_list_form_action', $errors );
57
 
58
  return self::display_forms_list( $params, '', $errors );
59
+ }
60
 
61
  public static function new_form( $values = array() ) {
62
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
63
 
64
  global $frm_vars;
65
 
66
+ $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
67
  $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
68
 
69
  if ( $action == 'create' ) {
70
+ self::create( $values );
71
  return;
72
  } else if ( $action == 'new' ) {
73
  $frm_field_selection = FrmField::field_selection();
74
+ $values = FrmFormsHelper::setup_new_vars( $values );
75
  $id = FrmForm::create( $values );
76
+ $form = FrmForm::getOne( $id );
77
 
78
  self::create_default_email_action( $form );
79
 
101
  }
102
 
103
  public static function create( $values = array() ) {
104
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
105
 
106
  global $frm_vars;
107
  if ( empty( $values ) ) {
113
  $values = FrmProEntry::mod_other_vals( $values, 'back' );
114
  }
115
 
116
+ $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
117
 
118
  if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
119
  $frm_settings = FrmAppHelper::get_settings();
120
  $errors = array( 'form' => $frm_settings->admin_permission );
121
  } else {
122
+ $errors = FrmForm::validate( $values );
123
  }
124
 
125
+ if ( count( $errors ) > 0 ) {
126
  $hide_preview = true;
127
  $frm_field_selection = FrmField::field_selection();
128
  $form = FrmForm::getOne( $id );
129
+ $fields = FrmField::get_all_for_form( $id );
130
 
131
+ $values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true );
132
  $values['fields'] = $fields;
133
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
134
 
141
  }
142
 
143
  public static function edit( $values = false ) {
144
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
145
 
146
  $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
147
+ return self::get_edit_vars( $id );
148
  }
149
 
150
  public static function settings( $id = false, $message = '' ) {
151
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
152
 
153
+ if ( ! $id || ! is_numeric( $id ) ) {
154
  $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
155
  }
156
  return self::get_settings_vars( $id, array(), $message );
157
  }
158
 
159
  public static function update_settings() {
160
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
161
 
162
  $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
163
 
164
+ $errors = FrmForm::validate( $_POST );
165
+ if ( count( $errors ) > 0 ) {
166
+ return self::get_settings_vars( $id, $errors );
167
+ }
168
 
169
+ do_action( 'frm_before_update_form_settings', $id );
170
 
171
  FrmForm::update( $id, $_POST );
172
 
210
  * @since 2.0
211
  */
212
  public static function _create_from_template() {
213
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
214
  check_ajax_referer( 'frm_ajax', 'nonce' );
215
 
216
  $current_form = FrmAppHelper::get_param( 'this_form', '', 'get', 'absint' );
225
  }
226
 
227
  public static function duplicate() {
228
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
229
 
230
  $params = FrmForm::list_page_params();
231
  $form = FrmForm::duplicate( $params['id'], $params['template'], true );
233
  if ( $form ) {
234
  return self::get_edit_vars( $form, array(), $message, true );
235
  } else {
236
+ return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
237
  }
238
  }
239
 
375
  }
376
 
377
  public static function bulk_untrash( $ids ) {
378
+ FrmAppHelper::permission_check( 'frm_edit_forms' );
379
 
380
  $count = FrmForm::set_status( $ids, 'published' );
381
 
382
+ $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
383
  return $message;
384
  }
385
 
425
  'type' => 'request',
426
  ) );
427
 
428
+ $available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
429
  $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=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
430
 
431
  $message = $available_status[ $status ]['message'];
434
  }
435
 
436
  public static function bulk_trash( $ids ) {
437
+ FrmAppHelper::permission_check( 'frm_delete_forms' );
438
 
439
  $count = 0;
440
  foreach ( $ids as $id ) {
453
  }
454
 
455
  public static function destroy() {
456
+ FrmAppHelper::permission_check( 'frm_delete_forms' );
457
 
458
  $params = FrmForm::list_page_params();
459
 
460
  //check nonce url
461
+ check_admin_referer( 'destroy_form_' . $params['id'] );
462
 
463
  $count = 0;
464
  if ( FrmForm::destroy( $params['id'] ) ) {
465
  $count++;
466
  }
467
 
468
+ $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
469
 
470
  self::display_forms_list( $params, $message );
471
  }
472
 
473
  public static function bulk_destroy( $ids ) {
474
+ FrmAppHelper::permission_check( 'frm_delete_forms' );
475
 
476
  $count = 0;
477
  foreach ( $ids as $id ) {
481
  }
482
  }
483
 
484
+ $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
485
 
486
  return $message;
487
  }
488
 
489
  private static function delete_all() {
490
  //check nonce url
491
+ $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
492
  if ( $permission_error !== false ) {
493
  self::display_forms_list( array(), '', array( $permission_error ) );
494
  return;
495
  }
496
 
497
  $count = FrmForm::scheduled_delete( time() );
498
+ $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
499
 
500
  self::display_forms_list( array(), $message );
501
  }
507
  * @since 2.0.15
508
  */
509
  public static function insert_form_button() {
510
+ if ( current_user_can( 'frm_view_forms' ) ) {
511
  $menu_name = FrmAppHelper::get_menu_name();
512
  $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' ) . '">
513
  <span class="frm-buttons-icon wp-media-buttons-icon"></span> ' .
531
  ),
532
  );
533
 
534
+ $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
535
 
536
  include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
537
  }
538
 
539
  public static function get_shortcode_opts() {
540
+ FrmAppHelper::permission_check( 'frm_view_forms' );
541
  check_ajax_referer( 'frm_ajax', 'nonce' );
542
 
543
  $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
544
+ if ( empty( $shortcode ) ) {
545
  wp_die();
546
  }
547
 
680
  }
681
 
682
  if ( $form->parent_form_id ) {
683
+ 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>' ) );
684
  }
685
 
686
  $frm_field_selection = FrmField::field_selection();
687
+ $fields = FrmField::get_all_for_form( $form->id );
688
 
689
  // Automatically add end section fields if they don't exist (2.0 migration)
690
  $reset_fields = false;
694
  $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
695
  }
696
 
697
+ unset( $end_section_values, $last_order, $open, $reset_fields );
698
 
699
  $args = array( 'parent_form_id' => $form->id );
700
  $values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true, array(), $args );
708
  $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
709
 
710
  if ( $form->default_template ) {
711
+ wp_die( __( 'That template cannot be edited', 'formidable' ) );
712
+ } elseif ( defined( 'DOING_AJAX' ) ) {
713
  wp_die();
714
  } else if ( $create_link ) {
715
  require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
725
 
726
  $form = FrmForm::getOne( $id );
727
 
728
+ $fields = FrmField::get_all_for_form( $id );
729
+ $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
730
 
731
+ if ( isset( $values['default_template'] ) && $values['default_template'] ) {
732
+ wp_die( __( 'That template cannot be edited', 'formidable' ) );
733
+ }
734
 
735
  self::clean_submit_html( $values );
736
 
737
  $action_controls = FrmFormActionsController::get_form_actions();
738
 
739
+ $sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
740
  $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
741
 
742
+ $styles = apply_filters( 'frm_get_style_opts', array() );
743
 
744
  $first_h3 = 'frm_first_h3';
745
 
760
  }
761
 
762
  public static function mb_tags_box( $form_id, $class = '' ) {
763
+ $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
764
  $linked_forms = array();
765
  $col = 'one';
766
+ $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
767
 
768
  $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
769
  $adv_shortcodes = self::get_advanced_shortcodes();
838
  * Insert the form class setting into the form
839
  */
840
  public static function form_classes( $form ) {
841
+ if ( isset( $form->options['form_class'] ) ) {
842
  echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
843
  }
844
 
946
  public static function add_default_templates( $path, $default = true, $template = true ) {
947
  _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
948
 
949
+ $path = untrailingslashit( trim( $path ) );
950
  $templates = glob( $path . '/*.php' );
951
 
952
  for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
971
  include( $templates[ $i ] );
972
 
973
  //get updated form
974
+ if ( isset( $form ) && ! empty( $form ) ) {
975
  $old_id = $form->id;
976
+ $form = FrmForm::getOne( $form->id );
977
  } else {
978
  $old_id = false;
979
  $form = FrmForm::getAll( $template_query, '', 1 );
986
  }
987
 
988
  public static function route() {
989
+ $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
990
  $vars = array();
991
  if ( isset( $_POST['frm_compact_fields'] ) ) {
992
  FrmAppHelper::permission_check( 'frm_edit_forms' );
993
 
994
+ $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
995
+ $json_vars = json_decode( $json_vars, true );
996
+ if ( empty( $json_vars ) ) {
997
  // json decoding failed so we should return an error message
998
  $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
999
  if ( 'edit' == $action ) {
1000
  $action = 'update';
1001
  }
1002
 
1003
+ add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1004
  } else {
1005
+ $vars = FrmAppHelper::json_to_array( $json_vars );
1006
  $action = $vars[ $action ];
1007
  unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1008
  $_REQUEST = array_merge( $_REQUEST, $vars );
1021
 
1022
  switch ( $action ) {
1023
  case 'new':
1024
+ return self::new_form( $vars );
1025
  case 'create':
1026
  case 'edit':
1027
  case 'update':
1044
  $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1045
  }
1046
 
1047
+ if ( strpos( $action, 'bulk_' ) === 0 ) {
1048
  FrmAppHelper::remove_get_action();
1049
  return self::list_form();
1050
  }
1071
 
1072
  public static function admin_bar_configure() {
1073
  global $frm_vars;
1074
+ if ( empty( $frm_vars['forms_loaded'] ) ) {
1075
  return;
1076
  }
1077
 
1078
  $actions = array();
1079
+ foreach ( $frm_vars['forms_loaded'] as $form ) {
1080
+ if ( is_object( $form ) ) {
1081
+ $actions[ $form->id ] = $form->name;
1082
+ }
1083
+ unset( $form );
1084
+ }
1085
 
1086
+ if ( empty( $actions ) ) {
1087
+ return;
1088
+ }
1089
 
1090
  self::add_menu_to_admin_bar();
1091
  self::add_forms_to_admin_bar( $actions );
1129
  //formidable shortcode
1130
  public static function get_form_shortcode( $atts ) {
1131
  global $frm_vars;
1132
+ if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1133
  $sc = '[formidable';
1134
  if ( ! empty( $atts ) ) {
1135
  foreach ( $atts as $k => $v ) {
1399
  $opt = $args['success_opt'];
1400
  $success_url = trim( $args['form']->options[ $opt . '_url' ] );
1401
  $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
1402
+ $success_url = do_shortcode( $success_url );
1403
 
1404
  $success_msg = isset( $args['form']->options[ $opt . '_msg' ] ) ? $args['form']->options[ $opt . '_msg' ] : __( 'Please wait while you are redirected.', 'formidable' );
1405
 
1409
  FrmEntriesController::delete_entry_before_redirect( $success_url, $args['form'], $args );
1410
 
1411
  add_filter( 'frm_redirect_url', 'FrmEntriesController::prepare_redirect_url' );
1412
+ $success_url = apply_filters( 'frm_redirect_url', $success_url, $args['form'], $args );
1413
 
1414
  $doing_ajax = FrmAppHelper::doing_ajax();
1415
 
1435
  */
1436
  private static function get_redirect_message( $success_url, $success_msg, $args ) {
1437
  $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg frm_message">' . $success_msg . '<br/>' .
1438
+ sprintf( __( '%1$sClick here%2$s if you are not automatically redirected.', 'formidable' ), '<a href="' . esc_url( $success_url ) . '">', '</a>' ) .
1439
  '</div></div>';
1440
 
1441
  return apply_filters( 'frm_redirect_msg', $redirect_msg, array(
1669
  private static function edit_in_place_value( $field ) {
1670
  _deprecated_function( __METHOD__, '3.0' );
1671
  check_ajax_referer( 'frm_ajax', 'nonce' );
1672
+ FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
1673
 
1674
  $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
1675
  $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
classes/controllers/FrmSettingsController.php CHANGED
@@ -46,7 +46,7 @@ class FrmSettingsController {
46
  }
47
 
48
  public static function load_settings_tab() {
49
- FrmAppHelper::permission_check('frm_change_settings');
50
  check_ajax_referer( 'frm_ajax', 'nonce' );
51
 
52
  $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
46
  }
47
 
48
  public static function load_settings_tab() {
49
+ FrmAppHelper::permission_check( 'frm_change_settings' );
50
  check_ajax_referer( 'frm_ajax', 'nonce' );
51
 
52
  $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
classes/controllers/FrmStylesController.php CHANGED
@@ -58,11 +58,7 @@ class FrmStylesController {
58
  }
59
 
60
  wp_enqueue_script( 'jquery-ui-datepicker' );
61
-
62
- $version = FrmAppHelper::plugin_version();
63
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
64
- wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker' . $suffix . '.js', array( 'jquery' ), $version );
65
-
66
  wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) );
67
 
68
  $style = apply_filters( 'frm_style_head', false );
@@ -365,13 +361,6 @@ class FrmStylesController {
365
  $defaults = $frm_style->get_defaults();
366
  $style = '';
367
 
368
- // remove the # from the colors
369
- foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
370
- if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) {
371
- $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
372
- }
373
- }
374
-
375
  echo '<style type="text/css">';
376
  include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
377
  echo '</style>';
@@ -408,6 +397,9 @@ class FrmStylesController {
408
 
409
  public static function include_style_section( $atts, $sec ) {
410
  extract( $atts );
 
 
 
411
  $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
412
  $file_name = FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php';
413
 
58
  }
59
 
60
  wp_enqueue_script( 'jquery-ui-datepicker' );
61
+ wp_enqueue_style( 'wp-color-picker' );
 
 
 
 
62
  wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) );
63
 
64
  $style = apply_filters( 'frm_style_head', false );
361
  $defaults = $frm_style->get_defaults();
362
  $style = '';
363
 
 
 
 
 
 
 
 
364
  echo '<style type="text/css">';
365
  include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
366
  echo '</style>';
397
 
398
  public static function include_style_section( $atts, $sec ) {
399
  extract( $atts );
400
+ $style = $atts['style'];
401
+ FrmStylesHelper::prepare_color_output( $style->post_content, false );
402
+
403
  $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
404
  $file_name = FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php';
405
 
classes/helpers/FrmAppHelper.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ( ! defined('ABSPATH') ) {
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
 
@@ -11,7 +11,7 @@ class FrmAppHelper {
11
  /**
12
  * @since 2.0
13
  */
14
- public static $plug_version = '3.01';
15
 
16
  /**
17
  * @since 1.07.02
@@ -23,13 +23,13 @@ class FrmAppHelper {
23
  return self::$plug_version;
24
  }
25
 
26
- public static function plugin_folder() {
27
- return basename(self::plugin_path());
28
- }
29
 
30
- public static function plugin_path() {
31
- return dirname(dirname(dirname(__FILE__)));
32
- }
33
 
34
  public static function plugin_url() {
35
  //prevously FRM_URL constant
@@ -54,9 +54,9 @@ class FrmAppHelper {
54
  * @since 2.0
55
  * @return string
56
  */
57
- public static function site_name() {
58
- return get_option('blogname');
59
- }
60
 
61
  public static function make_affiliate_url( $url ) {
62
  $affiliate_id = self::get_affiliate();
@@ -79,13 +79,13 @@ class FrmAppHelper {
79
  * @param None
80
  * @return FrmSettings $frm_setings
81
  */
82
- public static function get_settings() {
83
- global $frm_settings;
84
- if ( empty($frm_settings) ) {
85
- $frm_settings = new FrmSettings();
86
- }
87
- return $frm_settings;
88
- }
89
 
90
  public static function get_menu_name() {
91
  $frm_settings = FrmAppHelper::get_settings();
@@ -100,9 +100,9 @@ class FrmAppHelper {
100
  return ! $frm_settings->no_ips;
101
  }
102
 
103
- public static function pro_is_installed() {
104
- return apply_filters('frm_pro_installed', false);
105
- }
106
 
107
  public static function is_formidable_admin() {
108
  $page = self::simple_get( 'page', 'sanitize_title' );
@@ -170,13 +170,13 @@ class FrmAppHelper {
170
 
171
  /**
172
  * Use the WP 4.7 wp_doing_ajax function
173
- * @sine 2.05.07
174
  */
175
  public static function wp_doing_ajax() {
176
  if ( function_exists( 'wp_doing_ajax' ) ) {
177
  $doing_ajax = wp_doing_ajax();
178
  } else {
179
- $doing_ajax = defined('DOING_AJAX') && DOING_AJAX;
180
  }
181
  return $doing_ajax;
182
  }
@@ -242,9 +242,9 @@ class FrmAppHelper {
242
  }
243
 
244
  foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
245
- $ip = trim($ip); // just to be safe
246
 
247
- if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
248
  return sanitize_text_field( $ip );
249
  }
250
  }
@@ -254,8 +254,8 @@ class FrmAppHelper {
254
  }
255
 
256
  public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
257
- if ( strpos($param, '[') ) {
258
- $params = explode('[', $param);
259
  $param = $params[0];
260
  }
261
 
@@ -275,15 +275,15 @@ class FrmAppHelper {
275
  }
276
 
277
  if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
278
- foreach ( $params as $k => $p ) {
279
- if ( ! $k || ! is_array($value) ) {
280
- continue;
281
- }
282
 
283
- $p = trim($p, ']');
284
- $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
285
- }
286
- }
287
 
288
  return $value;
289
  }
@@ -518,10 +518,10 @@ class FrmAppHelper {
518
  * Used when switching the action for a bulk action
519
  * @since 2.0
520
  */
521
- public static function remove_get_action() {
522
- if ( ! isset($_GET) ) {
523
- return;
524
- }
525
 
526
  $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
527
  if ( ! empty( $new_action ) ) {
@@ -637,10 +637,10 @@ class FrmAppHelper {
637
  $pages = self::get_pages();
638
  $selected = self::get_post_param( $field_name, $page_id, 'absint' );
639
  ?>
640
- <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
641
  <option value=""> </option>
642
  <?php foreach ( $pages as $page ) { ?>
643
- <option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
644
  <?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
645
  </option>
646
  <?php } ?>
@@ -649,7 +649,7 @@ class FrmAppHelper {
649
  }
650
 
651
  public static function post_edit_link( $post_id ) {
652
- $post = get_post($post_id);
653
  if ( $post ) {
654
  $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
655
  return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
@@ -659,7 +659,7 @@ class FrmAppHelper {
659
 
660
  public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
661
  ?>
662
- <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php echo ( 'multiple' === $multiple ) ? 'multiple="multiple"' : ''; ?> class="frm_multiselect">
663
  <?php self::roles_options( $capability ); ?>
664
  </select>
665
  <?php
@@ -667,7 +667,7 @@ class FrmAppHelper {
667
 
668
  public static function roles_options( $capability ) {
669
  global $frm_vars;
670
- if ( isset($frm_vars['editable_roles']) ) {
671
  $editable_roles = $frm_vars['editable_roles'];
672
  } else {
673
  $editable_roles = get_editable_roles();
@@ -677,9 +677,9 @@ class FrmAppHelper {
677
  foreach ( $editable_roles as $role => $details ) {
678
  $name = translate_user_role( $details['name'] );
679
  ?>
680
- <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
681
  <?php
682
- unset($role, $details);
683
  }
684
  }
685
 
@@ -735,16 +735,16 @@ class FrmAppHelper {
735
  public static function maybe_add_permissions() {
736
  self::force_capability( 'frm_view_entries' );
737
 
738
- if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
739
- return;
740
- }
741
 
742
  $user_id = get_current_user_id();
743
  $user = new WP_User( $user_id );
744
  $frm_roles = self::frm_capabilities();
745
  foreach ( $frm_roles as $frm_role => $frm_role_description ) {
746
  $user->add_cap( $frm_role );
747
- unset($frm_role, $frm_role_description);
748
  }
749
  }
750
 
@@ -769,12 +769,12 @@ class FrmAppHelper {
769
  * @param string $permission
770
  */
771
  public static function permission_check( $permission, $show_message = 'show' ) {
772
- $permission_error = self::permission_nonce_error($permission);
773
  if ( $permission_error !== false ) {
774
  if ( 'hide' == $show_message ) {
775
  $permission_error = '';
776
  }
777
- wp_die($permission_error);
778
  }
779
  }
780
 
@@ -791,7 +791,7 @@ class FrmAppHelper {
791
  }
792
 
793
  $error = false;
794
- if ( empty($nonce_name) ) {
795
  return $error;
796
  }
797
 
@@ -851,7 +851,7 @@ class FrmAppHelper {
851
  public static function array_flatten( $array, $keys = 'keep' ) {
852
  $return = array();
853
  foreach ( $array as $key => $value ) {
854
- if ( is_array($value) ) {
855
  $return = array_merge( $return, self::array_flatten( $value, $keys ) );
856
  } else {
857
  if ( $keys == 'keep' ) {
@@ -878,11 +878,11 @@ class FrmAppHelper {
878
  * @since 2.0
879
  */
880
  public static function use_wpautop( $content ) {
881
- if ( apply_filters('frm_use_wpautop', true) ) {
882
- $content = wpautop(str_replace( '<br>', '<br />', $content));
883
- }
884
- return $content;
885
- }
886
 
887
  public static function replace_quotes( $val ) {
888
  //Replace double quotes
@@ -898,7 +898,7 @@ class FrmAppHelper {
898
  */
899
  public static function jquery_ui_base_url() {
900
  $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
901
- $url = apply_filters('frm_jquery_ui_base_url', $url);
902
  return $url;
903
  }
904
 
@@ -929,7 +929,7 @@ class FrmAppHelper {
929
  }
930
 
931
  public static function get_user_id_param( $user_id ) {
932
- if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
933
  return $user_id;
934
  }
935
 
@@ -937,33 +937,33 @@ class FrmAppHelper {
937
  if ( $user_id == 'current' ) {
938
  $user_id = get_current_user_id();
939
  } else {
940
- if ( is_email($user_id) ) {
941
- $user = get_user_by('email', $user_id);
942
- } else {
943
- $user = get_user_by('login', $user_id);
944
- }
945
 
946
  if ( $user ) {
947
  $user_id = $user->ID;
948
  }
949
- unset($user);
950
  }
951
 
952
  return $user_id;
953
  }
954
 
955
  public static function get_file_contents( $filename, $atts = array() ) {
956
- if ( ! is_file($filename) ) {
957
- return false;
958
- }
959
 
960
- extract($atts);
961
- ob_start();
962
- include($filename);
963
- $contents = ob_get_contents();
964
- ob_end_clean();
965
- return $contents;
966
- }
967
 
968
  /**
969
  * @param string $table_name
@@ -975,16 +975,16 @@ class FrmAppHelper {
975
  $key = '';
976
 
977
  if ( ! empty( $name ) ) {
978
- $key = sanitize_key($name);
979
  }
980
 
981
  if ( empty( $key ) ) {
982
- $max_slug_value = pow(36, $num_chars);
983
  $min_slug_value = 37; // we want to have at least 2 characters in the slug
984
- $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
985
  }
986
 
987
- if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
988
  $key = $key . 'a';
989
  }
990
 
@@ -993,7 +993,7 @@ class FrmAppHelper {
993
  'ID !' => $id,
994
  ), $column );
995
 
996
- if ( $key_check || is_numeric($key_check) ) {
997
  $suffix = 2;
998
  do {
999
  $alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
@@ -1018,9 +1018,9 @@ class FrmAppHelper {
1018
  return false;
1019
  }
1020
 
1021
- if ( empty($post_values) ) {
1022
- $post_values = stripslashes_deep($_POST);
1023
- }
1024
 
1025
  $values = array(
1026
  'id' => $record->id,
@@ -1028,14 +1028,14 @@ class FrmAppHelper {
1028
  );
1029
 
1030
  foreach ( array( 'name', 'description' ) as $var ) {
1031
- $default_val = isset($record->{$var}) ? $record->{$var} : '';
1032
  $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
1033
- unset($var, $default_val);
1034
- }
1035
 
1036
- $values['description'] = self::use_wpautop($values['description']);
1037
 
1038
- self::fill_form_opts($record, $table, $post_values, $values);
1039
 
1040
  self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) );
1041
 
@@ -1051,7 +1051,7 @@ class FrmAppHelper {
1051
  private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1052
  if ( ! empty( $fields ) ) {
1053
  foreach ( (array) $fields as $field ) {
1054
- $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
1055
  $args['parent_form_id'] = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
1056
  self::fill_field_defaults( $field, $record, $values, $args );
1057
  }
@@ -1064,8 +1064,8 @@ class FrmAppHelper {
1064
  if ( $args['default'] ) {
1065
  $meta_value = $field->default_value;
1066
  } else {
1067
- if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1068
- if ( ! isset($field->field_options['custom_field']) ) {
1069
  $field->field_options['custom_field'] = '';
1070
  }
1071
  $meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array(
@@ -1091,7 +1091,7 @@ class FrmAppHelper {
1091
 
1092
  FrmFieldsHelper::prepare_edit_front_field( $field_array, $field, $values['id'], $args );
1093
 
1094
- if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1095
  $field_array['unique_msg'] = '';
1096
  }
1097
 
@@ -1134,18 +1134,18 @@ class FrmAppHelper {
1134
  return;
1135
  }
1136
 
1137
- $values['form_name'] = isset($record->form_id) ? $form->name : '';
1138
  $values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1139
 
1140
- if ( ! is_array($form->options) ) {
1141
- return;
1142
- }
1143
 
1144
  foreach ( $form->options as $opt => $value ) {
1145
  $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1146
  }
1147
 
1148
- self::fill_form_defaults($post_values, $values);
1149
  }
1150
 
1151
  /**
@@ -1159,7 +1159,7 @@ class FrmAppHelper {
1159
  $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1160
  }
1161
 
1162
- unset($opt, $defaut);
1163
  }
1164
 
1165
  if ( ! isset( $values['custom_style'] ) ) {
@@ -1170,7 +1170,7 @@ class FrmAppHelper {
1170
  if ( ! isset( $values[ $h . '_html' ] ) ) {
1171
  $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1172
  }
1173
- unset($h);
1174
  }
1175
  }
1176
 
@@ -1197,9 +1197,9 @@ class FrmAppHelper {
1197
  }
1198
  ?>
1199
  <li>
1200
- <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['id']) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1201
- <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['key']) ?>" >[<?php echo esc_attr( self::truncate($args['key'], 10) ) ?>]</a>
1202
- <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr($args['id']) ?>" ><?php echo esc_attr( self::truncate($args['name'], 60) ) ?></a>
1203
  </li>
1204
  <?php
1205
  }
@@ -1228,18 +1228,18 @@ class FrmAppHelper {
1228
  foreach ( $words as $word ) {
1229
  $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1230
  $total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1231
- if ( $total_len > $length && str_word_count($sub) ) {
1232
  break;
1233
  }
1234
 
1235
  $sub .= $part;
1236
  $len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1237
 
1238
- if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1239
  break;
1240
  }
1241
 
1242
- unset($total_len, $word);
1243
  }
1244
 
1245
  return $sub . ( ( $len < $original_len ) ? $continue : '' );
@@ -1255,17 +1255,17 @@ class FrmAppHelper {
1255
  }
1256
 
1257
  public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1258
- if ( empty($date) ) {
1259
  return $date;
1260
  }
1261
 
1262
- if ( empty($date_format) ) {
1263
- $date_format = get_option('date_format');
1264
- }
1265
 
1266
- if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1267
  $frmpro_settings = new FrmProSettings();
1268
- $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1269
  }
1270
 
1271
  $formatted = self::get_localized_date( $date_format, $date );
@@ -1280,7 +1280,7 @@ class FrmAppHelper {
1280
 
1281
  private static function add_time_to_date( $time_format, $date ) {
1282
  if ( empty( $time_format ) ) {
1283
- $time_format = get_option('time_format');
1284
  }
1285
 
1286
  $trimmed_format = trim( $time_format );
@@ -1384,21 +1384,21 @@ class FrmAppHelper {
1384
  public static function json_to_array( $json_vars ) {
1385
  $vars = array();
1386
  foreach ( $json_vars as $jv ) {
1387
- $jv_name = explode('[', $jv['name']);
1388
- $last = count($jv_name) - 1;
1389
- foreach ( $jv_name as $p => $n ) {
1390
- $name = trim($n, ']');
1391
- if ( ! isset($l1) ) {
1392
- $l1 = $name;
1393
- }
1394
 
1395
- if ( ! isset($l2) ) {
1396
- $l2 = $name;
1397
- }
1398
 
1399
- if ( ! isset($l3) ) {
1400
- $l3 = $name;
1401
- }
1402
 
1403
  $this_val = ( $p == $last ) ? $jv['value'] : array();
1404
 
@@ -1423,10 +1423,10 @@ class FrmAppHelper {
1423
  self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1424
  }
1425
 
1426
- unset($this_val, $n);
1427
  }
1428
 
1429
- unset($last, $jv);
1430
  }
1431
 
1432
  return $vars;
@@ -1536,17 +1536,17 @@ class FrmAppHelper {
1536
  }
1537
 
1538
  public static function maybe_json_decode( $string ) {
1539
- if ( is_array($string) ) {
1540
  return $string;
1541
  }
1542
 
1543
- $new_string = json_decode($string, true);
1544
- if ( function_exists('json_last_error') ) {
1545
  // php 5.3+
1546
  if ( json_last_error() == JSON_ERROR_NONE ) {
1547
  $string = $new_string;
1548
  }
1549
- } else if ( isset($new_string) ) {
1550
  // php < 5.3 fallback
1551
  $string = $new_string;
1552
  }
@@ -1562,11 +1562,11 @@ class FrmAppHelper {
1562
  public static function maybe_highlight_menu( $post_type ) {
1563
  global $post;
1564
 
1565
- if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1566
  return;
1567
  }
1568
 
1569
- if ( is_object($post) && $post->post_type != $post_type ) {
1570
  return;
1571
  }
1572
 
@@ -1619,6 +1619,7 @@ class FrmAppHelper {
1619
  'id' => __( 'ID', 'formidable' ),
1620
  'no_results' => __( 'No results match', 'formidable' ),
1621
  'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
 
1622
  'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
1623
  ) );
1624
 
@@ -1655,6 +1656,9 @@ class FrmAppHelper {
1655
  'private' => __( 'Private' ),
1656
  'jquery_ui_url' => self::jquery_ui_base_url(),
1657
  'no_licenses' => __( 'No new licenses were found', 'formidable' ),
 
 
 
1658
  'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
1659
  ) );
1660
  }
@@ -1670,11 +1674,11 @@ class FrmAppHelper {
1670
  $frm_version = self::plugin_version();
1671
 
1672
  // check if Formidable meets minimum requirements
1673
- if ( version_compare($frm_version, $min_version, '>=') ) {
1674
  return;
1675
  }
1676
 
1677
- $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1678
  echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1679
  __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1680
  '</div></td></tr>';
@@ -1756,8 +1760,8 @@ class FrmAppHelper {
1756
  $unset = array( 'en', 'fil', 'fr-CA', 'de-AT', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419', 'tr' );
1757
  }
1758
 
1759
- $locales = array_diff_key($locales, array_flip($unset));
1760
- $locales = apply_filters('frm_locales', $locales);
1761
 
1762
  return $locales;
1763
  }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
 
11
  /**
12
  * @since 2.0
13
  */
14
+ public static $plug_version = '3.01.01';
15
 
16
  /**
17
  * @since 1.07.02
23
  return self::$plug_version;
24
  }
25
 
26
+ public static function plugin_folder() {
27
+ return basename( self::plugin_path() );
28
+ }
29
 
30
+ public static function plugin_path() {
31
+ return dirname( dirname( dirname( __FILE__ ) ) );
32
+ }
33
 
34
  public static function plugin_url() {
35
  //prevously FRM_URL constant
54
  * @since 2.0
55
  * @return string
56
  */
57
+ public static function site_name() {
58
+ return get_option( 'blogname' );
59
+ }
60
 
61
  public static function make_affiliate_url( $url ) {
62
  $affiliate_id = self::get_affiliate();
79
  * @param None
80
  * @return FrmSettings $frm_setings
81
  */
82
+ public static function get_settings() {
83
+ global $frm_settings;
84
+ if ( empty( $frm_settings ) ) {
85
+ $frm_settings = new FrmSettings();
86
+ }
87
+ return $frm_settings;
88
+ }
89
 
90
  public static function get_menu_name() {
91
  $frm_settings = FrmAppHelper::get_settings();
100
  return ! $frm_settings->no_ips;
101
  }
102
 
103
+ public static function pro_is_installed() {
104
+ return apply_filters( 'frm_pro_installed', false );
105
+ }
106
 
107
  public static function is_formidable_admin() {
108
  $page = self::simple_get( 'page', 'sanitize_title' );
170
 
171
  /**
172
  * Use the WP 4.7 wp_doing_ajax function
173
+ * @since 2.05.07
174
  */
175
  public static function wp_doing_ajax() {
176
  if ( function_exists( 'wp_doing_ajax' ) ) {
177
  $doing_ajax = wp_doing_ajax();
178
  } else {
179
+ $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
180
  }
181
  return $doing_ajax;
182
  }
242
  }
243
 
244
  foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
245
+ $ip = trim( $ip ); // just to be safe
246
 
247
+ if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
248
  return sanitize_text_field( $ip );
249
  }
250
  }
254
  }
255
 
256
  public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
257
+ if ( strpos( $param, '[' ) ) {
258
+ $params = explode( '[', $param );
259
  $param = $params[0];
260
  }
261
 
275
  }
276
 
277
  if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
278
+ foreach ( $params as $k => $p ) {
279
+ if ( ! $k || ! is_array( $value ) ) {
280
+ continue;
281
+ }
282
 
283
+ $p = trim( $p, ']' );
284
+ $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
285
+ }
286
+ }
287
 
288
  return $value;
289
  }
518
  * Used when switching the action for a bulk action
519
  * @since 2.0
520
  */
521
+ public static function remove_get_action() {
522
+ if ( ! isset( $_GET ) ) {
523
+ return;
524
+ }
525
 
526
  $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
527
  if ( ! empty( $new_action ) ) {
637
  $pages = self::get_pages();
638
  $selected = self::get_post_param( $field_name, $page_id, 'absint' );
639
  ?>
640
+ <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
641
  <option value=""> </option>
642
  <?php foreach ( $pages as $page ) { ?>
643
+ <option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $selected, $page->ID ); ?>>
644
  <?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
645
  </option>
646
  <?php } ?>
649
  }
650
 
651
  public static function post_edit_link( $post_id ) {
652
+ $post = get_post( $post_id );
653
  if ( $post ) {
654
  $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
655
  return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
659
 
660
  public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
661
  ?>
662
+ <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" <?php echo ( 'multiple' === $multiple ) ? 'multiple="multiple"' : ''; ?> class="frm_multiselect">
663
  <?php self::roles_options( $capability ); ?>
664
  </select>
665
  <?php
667
 
668
  public static function roles_options( $capability ) {
669
  global $frm_vars;
670
+ if ( isset( $frm_vars['editable_roles'] ) ) {
671
  $editable_roles = $frm_vars['editable_roles'];
672
  } else {
673
  $editable_roles = get_editable_roles();
677
  foreach ( $editable_roles as $role => $details ) {
678
  $name = translate_user_role( $details['name'] );
679
  ?>
680
+ <option value="<?php echo esc_attr( $role ); ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ); ?> </option>
681
  <?php
682
+ unset( $role, $details );
683
  }
684
  }
685
 
735
  public static function maybe_add_permissions() {
736
  self::force_capability( 'frm_view_entries' );
737
 
738
+ if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
739
+ return;
740
+ }
741
 
742
  $user_id = get_current_user_id();
743
  $user = new WP_User( $user_id );
744
  $frm_roles = self::frm_capabilities();
745
  foreach ( $frm_roles as $frm_role => $frm_role_description ) {
746
  $user->add_cap( $frm_role );
747
+ unset( $frm_role, $frm_role_description );
748
  }
749
  }
750
 
769
  * @param string $permission
770
  */
771
  public static function permission_check( $permission, $show_message = 'show' ) {
772
+ $permission_error = self::permission_nonce_error( $permission );
773
  if ( $permission_error !== false ) {
774
  if ( 'hide' == $show_message ) {
775
  $permission_error = '';
776
  }
777
+ wp_die( $permission_error );
778
  }
779
  }
780
 
791
  }
792
 
793
  $error = false;
794
+ if ( empty( $nonce_name ) ) {
795
  return $error;
796
  }
797
 
851
  public static function array_flatten( $array, $keys = 'keep' ) {
852
  $return = array();
853
  foreach ( $array as $key => $value ) {
854
+ if ( is_array( $value ) ) {
855
  $return = array_merge( $return, self::array_flatten( $value, $keys ) );
856
  } else {
857
  if ( $keys == 'keep' ) {
878
  * @since 2.0
879
  */
880
  public static function use_wpautop( $content ) {
881
+ if ( apply_filters( 'frm_use_wpautop', true ) ) {
882
+ $content = wpautop( str_replace( '<br>', '<br />', $content ) );
883
+ }
884
+ return $content;
885
+ }
886
 
887
  public static function replace_quotes( $val ) {
888
  //Replace double quotes
898
  */
899
  public static function jquery_ui_base_url() {
900
  $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
901
+ $url = apply_filters( 'frm_jquery_ui_base_url', $url );
902
  return $url;
903
  }
904
 
929
  }
930
 
931
  public static function get_user_id_param( $user_id ) {
932
+ if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
933
  return $user_id;
934
  }
935
 
937
  if ( $user_id == 'current' ) {
938
  $user_id = get_current_user_id();
939
  } else {
940
+ if ( is_email( $user_id ) ) {
941
+ $user = get_user_by( 'email', $user_id );
942
+ } else {
943
+ $user = get_user_by( 'login', $user_id );
944
+ }
945
 
946
  if ( $user ) {
947
  $user_id = $user->ID;
948
  }
949
+ unset( $user );
950
  }
951
 
952
  return $user_id;
953
  }
954
 
955
  public static function get_file_contents( $filename, $atts = array() ) {
956
+ if ( ! is_file( $filename ) ) {
957
+ return false;
958
+ }
959
 
960
+ extract( $atts );
961
+ ob_start();
962
+ include( $filename );
963
+ $contents = ob_get_contents();
964
+ ob_end_clean();
965
+ return $contents;
966
+ }
967
 
968
  /**
969
  * @param string $table_name
975
  $key = '';
976
 
977
  if ( ! empty( $name ) ) {
978
+ $key = sanitize_key( $name );
979
  }
980
 
981
  if ( empty( $key ) ) {
982
+ $max_slug_value = pow( 36, $num_chars );
983
  $min_slug_value = 37; // we want to have at least 2 characters in the slug
984
+ $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
985
  }
986
 
987
+ if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
988
  $key = $key . 'a';
989
  }
990
 
993
  'ID !' => $id,
994
  ), $column );
995
 
996
+ if ( $key_check || is_numeric( $key_check ) ) {
997
  $suffix = 2;
998
  do {
999
  $alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
1018
  return false;
1019
  }
1020
 
1021
+ if ( empty( $post_values ) ) {
1022
+ $post_values = stripslashes_deep( $_POST );
1023
+ }
1024
 
1025
  $values = array(
1026
  'id' => $record->id,
1028
  );
1029
 
1030
  foreach ( array( 'name', 'description' ) as $var ) {
1031
+ $default_val = isset( $record->{$var} ) ? $record->{$var} : '';
1032
  $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
1033
+ unset( $var, $default_val );
1034
+ }
1035
 
1036
+ $values['description'] = self::use_wpautop( $values['description'] );
1037
 
1038
+ self::fill_form_opts( $record, $table, $post_values, $values );
1039
 
1040
  self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) );
1041
 
1051
  private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1052
  if ( ! empty( $fields ) ) {
1053
  foreach ( (array) $fields as $field ) {
1054
+ $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
1055
  $args['parent_form_id'] = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
1056
  self::fill_field_defaults( $field, $record, $values, $args );
1057
  }
1064
  if ( $args['default'] ) {
1065
  $meta_value = $field->default_value;
1066
  } else {
1067
+ if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
1068
+ if ( ! isset( $field->field_options['custom_field'] ) ) {
1069
  $field->field_options['custom_field'] = '';
1070
  }
1071
  $meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array(
1091
 
1092
  FrmFieldsHelper::prepare_edit_front_field( $field_array, $field, $values['id'], $args );
1093
 
1094
+ if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1095
  $field_array['unique_msg'] = '';
1096
  }
1097
 
1134
  return;
1135
  }
1136
 
1137
+ $values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1138
  $values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1139
 
1140
+ if ( ! is_array( $form->options ) ) {
1141
+ return;
1142
+ }
1143
 
1144
  foreach ( $form->options as $opt => $value ) {
1145
  $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1146
  }
1147
 
1148
+ self::fill_form_defaults( $post_values, $values );
1149
  }
1150
 
1151
  /**
1159
  $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1160
  }
1161
 
1162
+ unset( $opt, $default );
1163
  }
1164
 
1165
  if ( ! isset( $values['custom_style'] ) ) {
1170
  if ( ! isset( $values[ $h . '_html' ] ) ) {
1171
  $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1172
  }
1173
+ unset( $h );
1174
  }
1175
  }
1176
 
1197
  }
1198
  ?>
1199
  <li>
1200
+ <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['id'] ); ?>" >[<?php echo esc_attr( $args['id'] ); ?>]</a>
1201
+ <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['key'] ); ?>" >[<?php echo esc_attr( self::truncate( $args['key'], 10 ) ); ?>]</a>
1202
+ <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['id'] ); ?>" ><?php echo esc_attr( self::truncate( $args['name'], 60 ) ); ?></a>
1203
  </li>
1204
  <?php
1205
  }
1228
  foreach ( $words as $word ) {
1229
  $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1230
  $total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1231
+ if ( $total_len > $length && str_word_count( $sub ) ) {
1232
  break;
1233
  }
1234
 
1235
  $sub .= $part;
1236
  $len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1237
 
1238
+ if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1239
  break;
1240
  }
1241
 
1242
+ unset( $total_len, $word );
1243
  }
1244
 
1245
  return $sub . ( ( $len < $original_len ) ? $continue : '' );
1255
  }
1256
 
1257
  public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1258
+ if ( empty( $date ) ) {
1259
  return $date;
1260
  }
1261
 
1262
+ if ( empty( $date_format ) ) {
1263
+ $date_format = get_option( 'date_format' );
1264
+ }
1265
 
1266
+ if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1267
  $frmpro_settings = new FrmProSettings();
1268
+ $date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1269
  }
1270
 
1271
  $formatted = self::get_localized_date( $date_format, $date );
1280
 
1281
  private static function add_time_to_date( $time_format, $date ) {
1282
  if ( empty( $time_format ) ) {
1283
+ $time_format = get_option( 'time_format' );
1284
  }
1285
 
1286
  $trimmed_format = trim( $time_format );
1384
  public static function json_to_array( $json_vars ) {
1385
  $vars = array();
1386
  foreach ( $json_vars as $jv ) {
1387
+ $jv_name = explode( '[', $jv['name'] );
1388
+ $last = count( $jv_name ) - 1;
1389
+ foreach ( $jv_name as $p => $n ) {
1390
+ $name = trim( $n, ']' );
1391
+ if ( ! isset( $l1 ) ) {
1392
+ $l1 = $name;
1393
+ }
1394
 
1395
+ if ( ! isset( $l2 ) ) {
1396
+ $l2 = $name;
1397
+ }
1398
 
1399
+ if ( ! isset( $l3 ) ) {
1400
+ $l3 = $name;
1401
+ }
1402
 
1403
  $this_val = ( $p == $last ) ? $jv['value'] : array();
1404
 
1423
  self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1424
  }
1425
 
1426
+ unset( $this_val, $n );
1427
  }
1428
 
1429
+ unset( $last, $jv );
1430
  }
1431
 
1432
  return $vars;
1536
  }
1537
 
1538
  public static function maybe_json_decode( $string ) {
1539
+ if ( is_array( $string ) ) {
1540
  return $string;
1541
  }
1542
 
1543
+ $new_string = json_decode( $string, true );
1544
+ if ( function_exists( 'json_last_error' ) ) {
1545
  // php 5.3+
1546
  if ( json_last_error() == JSON_ERROR_NONE ) {
1547
  $string = $new_string;
1548
  }
1549
+ } elseif ( isset( $new_string ) ) {
1550
  // php < 5.3 fallback
1551
  $string = $new_string;
1552
  }
1562
  public static function maybe_highlight_menu( $post_type ) {
1563
  global $post;
1564
 
1565
+ if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1566
  return;
1567
  }
1568
 
1569
+ if ( is_object( $post ) && $post->post_type != $post_type ) {
1570
  return;
1571
  }
1572
 
1619
  'id' => __( 'ID', 'formidable' ),
1620
  'no_results' => __( 'No results match', 'formidable' ),
1621
  'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
1622
+ 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
1623
  'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
1624
  ) );
1625
 
1656
  'private' => __( 'Private' ),
1657
  'jquery_ui_url' => self::jquery_ui_base_url(),
1658
  'no_licenses' => __( 'No new licenses were found', 'formidable' ),
1659
+ 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ),
1660
+ 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ),
1661
+ 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ),
1662
  'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
1663
  ) );
1664
  }
1674
  $frm_version = self::plugin_version();
1675
 
1676
  // check if Formidable meets minimum requirements
1677
+ if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1678
  return;
1679
  }
1680
 
1681
+ $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1682
  echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1683
  __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1684
  '</div></td></tr>';
1760
  $unset = array( 'en', 'fil', 'fr-CA', 'de-AT', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419', 'tr' );
1761
  }
1762
 
1763
+ $locales = array_diff_key( $locales, array_flip( $unset ) );
1764
+ $locales = apply_filters( 'frm_locales', $locales );
1765
 
1766
  return $locales;
1767
  }
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ( ! defined('ABSPATH') ) {
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
 
@@ -13,9 +13,9 @@ class FrmEntriesHelper {
13
  );
14
 
15
  $values['fields'] = array();
16
- if ( empty($fields) ) {
17
- return apply_filters('frm_setup_new_entry', $values);
18
- }
19
 
20
  foreach ( (array) $fields as $field ) {
21
  $original_default = $field->default_value;
@@ -36,9 +36,9 @@ class FrmEntriesHelper {
36
 
37
  $values['fields'][] = $field_array;
38
 
39
- if ( ! $form || ! isset($form->id) ) {
40
- $form = FrmForm::getOne($field->form_id);
41
- }
42
  }
43
 
44
  $form->options = maybe_unserialize( $form->options );
@@ -98,7 +98,7 @@ class FrmEntriesHelper {
98
  }
99
 
100
  if ( ! is_array( $new_value ) ) {
101
- $new_value = str_replace('"', '&quot;', $new_value);
102
  }
103
 
104
  return $new_value;
@@ -131,26 +131,26 @@ class FrmEntriesHelper {
131
  $values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
132
  $values['form_id'] = $record->form_id;
133
  $values['is_draft'] = $record->is_draft;
134
- return apply_filters('frm_setup_edit_entry_vars', $values, $record);
135
  }
136
 
137
  public static function replace_default_message( $message, $atts ) {
138
- if ( strpos($message, '[default-message') === false &&
139
- strpos($message, '[default_message') === false &&
140
  ! empty( $message ) ) {
141
  return $message;
142
  }
143
 
144
- if ( empty($message) ) {
145
  $message = '[default-message]';
146
  }
147
 
148
- preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
149
 
150
  foreach ( $shortcodes[0] as $short_key => $tag ) {
151
  $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
152
  if ( ! empty( $add_atts ) ) {
153
- $this_atts = array_merge($atts, $add_atts);
154
  } else {
155
  $this_atts = $atts;
156
  }
@@ -171,14 +171,14 @@ class FrmEntriesHelper {
171
  FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
172
  }
173
 
174
- if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
175
- return self::display_value($field_value, $field, $atts);
176
- }
177
 
178
  // this is an embeded form
179
  $val = '';
180
 
181
- if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
182
  //this is a repeating section
183
  $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
184
  } else {
@@ -192,7 +192,7 @@ class FrmEntriesHelper {
192
 
193
  $field_value = array();
194
 
195
- if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
196
  return $val;
197
  }
198
 
@@ -201,17 +201,17 @@ class FrmEntriesHelper {
201
  $atts['post_id'] = $child_entry->post_id;
202
 
203
  // get the value for this field -- check for post values as well
204
- $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
205
 
206
  if ( $entry_val ) {
207
  // foreach entry get display_value
208
- $field_value[] = self::display_value($entry_val, $field, $atts);
209
  }
210
 
211
- unset($child_entry);
212
  }
213
 
214
- $val = implode(', ', (array) $field_value );
215
  return FrmAppHelper::kses( $val, 'all' );
216
  }
217
 
@@ -246,22 +246,22 @@ class FrmEntriesHelper {
246
  $atts['html'] = true;
247
  }
248
 
249
- $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
250
 
251
- if ( ! isset($field->field_options['post_field']) ) {
252
  $field->field_options['post_field'] = '';
253
  }
254
 
255
- if ( ! isset($field->field_options['custom_field']) ) {
256
  $field->field_options['custom_field'] = '';
257
  }
258
 
259
  if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
260
  $atts['pre_truncate'] = $atts['truncate'];
261
  $atts['truncate'] = true;
262
- $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
263
 
264
- $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
265
  $atts['truncate'] = $atts['pre_truncate'];
266
  }
267
 
@@ -270,7 +270,7 @@ class FrmEntriesHelper {
270
  }
271
 
272
  $unfiltered_value = maybe_unserialize( $value );
273
- $value = apply_filters('frm_display_value_custom', $unfiltered_value, $field, $atts);
274
  $value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
275
 
276
  if ( $value == $unfiltered_value ) {
@@ -278,7 +278,7 @@ class FrmEntriesHelper {
278
  }
279
 
280
  if ( $atts['truncate'] && $atts['type'] != 'url' ) {
281
- $value = FrmAppHelper::truncate($value, 50);
282
  }
283
 
284
  if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
@@ -293,7 +293,7 @@ class FrmEntriesHelper {
293
  if ( isset( $args['other'] ) && $args['other'] ) {
294
  $value = $args['temp_value'];
295
  }
296
- if ( empty($args['parent_field_id']) ) {
297
  $_POST['item_meta'][ $field->id ] = $value;
298
  } else {
299
  $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
@@ -303,7 +303,7 @@ class FrmEntriesHelper {
303
  public static function get_posted_value( $field, &$value, $args ) {
304
  $field_id = is_object( $field ) ? $field->id : $field;
305
 
306
- if ( empty($args['parent_field_id']) ) {
307
  $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
308
  } else {
309
  $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
@@ -395,7 +395,7 @@ class FrmEntriesHelper {
395
  }
396
  } else {
397
  // Radio and dropdowns
398
- $other_key = array_filter( array_keys($field->options), 'is_string');
399
  $other_key = reset( $other_key );
400
 
401
  // Multi-select dropdown
@@ -432,7 +432,7 @@ class FrmEntriesHelper {
432
  $content .= "\n\n";
433
  }
434
 
435
- if ( is_array($val) ) {
436
  $val = FrmAppHelper::array_flatten( $val );
437
  $val = implode( ', ', $val );
438
  }
@@ -496,7 +496,7 @@ class FrmEntriesHelper {
496
  preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
497
 
498
  // see how many we have
499
- $i = count($matches['browser']);
500
 
501
  if ( $i > 1 ) {
502
  //we will have two since we are not using 'other' argument yet
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
 
13
  );
14
 
15
  $values['fields'] = array();
16
+ if ( empty( $fields ) ) {
17
+ return apply_filters( 'frm_setup_new_entry', $values );
18
+ }
19
 
20
  foreach ( (array) $fields as $field ) {
21
  $original_default = $field->default_value;
36
 
37
  $values['fields'][] = $field_array;
38
 
39
+ if ( ! $form || ! isset( $form->id ) ) {
40
+ $form = FrmForm::getOne( $field->form_id );
41
+ }
42
  }
43
 
44
  $form->options = maybe_unserialize( $form->options );
98
  }
99
 
100
  if ( ! is_array( $new_value ) ) {
101
+ $new_value = str_replace( '"', '&quot;', $new_value );
102
  }
103
 
104
  return $new_value;
131
  $values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
132
  $values['form_id'] = $record->form_id;
133
  $values['is_draft'] = $record->is_draft;
134
+ return apply_filters( 'frm_setup_edit_entry_vars', $values, $record );
135
  }
136
 
137
  public static function replace_default_message( $message, $atts ) {
138
+ if ( strpos( $message, '[default-message' ) === false &&
139
+ strpos( $message, '[default_message' ) === false &&
140
  ! empty( $message ) ) {
141
  return $message;
142
  }
143
 
144
+ if ( empty( $message ) ) {
145
  $message = '[default-message]';
146
  }
147
 
148
+ preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER );
149
 
150
  foreach ( $shortcodes[0] as $short_key => $tag ) {
151
  $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
152
  if ( ! empty( $add_atts ) ) {
153
+ $this_atts = array_merge( $atts, $add_atts );
154
  } else {
155
  $this_atts = $atts;
156
  }
171
  FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
172
  }
173
 
174
+ if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) {
175
+ return self::display_value( $field_value, $field, $atts );
176
+ }
177
 
178
  // this is an embeded form
179
  $val = '';
180
 
181
+ if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) {
182
  //this is a repeating section
183
  $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
184
  } else {
192
 
193
  $field_value = array();
194
 
195
+ if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
196
  return $val;
197
  }
198
 
201
  $atts['post_id'] = $child_entry->post_id;
202
 
203
  // get the value for this field -- check for post values as well
204
+ $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field );
205
 
206
  if ( $entry_val ) {
207
  // foreach entry get display_value
208
+ $field_value[] = self::display_value( $entry_val, $field, $atts );
209
  }
210
 
211
+ unset( $child_entry );
212
  }
213
 
214
+ $val = implode( ', ', (array) $field_value );
215
  return FrmAppHelper::kses( $val, 'all' );
216
  }
217
 
246
  $atts['html'] = true;
247
  }
248
 
249
+ $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value );
250
 
251
+ if ( ! isset( $field->field_options['post_field'] ) ) {
252
  $field->field_options['post_field'] = '';
253
  }
254
 
255
+ if ( ! isset( $field->field_options['custom_field'] ) ) {
256
  $field->field_options['custom_field'] = '';
257
  }
258
 
259
  if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
260
  $atts['pre_truncate'] = $atts['truncate'];
261
  $atts['truncate'] = true;
262
+ $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
263
 
264
+ $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
265
  $atts['truncate'] = $atts['pre_truncate'];
266
  }
267
 
270
  }
271
 
272
  $unfiltered_value = maybe_unserialize( $value );
273
+ $value = apply_filters( 'frm_display_value_custom', $unfiltered_value, $field, $atts );
274
  $value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
275
 
276
  if ( $value == $unfiltered_value ) {
278
  }
279
 
280
  if ( $atts['truncate'] && $atts['type'] != 'url' ) {
281
+ $value = FrmAppHelper::truncate( $value, 50 );
282
  }
283
 
284
  if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
293
  if ( isset( $args['other'] ) && $args['other'] ) {
294
  $value = $args['temp_value'];
295
  }
296
+ if ( empty( $args['parent_field_id'] ) ) {
297
  $_POST['item_meta'][ $field->id ] = $value;
298
  } else {
299
  $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
303
  public static function get_posted_value( $field, &$value, $args ) {
304
  $field_id = is_object( $field ) ? $field->id : $field;
305
 
306
+ if ( empty( $args['parent_field_id'] ) ) {
307
  $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
308
  } else {
309
  $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
395
  }
396
  } else {
397
  // Radio and dropdowns
398
+ $other_key = array_filter( array_keys( $field->options ), 'is_string' );
399
  $other_key = reset( $other_key );
400
 
401
  // Multi-select dropdown
432
  $content .= "\n\n";
433
  }
434
 
435
+ if ( is_array( $val ) ) {
436
  $val = FrmAppHelper::array_flatten( $val );
437
  $val = implode( ', ', $val );
438
  }
496
  preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
497
 
498
  // see how many we have
499
+ $i = count( $matches['browser'] );
500
 
501
  if ( $i > 1 ) {
502
  //we will have two since we are not using 'other' argument yet
classes/helpers/FrmEntriesListHelper.php CHANGED
@@ -61,7 +61,7 @@ class FrmEntriesListHelper extends FrmListHelper {
61
 
62
  $limit = FrmDb::esc_limit( $start . ',' . $per_page );
63
  $this->items = FrmEntry::getAll( $s_query, $order, $limit, true, $join_form_in_query );
64
- $total_items = FrmEntry::getRecordCount($s_query);
65
 
66
  $this->set_pagination_args( array(
67
  'total_items' => $total_items,
@@ -74,7 +74,7 @@ class FrmEntriesListHelper extends FrmListHelper {
74
  'param' => 's',
75
  'sanitize' => 'sanitize_text_field',
76
  ) );
77
- if ( ! empty($s) ) {
78
  esc_html_e( 'No Entries Found', 'formidable' );
79
  return;
80
  }
@@ -83,7 +83,7 @@ class FrmEntriesListHelper extends FrmListHelper {
83
  $form = $this->params['form'];
84
 
85
  if ( $form_id ) {
86
- $form = FrmForm::getOne($form_id);
87
  }
88
  $colspan = $this->get_column_count();
89
 
@@ -158,7 +158,7 @@ class FrmEntriesListHelper extends FrmListHelper {
158
  }
159
 
160
  $attributes = 'class="' . esc_attr( $class ) . '"';
161
- unset($class);
162
  $attributes .= ' data-colname="' . $column_display_name . '"';
163
 
164
  $form_id = $this->params['form'] ? $this->params['form'] : 0;
@@ -183,7 +183,7 @@ class FrmEntriesListHelper extends FrmListHelper {
183
  }
184
  $r .= '</td>';
185
  }
186
- unset($val);
187
  }
188
  $r .= '</tr>';
189
 
@@ -240,12 +240,12 @@ class FrmEntriesListHelper extends FrmListHelper {
240
  private function get_actions( &$actions, $item, $view_link ) {
241
  $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>';
242
 
243
- if ( current_user_can('frm_delete_entries') ) {
244
  $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form'];
245
  $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" data-frmverify="' . esc_attr__( 'Are you sure?', 'formidable' ) . '">' . __( 'Delete' ) . '</a>';
246
  }
247
 
248
- $actions = apply_filters('frm_row_actions', $actions, $item);
249
  }
250
 
251
  private function get_column_value( $item, &$val ) {
61
 
62
  $limit = FrmDb::esc_limit( $start . ',' . $per_page );
63
  $this->items = FrmEntry::getAll( $s_query, $order, $limit, true, $join_form_in_query );
64
+ $total_items = FrmEntry::getRecordCount( $s_query );
65
 
66
  $this->set_pagination_args( array(
67
  'total_items' => $total_items,