Formidable Forms – Form Builder for WordPress - Version 2.0.09b

Version Description

Download this release

Release Info

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

Code changes from version 2.0.08 to 2.0.09b

Files changed (38) hide show
  1. classes/controllers/FrmAppController.php +27 -147
  2. classes/controllers/FrmEntriesController.php +23 -150
  3. classes/controllers/FrmFieldsController.php +15 -13
  4. classes/controllers/FrmFormActionsController.php +4 -4
  5. classes/controllers/FrmFormsController.php +112 -72
  6. classes/controllers/FrmHooksController.php +13 -6
  7. classes/controllers/FrmStylesController.php +71 -0
  8. classes/helpers/FrmAppHelper.php +87 -17
  9. classes/helpers/FrmEntriesHelper.php +56 -340
  10. classes/helpers/FrmEntriesListHelper.php +25 -2
  11. classes/helpers/FrmFieldsHelper.php +69 -134
  12. classes/helpers/FrmFormActionsHelper.php +14 -105
  13. classes/helpers/FrmFormsHelper.php +16 -76
  14. classes/helpers/FrmFormsListHelper.php +10 -0
  15. classes/helpers/FrmListHelper.php +4 -0
  16. classes/helpers/FrmXMLHelper.php +48 -17
  17. classes/models/FrmDb.php +6 -3
  18. classes/models/FrmEntry.php +53 -282
  19. classes/models/FrmEntryFormat.php +324 -0
  20. classes/models/FrmEntryMeta.php +3 -3
  21. classes/models/FrmEntryValidate.php +279 -0
  22. classes/models/FrmField.php +172 -2
  23. classes/models/FrmForm.php +169 -1
  24. classes/models/FrmFormAction.php +114 -13
  25. classes/models/FrmNotification.php +1 -1
  26. classes/views/frm-entries/form.php +1 -6
  27. classes/views/frm-entries/sidebar-shared.php +2 -4
  28. classes/views/frm-fields/import_choices.php +1 -1
  29. classes/views/frm-fields/input.php +4 -4
  30. classes/views/frm-fields/show-build.php +5 -5
  31. classes/views/frm-form-actions/default_actions.php +7 -14
  32. classes/views/frm-forms/add_field.php +12 -6
  33. classes/views/frm-forms/add_field_links.php +1 -1
  34. classes/views/shared/mb_adv_info.php +4 -4
  35. css/_single_theme.css.php +9 -0
  36. css/custom_theme.css.php +64 -11
  37. css/frm_admin.css +4 -1
  38. js/formidable.min.js +59 -57
classes/controllers/FrmAppController.php CHANGED
@@ -3,25 +3,24 @@
3
  class FrmAppController {
4
 
5
  public static function menu() {
6
- add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
7
- add_filter( 'admin_body_class', 'FrmAppController::wp_admin_body_class' );
8
-
9
  FrmAppHelper::maybe_add_permissions();
10
-
11
  if ( ! current_user_can( 'frm_view_forms' ) ) {
12
  return;
13
  }
14
 
15
- $count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) );
16
- $pos = ( (int) $count > 0 ) ? '22.7' : '29.3';
17
- $pos = apply_filters( 'frm_menu_position', $pos );
18
-
19
  $frm_settings = FrmAppHelper::get_settings();
20
- add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', $pos );
21
  }
22
 
 
 
 
 
 
 
 
23
  public static function load_wp_admin_style() {
24
- wp_enqueue_style( 'frm_fonts', FrmAppHelper::plugin_url() . '/css/frm_fonts.css', array(), FrmAppHelper::plugin_version() );
25
  }
26
 
27
  public static function get_form_nav( $form, $show_nav = '', $title = 'show' ) {
@@ -32,10 +31,10 @@ class FrmAppController {
32
  return;
33
  }
34
 
35
- $current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : ( isset( $_GET['post_type'] ) ? FrmAppHelper::simple_get( 'post_type', 'sanitize_title' ) : 'None' );
36
 
37
  if ( $form ) {
38
- FrmFormsHelper::maybe_get_form( $form );
39
 
40
  if ( is_object( $form ) ) {
41
  $id = $form->id;
@@ -149,7 +148,7 @@ class FrmAppController {
149
  wp_enqueue_style( 'widgets' );
150
  wp_enqueue_script( 'formidable' );
151
  wp_enqueue_script( 'formidable_admin' );
152
- self::localize_script( 'admin' );
153
 
154
  wp_enqueue_style( 'formidable-admin' );
155
  add_thickbox();
@@ -173,7 +172,7 @@ class FrmAppController {
173
  wp_enqueue_script( 'jquery-ui-draggable' );
174
  wp_enqueue_script( 'formidable_admin' );
175
  wp_enqueue_style( 'formidable-admin' );
176
- self::localize_script( 'admin' );
177
  }
178
  } else if ( $pagenow == 'widgets.php' ) {
179
  FrmAppHelper::load_admin_wide_js();
@@ -216,145 +215,27 @@ class FrmAppController {
216
  self::install( $old_db_version );
217
  }
218
  }
219
-
220
- $version = FrmAppHelper::plugin_version();
221
- wp_register_script( 'formidable', FrmAppHelper::plugin_url() . '/js/formidable.min.js', array( 'jquery' ), $version, true );
222
- wp_register_script( 'jquery-placeholder', FrmAppHelper::plugin_url() . '/js/jquery/jquery.placeholder.js', array( 'jquery' ), '2.0.7', true );
223
-
224
- if ( FrmAppHelper::is_admin() ) {
225
- // don't load this in back-end
226
- return;
227
- }
228
-
229
- self::localize_script( 'front' );
230
-
231
- $frm_settings = FrmAppHelper::get_settings();
232
-
233
- $style = apply_filters( 'get_frm_stylesheet', self::custom_stylesheet() );
234
- if ( $style ) {
235
- foreach ( (array) $style as $k => $file ) {
236
- wp_register_style( $k, $file, array(), $version );
237
- if ( 'all' == $frm_settings->load_style ) {
238
- wp_enqueue_style( $k );
239
- }
240
- unset( $k, $file );
241
- }
242
- }
243
- unset( $style );
244
-
245
- if ( $frm_settings->load_style == 'all' ) {
246
- global $frm_vars;
247
- $frm_vars['css_loaded'] = true;
248
- }
249
- }
250
-
251
- /**
252
- * @param string $location
253
- */
254
- public static function localize_script( $location ) {
255
- wp_localize_script( 'formidable', 'frm_js', array(
256
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
257
- 'images_url' => FrmAppHelper::plugin_url() . '/images',
258
- 'loading' => __( 'Loading…' ),
259
- 'remove' => __( 'Remove', 'formidable' ),
260
- 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
261
- 'nonce' => wp_create_nonce( 'frm_ajax' ),
262
- 'id' => __( 'ID', 'formidable' ),
263
- ) );
264
-
265
- if ( $location == 'admin' ) {
266
- $frm_settings = FrmAppHelper::get_settings();
267
- wp_localize_script( 'formidable_admin', 'frm_admin_js', array(
268
- 'confirm_uninstall' => __( 'Are you sure you want to do this? Clicking OK will delete all forms, form data, and all other Formidable data. There is no Undo.', 'formidable' ),
269
- 'desc' => __( '(Click to add description)', 'formidable' ),
270
- 'blank' => __( '(blank)', 'formidable' ),
271
- 'no_label' => __( '(no label)', 'formidable' ),
272
- 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
273
- 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
274
- 'ok' => __( 'OK' ),
275
- 'cancel' => __( 'Cancel', 'formidable' ),
276
- 'default' => __( 'Default', 'formidable' ),
277
- 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
278
- 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
279
- 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
280
- 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
281
- 'confirm' => __( 'Are you sure?', 'formidable' ),
282
- 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
283
- 'conf_delete_sec' => __( 'WARNING: This will delete all fields inside of the section as well.', 'formidable' ),
284
- 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
285
- 'default_unique' => $frm_settings->unique_msg,
286
- 'default_conf' => __( 'The entered values do not match', 'formidable' ),
287
- 'enter_email' => __( 'Enter Email', 'formidable' ),
288
- 'confirm_email' => __( 'Confirm Email', 'formidable' ),
289
- 'enter_password' => __( 'Enter Password', 'formidable' ),
290
- 'confirm_password' => __( 'Confirm Password', 'formidable' ),
291
- 'import_complete' => __( 'Import Complete', 'formidable' ),
292
- 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
293
- 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
294
- 'jquery_ui_url' => FrmAppHelper::jquery_ui_base_url(),
295
- ) );
296
- }
297
  }
298
 
299
- public static function custom_stylesheet() {
300
- global $frm_vars;
301
- $stylesheet_urls = array();
302
- self::maybe_enqueue_jquery_css();
303
-
304
- if ( ! isset( $frm_vars['css_loaded'] ) || ! $frm_vars['css_loaded'] ) {
305
- //include css in head
306
- self::get_url_to_custom_style( $stylesheet_urls );
307
- }
308
-
309
- return $stylesheet_urls;
310
- }
311
-
312
- private static function get_url_to_custom_style( &$stylesheet_urls ) {
313
- $uploads = FrmStylesHelper::get_upload_base();
314
- $saved_css_path = '/formidable/css/formidablepro.css';
315
- if ( is_readable( $uploads['basedir'] . $saved_css_path ) ) {
316
- $url = $uploads['baseurl'] . $saved_css_path;
317
- } else {
318
- $url = admin_url( 'admin-ajax.php' ) . '?action=frmpro_css';
319
- }
320
- $stylesheet_urls['formidable'] = $url;
321
  }
322
 
323
- private static function maybe_enqueue_jquery_css() {
324
- global $frm_vars;
325
- if ( isset( $frm_vars['datepicker_loaded'] ) && ! empty( $frm_vars['datepicker_loaded'] ) ) {
326
- FrmStylesHelper::enqueue_jquery_css();
327
- }
328
  }
329
 
330
- public static function load_css() {
331
- $css = get_transient( 'frmpro_css' );
332
-
333
- include( FrmAppHelper::plugin_path() . '/css/custom_theme.css.php' );
334
- wp_die();
335
- }
336
-
337
- public static function footer_js( $location = 'footer' ) {
338
- global $frm_vars;
339
-
340
- $frm_settings = FrmAppHelper::get_settings();
341
- if ( $frm_vars['load_css'] && ! FrmAppHelper::is_admin() && $frm_settings->load_style != 'none' ) {
342
- $css = apply_filters( 'get_frm_stylesheet', self::custom_stylesheet() );
343
-
344
- if ( ! empty( $css ) ) {
345
- foreach ( (array) $css as $css_key => $file ) {
346
- wp_enqueue_style( $css_key );
347
- unset( $css_key, $file );
348
- }
349
- }
350
- unset( $css );
351
- }
352
 
353
- if ( ! FrmAppHelper::is_admin() && $location != 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
354
- //load formidable js
355
- wp_enqueue_script( 'formidable' );
356
- }
357
- }
358
 
359
  /**
360
  * Run silent upgrade on each site in the network during a network upgrade.
@@ -458,7 +339,6 @@ class FrmAppController {
458
  wp_die();
459
  }
460
 
461
- //formidable shortcode
462
  public static function get_form_shortcode( $atts ) {
463
  _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
464
  return FrmFormsController::get_form_shortcode( $atts );
3
  class FrmAppController {
4
 
5
  public static function menu() {
 
 
 
6
  FrmAppHelper::maybe_add_permissions();
 
7
  if ( ! current_user_can( 'frm_view_forms' ) ) {
8
  return;
9
  }
10
 
 
 
 
 
11
  $frm_settings = FrmAppHelper::get_settings();
12
+ add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
  }
14
 
15
+ private static function get_menu_position() {
16
+ $count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) );
17
+ $pos = $count ? '22.7' : '29.3';
18
+ $pos = apply_filters( 'frm_menu_position', $pos );
19
+ return $pos;
20
+ }
21
+
22
  public static function load_wp_admin_style() {
23
+ FrmAppHelper::load_font_style();
24
  }
25
 
26
  public static function get_form_nav( $form, $show_nav = '', $title = 'show' ) {
31
  return;
32
  }
33
 
34
+ $current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
35
 
36
  if ( $form ) {
37
+ FrmForm::maybe_get_form( $form );
38
 
39
  if ( is_object( $form ) ) {
40
  $id = $form->id;
148
  wp_enqueue_style( 'widgets' );
149
  wp_enqueue_script( 'formidable' );
150
  wp_enqueue_script( 'formidable_admin' );
151
+ FrmAppHelper::localize_script( 'admin' );
152
 
153
  wp_enqueue_style( 'formidable-admin' );
154
  add_thickbox();
172
  wp_enqueue_script( 'jquery-ui-draggable' );
173
  wp_enqueue_script( 'formidable_admin' );
174
  wp_enqueue_style( 'formidable-admin' );
175
+ FrmAppHelper::localize_script( 'admin' );
176
  }
177
  } else if ( $pagenow == 'widgets.php' ) {
178
  FrmAppHelper::load_admin_wide_js();
215
  self::install( $old_db_version );
216
  }
217
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  }
219
 
220
+ public static function localize_script( $location ) {
221
+ _deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' );
222
+ return FrmAppHelper::localize_script( $location );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  }
224
 
225
+ public static function custom_stylesheet() {
226
+ _deprecated_function( __FUNCTION__, '2.0.9', 'FrmStylesController::custom_stylesheet' );
227
+ return FrmStylesController::custom_stylesheet();
 
 
228
  }
229
 
230
+ public static function load_css() {
231
+ _deprecated_function( __FUNCTION__, '2.0.9', 'FrmStylesController::load_saved_css' );
232
+ return FrmStylesController::load_saved_css();
233
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
 
235
+ public static function footer_js( $location = 'footer' ) {
236
+ _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
237
+ return FrmFormsController::footer_js( $location );
238
+ }
 
239
 
240
  /**
241
  * Run silent upgrade on each site in the network during a network upgrade.
339
  wp_die();
340
  }
341
 
 
342
  public static function get_form_shortcode( $atts ) {
343
  _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
344
  return FrmFormsController::get_form_shortcode( $atts );
classes/controllers/FrmEntriesController.php CHANGED
@@ -10,7 +10,6 @@ class FrmEntriesController {
10
  if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11
  $frm_settings = FrmAppHelper::get_settings();
12
  add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13
- add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
14
  add_filter( 'get_user_option_manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
15
  }
16
  }
@@ -63,9 +62,9 @@ class FrmEntriesController {
63
  return $help;
64
  }
65
 
66
- public static function manage_columns($columns) {
67
  global $frm_vars, $wpdb;
68
- $form_id = FrmEntriesHelper::get_current_form_id();
69
 
70
  $columns[ $form_id .'_id' ] = 'ID';
71
  $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
@@ -77,7 +76,7 @@ class FrmEntriesController {
77
  $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
 
79
  foreach ( $form_cols as $form_col ) {
80
- if ( FrmFieldsHelper::is_no_save_field( $form_col->type ) ) {
81
  continue;
82
  }
83
 
@@ -86,7 +85,7 @@ class FrmEntriesController {
86
 
87
  if ( $sub_form_cols ) {
88
  foreach ( $sub_form_cols as $k => $sub_form_col ) {
89
- if ( in_array( $sub_form_col->type, FrmFieldsHelper::no_save_fields() ) ) {
90
  unset( $sub_form_cols[ $k ] );
91
  continue;
92
  }
@@ -196,34 +195,10 @@ class FrmEntriesController {
196
  return $save;
197
  }
198
 
199
- public static function sortable_columns() {
200
- $form_id = FrmEntriesHelper::get_current_form_id();
201
-
202
- $fields = FrmField::get_all_for_form( $form_id );
203
-
204
- $columns = array(
205
- $form_id .'_id' => 'id',
206
- $form_id .'_created_at' => 'created_at',
207
- $form_id .'_updated_at' => 'updated_at',
208
- $form_id .'_ip' => 'ip',
209
- $form_id .'_item_key' => 'item_key',
210
- $form_id .'_is_draft' => 'is_draft',
211
- );
212
-
213
- foreach ( $fields as $field ) {
214
- if ( $field->type != 'checkbox' && ( ! isset($field->field_options['post_field']) || $field->field_options['post_field'] == '' ) ) {
215
- // Can't sort on checkboxes because they are stored serialized, or post fields
216
- $columns[ $form_id .'_'. $field->field_key ] = 'meta_'. $field->id;
217
- }
218
- }
219
-
220
- return $columns;
221
- }
222
-
223
  public static function hidden_columns($result) {
224
  global $frm_vars;
225
 
226
- $form_id = FrmEntriesHelper::get_current_form_id();
227
 
228
  $return = false;
229
  foreach ( (array) $result as $r ) {
@@ -283,8 +258,8 @@ class FrmEntriesController {
283
  public static function display_list( $message = '', $errors = array() ) {
284
  global $wpdb, $frm_vars;
285
 
286
- $form = FrmEntriesHelper::get_current_form();
287
- $params = FrmEntriesHelper::get_admin_params( $form );
288
 
289
  if ( $form ) {
290
  $params['form'] = $form->id;
@@ -352,7 +327,7 @@ class FrmEntriesController {
352
  public static function destroy() {
353
  FrmAppHelper::permission_check('frm_delete_entries');
354
 
355
- $params = FrmEntriesHelper::get_admin_params();
356
 
357
  if ( isset($params['keep_post']) && $params['keep_post'] ) {
358
  //unlink entry from post
@@ -375,14 +350,14 @@ class FrmEntriesController {
375
  }
376
 
377
  global $wpdb;
378
- $params = FrmEntriesHelper::get_admin_params();
379
  $message = '';
380
  $errors = array();
381
  $form_id = (int) $params['form'];
382
 
383
  if ( $form_id ) {
384
  $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
385
- $action = FrmFormActionsHelper::get_action_for_form( $form_id, 'wppost', 1 );
386
 
387
  if ( $action ) {
388
  // this action takes a while, so only trigger it if there are posts to delete
@@ -427,7 +402,7 @@ class FrmEntriesController {
427
  return;
428
  }
429
 
430
- $params = self::get_params( $form );
431
 
432
  if ( ! isset( $frm_vars['form_params'] ) ) {
433
  $frm_vars['form_params'] = array();
@@ -439,7 +414,7 @@ class FrmEntriesController {
439
  }
440
 
441
  if ( $errors == '' ) {
442
- $errors = FrmEntry::validate( $_POST );
443
  }
444
 
445
  /**
@@ -485,68 +460,9 @@ class FrmEntriesController {
485
  }
486
  }
487
 
488
- public static function show_entry_shortcode( $atts ) {
489
- $atts = shortcode_atts( array(
490
- 'id' => false, 'entry' => false, 'fields' => false, 'plain_text' => false,
491
- 'user_info' => false, 'include_blank' => false, 'default_email' => false,
492
- 'form_id' => false, 'format' => 'text', 'direction' => 'ltr',
493
- 'font_size' => '', 'text_color' => '',
494
- 'border_width' => '', 'border_color' => '',
495
- 'bg_color' => '', 'alt_bg_color' => '',
496
- ), $atts );
497
-
498
- if ( $atts['format'] != 'text' ) {
499
- //format options are text, array, or json
500
- $atts['plain_text'] = true;
501
- }
502
-
503
- if ( is_object( $atts['entry'] ) && ! isset( $atts['entry']->metas ) ) {
504
- // if the entry does not include metas, force it again
505
- $atts['entry'] = false;
506
- }
507
-
508
- if ( ! $atts['entry'] || ! is_object( $atts['entry'] ) ) {
509
- if ( ! $atts['id'] && ! $atts['default_email'] ) {
510
- return;
511
- }
512
-
513
- if ( $atts['id'] ) {
514
- $atts['entry'] = FrmEntry::getOne( $atts['id'], true );
515
- }
516
- }
517
-
518
- if ( $atts['entry'] ) {
519
- $atts['form_id'] = $atts['entry']->form_id;
520
- $atts['id'] = $atts['entry']->id;
521
- }
522
-
523
- if ( ! $atts['fields'] || ! is_array($atts['fields']) ) {
524
- $atts['fields'] = FrmField::get_all_for_form( $atts['form_id'], '', 'include' );
525
- }
526
-
527
- $values = array();
528
- foreach ( $atts['fields'] as $f ) {
529
- FrmEntriesHelper::fill_entry_values($atts, $f, $values);
530
- unset($f);
531
- }
532
-
533
- FrmEntriesHelper::fill_entry_user_info($atts, $values);
534
-
535
- if ( $atts['format'] == 'json' ) {
536
- return json_encode($values);
537
- } else if ( $atts['format'] == 'array' ) {
538
- return $values;
539
- }
540
-
541
- $content = array();
542
- FrmEntriesHelper::convert_entry_to_content($values, $atts, $content);
543
-
544
- if ( 'text' == $atts['format'] ) {
545
- $content = implode('', $content);
546
- }
547
-
548
- return $content;
549
- }
550
 
551
  public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
552
  $field = FrmField::getOne($meta->field_id);
@@ -560,7 +476,7 @@ class FrmEntriesController {
560
 
561
  public static function &filter_shortcode_value($value, $tag, $atts, $field) {
562
  $plain_text = add_filter('frm_plain_text_email', true);
563
- FrmEntriesHelper::textarea_display_value( $value, $field->type, $plain_text );
564
 
565
  if ( isset($atts['show']) && $atts['show'] == 'value' ) {
566
  return $value;
@@ -571,7 +487,7 @@ class FrmEntriesController {
571
 
572
  public static function &filter_display_value( $value, $field, $atts = array() ) {
573
  $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
574
- if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! isset( $field->field_options['separate_value'] ) || ! $field->field_options['separate_value'] || $saved_value ) {
575
  return $value;
576
  }
577
 
@@ -608,60 +524,17 @@ class FrmEntriesController {
608
  }
609
 
610
  public static function get_params( $form = null ) {
611
- global $frm_vars;
612
-
613
- if ( ! $form ) {
614
- $form = FrmForm::getAll( array(), 'name', 1 );
615
- } else {
616
- FrmFormsHelper::maybe_get_form( $form );
617
- }
618
-
619
- if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) {
620
- return $frm_vars['form_params'][ $form->id ];
621
- }
622
-
623
- $action_var = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
624
- $action = apply_filters( 'frm_show_new_entry_page', FrmAppHelper::get_param( $action_var, 'new', 'get', 'sanitize_title' ), $form );
625
-
626
- $default_values = array(
627
- 'id' => '', 'form_name' => '', 'paged' => 1, 'form' => $form->id, 'form_id' => $form->id,
628
- 'field_id' => '', 'search' => '', 'sort' => '', 'sdir' => '', 'action' => $action,
629
- );
630
-
631
- $values = array();
632
- $values['posted_form_id'] = FrmAppHelper::get_param( 'form_id', '', 'get', 'absint' );
633
- if ( ! $values['posted_form_id'] ) {
634
- $values['posted_form_id'] = FrmAppHelper::get_param( 'form', '', 'get', 'absint' );
635
- }
636
-
637
- if ( $form->id == $values['posted_form_id'] ) {
638
- //if there are two forms on the same page, make sure not to submit both
639
- foreach ( $default_values as $var => $default ) {
640
- if ( $var == 'action' ) {
641
- $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
642
- } else {
643
- $values[ $var ] = FrmAppHelper::get_param( $var, $default );
644
- }
645
- unset( $var, $default );
646
- }
647
- } else {
648
- foreach ( $default_values as $var => $default ) {
649
- $values[ $var ] = $default;
650
- unset( $var, $default );
651
- }
652
- }
653
-
654
- if ( in_array( $values['action'], array( 'create', 'update' ) ) && ( ! $_POST || ( ! isset( $_POST['action'] ) && ! isset( $_POST['frm_action'] ) ) ) ) {
655
- $values['action'] = 'new';
656
- }
657
-
658
- return $values;
659
- }
660
 
661
  public static function entry_sidebar($entry) {
662
  $data = maybe_unserialize($entry->description);
663
  $date_format = get_option('date_format');
664
  $time_format = get_option('time_format');
 
 
 
665
 
666
  include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
667
  }
10
  if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11
  $frm_settings = FrmAppHelper::get_settings();
12
  add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
 
13
  add_filter( 'get_user_option_manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14
  }
15
  }
62
  return $help;
63
  }
64
 
65
+ public static function manage_columns( $columns ) {
66
  global $frm_vars, $wpdb;
67
+ $form_id = FrmForm::get_current_form_id();
68
 
69
  $columns[ $form_id .'_id' ] = 'ID';
70
  $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
76
  $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
77
 
78
  foreach ( $form_cols as $form_col ) {
79
+ if ( FrmField::is_no_save_field( $form_col->type ) ) {
80
  continue;
81
  }
82
 
85
 
86
  if ( $sub_form_cols ) {
87
  foreach ( $sub_form_cols as $k => $sub_form_col ) {
88
+ if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
89
  unset( $sub_form_cols[ $k ] );
90
  continue;
91
  }
195
  return $save;
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  public static function hidden_columns($result) {
199
  global $frm_vars;
200
 
201
+ $form_id = FrmForm::get_current_form_id();
202
 
203
  $return = false;
204
  foreach ( (array) $result as $r ) {
258
  public static function display_list( $message = '', $errors = array() ) {
259
  global $wpdb, $frm_vars;
260
 
261
+ $form = FrmForm::get_current_form();
262
+ $params = FrmForm::get_admin_params( $form );
263
 
264
  if ( $form ) {
265
  $params['form'] = $form->id;
327
  public static function destroy() {
328
  FrmAppHelper::permission_check('frm_delete_entries');
329
 
330
+ $params = FrmForm::get_admin_params();
331
 
332
  if ( isset($params['keep_post']) && $params['keep_post'] ) {
333
  //unlink entry from post
350
  }
351
 
352
  global $wpdb;
353
+ $params = FrmForm::get_admin_params();
354
  $message = '';
355
  $errors = array();
356
  $form_id = (int) $params['form'];
357
 
358
  if ( $form_id ) {
359
  $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
360
+ $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
361
 
362
  if ( $action ) {
363
  // this action takes a while, so only trigger it if there are posts to delete
402
  return;
403
  }
404
 
405
+ $params = FrmForm::get_params( $form );
406
 
407
  if ( ! isset( $frm_vars['form_params'] ) ) {
408
  $frm_vars['form_params'] = array();
414
  }
415
 
416
  if ( $errors == '' ) {
417
+ $errors = FrmEntryValidate::validate( $_POST );
418
  }
419
 
420
  /**
460
  }
461
  }
462
 
463
+ public static function show_entry_shortcode( $atts ) {
464
+ return FrmEntryFormat::show_entry( $atts );
465
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
 
467
  public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
468
  $field = FrmField::getOne($meta->field_id);
476
 
477
  public static function &filter_shortcode_value($value, $tag, $atts, $field) {
478
  $plain_text = add_filter('frm_plain_text_email', true);
479
+ FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
480
 
481
  if ( isset($atts['show']) && $atts['show'] == 'value' ) {
482
  return $value;
487
 
488
  public static function &filter_display_value( $value, $field, $atts = array() ) {
489
  $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
490
+ if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
491
  return $value;
492
  }
493
 
524
  }
525
 
526
  public static function get_params( $form = null ) {
527
+ _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' );
528
+ return FrmForm::get_params( $form );
529
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
 
531
  public static function entry_sidebar($entry) {
532
  $data = maybe_unserialize($entry->description);
533
  $date_format = get_option('date_format');
534
  $time_format = get_option('time_format');
535
+ if ( isset( $data['browser'] ) ) {
536
+ $browser = FrmEntryFormat::get_browser( $data['browser'] );
537
+ }
538
 
539
  include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
540
  }
classes/controllers/FrmFieldsController.php CHANGED
@@ -139,7 +139,7 @@ class FrmFieldsController {
139
  $new_val = FrmAppHelper::get_post_param( $val, 0, 'absint' );
140
 
141
  if ( $val == 'separate_value' ) {
142
- $new_val = ( isset( $field->field_options[ $val ] ) && $field->field_options[ $val ] ) ? 0 : 1;
143
  }
144
 
145
  $field->field_options[ $val ] = $new_val;
@@ -284,7 +284,7 @@ class FrmFieldsController {
284
  $ids = explode( '-', $element_id );
285
  $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
286
 
287
- $orig_update_value = $update_value = trim( FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ) );
288
  if ( strpos( $element_id, 'key_' ) ) {
289
  $new_value = $update_value;
290
  } else {
@@ -292,7 +292,7 @@ class FrmFieldsController {
292
  }
293
 
294
  $field = FrmField::getOne($id);
295
- $separate_values = ( isset($field->field_options['separate_value']) && $field->field_options['separate_value'] );
296
 
297
  $this_opt_id = end($ids);
298
  $this_opt = (array) $field->options[ $this_opt_id ];
@@ -490,7 +490,7 @@ class FrmFieldsController {
490
  $type = $type_switch[ $type ];
491
  }
492
 
493
- $frm_field_selection = FrmFieldsHelper::field_selection();
494
  $types = array_keys($frm_field_selection);
495
  if ( ! in_array($type, $types) && $type != 'captcha' ) {
496
  $type = 'text';
@@ -618,7 +618,7 @@ class FrmFieldsController {
618
 
619
  private static function add_html_length($field, array &$add_html) {
620
  // check for max setting and if this field accepts maxlength
621
- if ( ! isset( $field['max'] ) || empty( $field['max'] ) || in_array( $field['type'], array( 'textarea', 'rte', 'hidden' ) ) ) {
622
  return;
623
  }
624
 
@@ -631,13 +631,15 @@ class FrmFieldsController {
631
  }
632
 
633
  private static function add_html_placeholder($field, array &$add_html, array &$class) {
634
- // check for a default value and placeholder setting
635
- if ( ! isset($field['clear_on_focus']) || ! $field['clear_on_focus'] || empty($field['default_value']) ) {
636
- return;
637
- }
638
 
639
- // don't apply this to the form builder page
640
- if ( FrmAppHelper::is_admin_page('formidable' ) ) {
 
 
 
641
  return;
642
  }
643
 
@@ -659,7 +661,7 @@ class FrmFieldsController {
659
  }
660
 
661
  private static function add_shortcodes_to_html( $field, array &$add_html ) {
662
- if ( ! isset( $field['shortcodes'] ) || empty( $field['shortcodes'] ) ) {
663
  return;
664
  }
665
 
@@ -682,7 +684,7 @@ class FrmFieldsController {
682
 
683
  public static function check_value( $opt, $opt_key, $field ) {
684
  if ( is_array( $opt ) ) {
685
- if ( isset( $field['separate_value'] ) && $field['separate_value'] ) {
686
  $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) );
687
  } else {
688
  $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
139
  $new_val = FrmAppHelper::get_post_param( $val, 0, 'absint' );
140
 
141
  if ( $val == 'separate_value' ) {
142
+ $new_val = FrmField::is_option_true( $field, $val ) ? 0 : 1;
143
  }
144
 
145
  $field->field_options[ $val ] = $new_val;
284
  $ids = explode( '-', $element_id );
285
  $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
286
 
287
+ $orig_update_value = $update_value = trim( FrmAppHelper::get_post_param( 'update_value' ) );
288
  if ( strpos( $element_id, 'key_' ) ) {
289
  $new_value = $update_value;
290
  } else {
292
  }
293
 
294
  $field = FrmField::getOne($id);
295
+ $separate_values = FrmField::is_option_true( $field, 'separate_value' );
296
 
297
  $this_opt_id = end($ids);
298
  $this_opt = (array) $field->options[ $this_opt_id ];
490
  $type = $type_switch[ $type ];
491
  }
492
 
493
+ $frm_field_selection = FrmField::field_selection();
494
  $types = array_keys($frm_field_selection);
495
  if ( ! in_array($type, $types) && $type != 'captcha' ) {
496
  $type = 'text';
618
 
619
  private static function add_html_length($field, array &$add_html) {
620
  // check for max setting and if this field accepts maxlength
621
+ if ( FrmField::is_option_empty( $field, 'max' ) || in_array( $field['type'], array( 'textarea', 'rte', 'hidden' ) ) ) {
622
  return;
623
  }
624
 
631
  }
632
 
633
  private static function add_html_placeholder($field, array &$add_html, array &$class) {
634
+ if ( empty( $field['default_value'] ) || FrmAppHelper::is_admin_page( 'formidable' ) ) {
635
+ return;
636
+ }
 
637
 
638
+ if ( ! FrmField::is_option_true( $field, 'clear_on_focus' ) ) {
639
+ if ( is_array( $field['default_value'] ) ) {
640
+ $field['default_value'] = json_encode( $field['default_value'] );
641
+ }
642
+ $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $field['default_value'] ) . '"';
643
  return;
644
  }
645
 
661
  }
662
 
663
  private static function add_shortcodes_to_html( $field, array &$add_html ) {
664
+ if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) {
665
  return;
666
  }
667
 
684
 
685
  public static function check_value( $opt, $opt_key, $field ) {
686
  if ( is_array( $opt ) ) {
687
+ if ( FrmField::is_option_true( $field, 'separate_value' ) ) {
688
  $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) );
689
  } else {
690
  $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
classes/controllers/FrmFormActionsController.php CHANGED
@@ -111,7 +111,7 @@ class FrmFormActionsController {
111
  */
112
  do_action( 'frm_before_list_actions', $form );
113
 
114
- $form_actions = FrmFormActionsHelper::get_action_for_form( $form->id );
115
 
116
  $action_controls = self::get_form_actions();
117
 
@@ -239,13 +239,13 @@ class FrmFormActionsController {
239
  * @param string $event
240
  */
241
  public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
242
- $form_actions = FrmFormActionsHelper::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
243
 
244
  if ( empty( $form_actions ) ) {
245
  return;
246
  }
247
 
248
- FrmFormsHelper::maybe_get_form( $form );
249
 
250
  $link_settings = self::get_form_actions( $type );
251
  if ( 'all' != $type ) {
@@ -276,7 +276,7 @@ class FrmFormActionsController {
276
  }
277
 
278
  // check conditional logic
279
- $stop = FrmFormActionsHelper::action_conditions_met($action, $entry);
280
  if ( $stop ) {
281
  continue;
282
  }
111
  */
112
  do_action( 'frm_before_list_actions', $form );
113
 
114
+ $form_actions = FrmFormAction::get_action_for_form( $form->id );
115
 
116
  $action_controls = self::get_form_actions();
117
 
239
  * @param string $event
240
  */
241
  public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
242
+ $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
243
 
244
  if ( empty( $form_actions ) ) {
245
  return;
246
  }
247
 
248
+ FrmForm::maybe_get_form( $form );
249
 
250
  $link_settings = self::get_form_actions( $type );
251
  if ( 'all' != $type ) {
276
  }
277
 
278
  // check conditional logic
279
+ $stop = FrmFormAction::action_conditions_met( $action, $entry );
280
  if ( $stop ) {
281
  continue;
282
  }
classes/controllers/FrmFormsController.php CHANGED
@@ -2,17 +2,12 @@
2
 
3
  class FrmFormsController {
4
 
5
- public static function trigger_load_form_hooks() {
6
- FrmHooksController::trigger_load_hook( 'load_form_hooks' );
7
- }
8
-
9
  public static function menu() {
10
  add_submenu_page('formidable', 'Formidable | '. __( 'Forms', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11
 
12
  add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
13
 
14
  add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15
- add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
16
  }
17
 
18
  public static function head() {
@@ -31,7 +26,7 @@ class FrmFormsController {
31
  public static function list_form() {
32
  FrmAppHelper::permission_check('frm_view_forms');
33
 
34
- $params = FrmFormsHelper::get_params();
35
  $errors = self::process_bulk_form_actions( array());
36
  $errors = apply_filters('frm_admin_list_form_action', $errors);
37
 
@@ -49,7 +44,7 @@ class FrmFormsController {
49
  if ( $action == 'create' ) {
50
  return self::create($values);
51
  } else if ( $action == 'new' ) {
52
- $frm_field_selection = FrmFieldsHelper::field_selection();
53
  $values = FrmFormsHelper::setup_new_vars($values);
54
  $id = FrmForm::create( $values );
55
  $form = FrmForm::getOne($id);
@@ -89,7 +84,7 @@ class FrmFormsController {
89
 
90
  if ( count($errors) > 0 ) {
91
  $hide_preview = true;
92
- $frm_field_selection = FrmFieldsHelper::field_selection();
93
  $form = FrmForm::getOne( $id );
94
  $fields = FrmField::get_all_for_form($id);
95
 
@@ -227,7 +222,7 @@ class FrmFormsController {
227
  public static function duplicate() {
228
  FrmAppHelper::permission_check('frm_edit_forms');
229
 
230
- $params = FrmFormsHelper::get_params();
231
  $form = FrmForm::duplicate( $params['id'], $params['template'], true );
232
  $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
233
  if ( $form ) {
@@ -238,7 +233,7 @@ class FrmFormsController {
238
  }
239
 
240
  public static function page_preview() {
241
- $params = FrmFormsHelper::get_params();
242
  if ( ! $params['form'] ) {
243
  return;
244
  }
@@ -264,9 +259,7 @@ class FrmFormsController {
264
  $wp->register_globals();
265
  }
266
 
267
- if ( FrmAppHelper::pro_is_installed() ) {
268
- FrmProEntriesController::register_scripts();
269
- }
270
 
271
  header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
272
 
@@ -284,8 +277,16 @@ class FrmFormsController {
284
  wp_die();
285
  }
286
 
 
 
 
 
 
 
 
 
287
  public static function untrash() {
288
- FrmFormsHelper::change_form_status('untrash');
289
  }
290
 
291
  public static function bulk_untrash($ids) {
@@ -298,9 +299,44 @@ class FrmFormsController {
298
  }
299
 
300
  public static function trash() {
301
- FrmFormsHelper::change_form_status('trash');
302
  }
303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  public static function bulk_trash($ids) {
305
  FrmAppHelper::permission_check('frm_delete_forms');
306
 
@@ -320,7 +356,7 @@ class FrmFormsController {
320
  public static function destroy() {
321
  FrmAppHelper::permission_check('frm_delete_forms');
322
 
323
- $params = FrmFormsHelper::get_params();
324
 
325
  //check nonce url
326
  check_admin_referer('destroy_form_' . $params['id']);
@@ -359,41 +395,16 @@ class FrmFormsController {
359
  return;
360
  }
361
 
362
- $count = self::scheduled_delete(time());
363
  $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
364
 
365
  self::display_forms_list( array(), $message );
366
  }
367
 
368
- /**
369
- * Delete trashed forms based on how long they have been trashed
370
- * @return int The number of forms deleted
371
- */
372
- public static function scheduled_delete($delete_timestamp = '') {
373
- global $wpdb;
374
-
375
- $trash_forms = FrmDb::get_results( $wpdb->prefix . 'frm_forms', array( 'status' => 'trash' ), 'id, options' );
376
-
377
- if ( ! $trash_forms ) {
378
- return;
379
- }
380
-
381
- if ( empty($delete_timestamp) ) {
382
- $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
383
- }
384
-
385
- $count = 0;
386
- foreach ( $trash_forms as $form ) {
387
- $form->options = maybe_unserialize($form->options);
388
- if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) {
389
- FrmForm::destroy($form->id);
390
- $count++;
391
- }
392
-
393
- unset($form);
394
- }
395
- return $count;
396
- }
397
 
398
  public static function insert_form_button($content) {
399
  if ( current_user_can('frm_view_forms') ) {
@@ -469,7 +480,7 @@ class FrmFormsController {
469
  global $wpdb, $frm_vars;
470
 
471
  if ( empty( $params ) ) {
472
- $params = FrmFormsHelper::get_params();
473
  }
474
 
475
  $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
@@ -506,21 +517,11 @@ class FrmFormsController {
506
 
507
  $columns['created_at'] = __( 'Date', 'formidable' );
508
 
509
- add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) );
510
 
511
  return $columns;
512
  }
513
 
514
- public static function get_sortable_columns() {
515
- return array(
516
- 'id' => 'id',
517
- 'name' => 'name',
518
- 'description' => 'description',
519
- 'form_key' => 'form_key',
520
- 'created_at' => 'created_at',
521
- );
522
- }
523
-
524
  public static function hidden_columns( $result ) {
525
  $return = false;
526
  foreach ( (array) $result as $r ) {
@@ -564,7 +565,7 @@ class FrmFormsController {
564
  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>' ));
565
  }
566
 
567
- $frm_field_selection = FrmFieldsHelper::field_selection();
568
  $fields = FrmField::get_all_for_form($form->id);
569
 
570
  // Automatically add end section fields if they don't exist (2.0 migration)
@@ -710,7 +711,7 @@ class FrmFormsController {
710
 
711
  public static function get_email_html() {
712
  check_ajax_referer( 'frm_ajax', 'nonce' );
713
- echo FrmEntriesController::show_entry_shortcode( array(
714
  'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
715
  'default_email' => true,
716
  'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
@@ -740,7 +741,7 @@ class FrmFormsController {
740
  $entry = FrmAppHelper::get_post_param( 'id', false, 'sanitize_title' );
741
  }
742
 
743
- FrmEntriesHelper::maybe_get_entry( $entry );
744
  }
745
  }
746
 
@@ -874,7 +875,7 @@ class FrmFormsController {
874
  }
875
  }
876
 
877
- add_action('frm_load_form_hooks', 'FrmFormsController::trigger_load_form_hooks');
878
  FrmAppHelper::trigger_hook_load( 'form' );
879
 
880
  switch ( $action ) {
@@ -919,7 +920,7 @@ class FrmFormsController {
919
 
920
  /* FRONT-END FORMS */
921
  public static function admin_bar_css() {
922
- FrmAppController::load_wp_admin_style();
923
  }
924
 
925
  public static function admin_bar_configure() {
@@ -981,9 +982,11 @@ class FrmFormsController {
981
  global $frm_vars;
982
  if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
983
  $sc = '[formidable';
984
- foreach ( $atts as $k => $v ) {
985
- $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
986
- }
 
 
987
  return $sc .']';
988
  }
989
 
@@ -1015,7 +1018,7 @@ class FrmFormsController {
1015
  return __( 'Please select a valid form', 'formidable' );
1016
  }
1017
 
1018
- add_action( 'frm_load_form_hooks', 'FrmFormsController::trigger_load_form_hooks' );
1019
  FrmAppHelper::trigger_hook_load( 'form', $form );
1020
 
1021
  $form = apply_filters( 'frm_pre_display_form', $form );
@@ -1061,7 +1064,7 @@ class FrmFormsController {
1061
  ob_start();
1062
 
1063
  self::get_form_contents( $form, $title, $description, $atts );
1064
- FrmEntriesHelper::enqueue_scripts( FrmEntriesController::get_params( $form ) );
1065
 
1066
  $contents = ob_get_contents();
1067
  ob_end_clean();
@@ -1071,6 +1074,10 @@ class FrmFormsController {
1071
  return $contents;
1072
  }
1073
 
 
 
 
 
1074
  public static function get_form_contents($form, $title, $description, $atts) {
1075
  global $frm_vars;
1076
 
@@ -1079,9 +1086,7 @@ class FrmFormsController {
1079
  $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1080
 
1081
  $user_ID = get_current_user_id();
1082
-
1083
- $params = FrmEntriesController::get_params($form);
1084
-
1085
  $message = $errors = '';
1086
 
1087
  if ( $params['posted_form_id'] == $form->id && $_POST ) {
@@ -1135,7 +1140,7 @@ class FrmFormsController {
1135
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1136
  } else {
1137
  global $frm_vars;
1138
- FrmFormsHelper::form_loaded($form, $values['custom_style'], $frm_vars['load_css']);
1139
 
1140
  $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1141
  include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
@@ -1144,6 +1149,41 @@ class FrmFormsController {
1144
  do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1145
  }
1146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1147
  /**
1148
  * @since 2.0.8
1149
  */
2
 
3
  class FrmFormsController {
4
 
 
 
 
 
5
  public static function menu() {
6
  add_submenu_page('formidable', 'Formidable | '. __( 'Forms', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
7
 
8
  add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
9
 
10
  add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
 
11
  }
12
 
13
  public static function head() {
26
  public static function list_form() {
27
  FrmAppHelper::permission_check('frm_view_forms');
28
 
29
+ $params = FrmForm::list_page_params();
30
  $errors = self::process_bulk_form_actions( array());
31
  $errors = apply_filters('frm_admin_list_form_action', $errors);
32
 
44
  if ( $action == 'create' ) {
45
  return self::create($values);
46
  } else if ( $action == 'new' ) {
47
+ $frm_field_selection = FrmField::field_selection();
48
  $values = FrmFormsHelper::setup_new_vars($values);
49
  $id = FrmForm::create( $values );
50
  $form = FrmForm::getOne($id);
84
 
85
  if ( count($errors) > 0 ) {
86
  $hide_preview = true;
87
+ $frm_field_selection = FrmField::field_selection();
88
  $form = FrmForm::getOne( $id );
89
  $fields = FrmField::get_all_for_form($id);
90
 
222
  public static function duplicate() {
223
  FrmAppHelper::permission_check('frm_edit_forms');
224
 
225
+ $params = FrmForm::list_page_params();
226
  $form = FrmForm::duplicate( $params['id'], $params['template'], true );
227
  $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
228
  if ( $form ) {
233
  }
234
 
235
  public static function page_preview() {
236
+ $params = FrmForm::list_page_params();
237
  if ( ! $params['form'] ) {
238
  return;
239
  }
259
  $wp->register_globals();
260
  }
261
 
262
+ self::register_pro_scripts();
 
 
263
 
264
  header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
265
 
277
  wp_die();
278
  }
279
 
280
+ public static function register_pro_scripts() {
281
+ if ( FrmAppHelper::pro_is_installed() ) {
282
+ wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true );
283
+ wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true );
284
+ wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() .'/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
285
+ }
286
+ }
287
+
288
  public static function untrash() {
289
+ self::change_form_status( 'untrash' );
290
  }
291
 
292
  public static function bulk_untrash($ids) {
299
  }
300
 
301
  public static function trash() {
302
+ self::change_form_status( 'trash' );
303
  }
304
 
305
+ /**
306
+ * @param string $status
307
+ *
308
+ * @return int The number of forms changed
309
+ */
310
+ public static function change_form_status( $status ) {
311
+ $available_status = array(
312
+ 'untrash' => array( 'permission' => 'frm_edit_forms', 'new_status' => 'published' ),
313
+ 'trash' => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ),
314
+ );
315
+
316
+ if ( ! isset( $available_status[ $status ] ) ) {
317
+ return;
318
+ }
319
+
320
+ FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
321
+
322
+ $params = FrmForm::list_page_params();
323
+
324
+ //check nonce url
325
+ check_admin_referer($status .'_form_' . $params['id']);
326
+
327
+ $count = 0;
328
+ if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
329
+ $count++;
330
+ }
331
+
332
+ $available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
333
+ $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type='. ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
334
+
335
+ $message = $available_status[ $status ]['message'];
336
+
337
+ self::display_forms_list( $params, $message );
338
+ }
339
+
340
  public static function bulk_trash($ids) {
341
  FrmAppHelper::permission_check('frm_delete_forms');
342
 
356
  public static function destroy() {
357
  FrmAppHelper::permission_check('frm_delete_forms');
358
 
359
+ $params = FrmForm::list_page_params();
360
 
361
  //check nonce url
362
  check_admin_referer('destroy_form_' . $params['id']);
395
  return;
396
  }
397
 
398
+ $count = FrmForm::scheduled_delete( time() );
399
  $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
400
 
401
  self::display_forms_list( array(), $message );
402
  }
403
 
404
+ public static function scheduled_delete( $delete_timestamp = '' ) {
405
+ _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' );
406
+ return FrmForm::scheduled_delete( $delete_timestamp );
407
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
 
409
  public static function insert_form_button($content) {
410
  if ( current_user_can('frm_view_forms') ) {
480
  global $wpdb, $frm_vars;
481
 
482
  if ( empty( $params ) ) {
483
+ $params = FrmForm::list_page_params();
484
  }
485
 
486
  $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
517
 
518
  $columns['created_at'] = __( 'Date', 'formidable' );
519
 
520
+ add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) );
521
 
522
  return $columns;
523
  }
524
 
 
 
 
 
 
 
 
 
 
 
525
  public static function hidden_columns( $result ) {
526
  $return = false;
527
  foreach ( (array) $result as $r ) {
565
  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>' ));
566
  }
567
 
568
+ $frm_field_selection = FrmField::field_selection();
569
  $fields = FrmField::get_all_for_form($form->id);
570
 
571
  // Automatically add end section fields if they don't exist (2.0 migration)
711
 
712
  public static function get_email_html() {
713
  check_ajax_referer( 'frm_ajax', 'nonce' );
714
+ echo FrmEntryFormat::show_entry( array(
715
  'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
716
  'default_email' => true,
717
  'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
741
  $entry = FrmAppHelper::get_post_param( 'id', false, 'sanitize_title' );
742
  }
743
 
744
+ FrmEntry::maybe_get_entry( $entry );
745
  }
746
  }
747
 
875
  }
876
  }
877
 
878
+ add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
879
  FrmAppHelper::trigger_hook_load( 'form' );
880
 
881
  switch ( $action ) {
920
 
921
  /* FRONT-END FORMS */
922
  public static function admin_bar_css() {
923
+ FrmAppHelper::load_font_style();
924
  }
925
 
926
  public static function admin_bar_configure() {
982
  global $frm_vars;
983
  if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
984
  $sc = '[formidable';
985
+ if ( ! empty( $atts ) ) {
986
+ foreach ( $atts as $k => $v ) {
987
+ $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
988
+ }
989
+ }
990
  return $sc .']';
991
  }
992
 
1018
  return __( 'Please select a valid form', 'formidable' );
1019
  }
1020
 
1021
+ add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1022
  FrmAppHelper::trigger_hook_load( 'form', $form );
1023
 
1024
  $form = apply_filters( 'frm_pre_display_form', $form );
1064
  ob_start();
1065
 
1066
  self::get_form_contents( $form, $title, $description, $atts );
1067
+ self::enqueue_scripts( FrmForm::get_params( $form ) );
1068
 
1069
  $contents = ob_get_contents();
1070
  ob_end_clean();
1074
  return $contents;
1075
  }
1076
 
1077
+ public static function enqueue_scripts( $params ) {
1078
+ do_action( 'frm_enqueue_form_scripts', $params );
1079
+ }
1080
+
1081
  public static function get_form_contents($form, $title, $description, $atts) {
1082
  global $frm_vars;
1083
 
1086
  $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1087
 
1088
  $user_ID = get_current_user_id();
1089
+ $params = FrmForm::get_params( $form );
 
 
1090
  $message = $errors = '';
1091
 
1092
  if ( $params['posted_form_id'] == $form->id && $_POST ) {
1140
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1141
  } else {
1142
  global $frm_vars;
1143
+ self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1144
 
1145
  $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1146
  include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1149
  do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1150
  }
1151
 
1152
+ public static function front_head() {
1153
+ $version = FrmAppHelper::plugin_version();
1154
+ wp_register_script( 'formidable', FrmAppHelper::plugin_url() . '/js/formidable.min.js', array( 'jquery' ), $version, true );
1155
+ wp_register_script( 'jquery-placeholder', FrmAppHelper::plugin_url() . '/js/jquery/jquery.placeholder.js', array( 'jquery' ), '2.0.7', true );
1156
+
1157
+ if ( FrmAppHelper::is_admin() ) {
1158
+ // don't load this in back-end
1159
+ return;
1160
+ }
1161
+
1162
+ FrmAppHelper::localize_script( 'front' );
1163
+ FrmStylesController::enqueue_css( 'register' );
1164
+ }
1165
+
1166
+ public static function maybe_load_css( $form, $this_load, $global_load ) {
1167
+ $load_css = FrmForm::is_form_loaded( $form, $this_load, $global_load );
1168
+
1169
+ if ( $load_css ) {
1170
+ global $frm_vars;
1171
+ self::footer_js( 'header' );
1172
+ $frm_vars['css_loaded'] = true;
1173
+ }
1174
+ }
1175
+
1176
+ public static function footer_js( $location = 'footer' ) {
1177
+ global $frm_vars;
1178
+
1179
+ FrmStylesController::enqueue_css();
1180
+
1181
+ if ( ! FrmAppHelper::is_admin() && $location != 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
1182
+ //load formidable js
1183
+ wp_enqueue_script( 'formidable' );
1184
+ }
1185
+ }
1186
+
1187
  /**
1188
  * @since 2.0.8
1189
  */
classes/controllers/FrmHooksController.php CHANGED
@@ -39,15 +39,17 @@ class FrmHooksController {
39
 
40
  }
41
 
 
 
 
 
42
  public static function load_hooks() {
43
  if ( ! is_admin() ) {
44
  add_filter( 'the_content', 'FrmAppController::page_route', 10 );
45
  }
46
 
47
  add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
48
- add_action( 'init', 'FrmAppController::front_head' );
49
  add_filter( 'widget_text', 'FrmAppController::widget_text_filter', 8 );
50
- add_action( 'wp_footer', 'FrmAppController::footer_js', 1, 0 );
51
 
52
  // Entries controller
53
  add_action( 'wp', 'FrmEntriesController::process_entry', 10, 0 );
@@ -63,11 +65,14 @@ class FrmHooksController {
63
 
64
  // Forms Controller
65
  add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
 
66
  add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
67
  add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
68
  add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
69
  add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
70
- add_action( 'wp_scheduled_delete', 'FrmFormsController::scheduled_delete' );
 
 
71
 
72
  // Form Shortcodes
73
  add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
@@ -84,6 +89,8 @@ class FrmHooksController {
84
  add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
85
  add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
86
  add_action( 'admin_init', 'FrmAppController::admin_init', 11 );
 
 
87
  register_activation_hook( FrmAppHelper::plugin_path() . '/formidable.php', 'FrmAppController::activation_install' );
88
 
89
  // Entries Controller
@@ -137,9 +144,6 @@ class FrmHooksController {
137
  add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
138
  add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
139
 
140
- add_action( 'wp_ajax_frmpro_css', 'FrmAppController::load_css' );
141
- add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmAppController::load_css' );
142
-
143
  // Fields Controller
144
  add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
145
  add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
@@ -174,6 +178,8 @@ class FrmHooksController {
174
  add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
175
  add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
176
  add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
 
 
177
 
178
  // XML Controller
179
  add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
@@ -198,6 +204,7 @@ class FrmHooksController {
198
  }
199
 
200
  public static function load_multisite_hooks() {
 
201
  add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' );
202
 
203
  // drop tables when mu site is deleted
39
 
40
  }
41
 
42
+ public static function trigger_load_form_hooks() {
43
+ self::trigger_load_hook( 'load_form_hooks' );
44
+ }
45
+
46
  public static function load_hooks() {
47
  if ( ! is_admin() ) {
48
  add_filter( 'the_content', 'FrmAppController::page_route', 10 );
49
  }
50
 
51
  add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
 
52
  add_filter( 'widget_text', 'FrmAppController::widget_text_filter', 8 );
 
53
 
54
  // Entries controller
55
  add_action( 'wp', 'FrmEntriesController::process_entry', 10, 0 );
65
 
66
  // Forms Controller
67
  add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
68
+ add_action( 'init', 'FrmFormsController::front_head' );
69
  add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
70
  add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
71
  add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
72
  add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
73
+ add_action( 'wp_footer', 'FrmFormsController::footer_js', 1, 0 );
74
+
75
+ add_action( 'wp_scheduled_delete', 'FrmForm::scheduled_delete' );
76
 
77
  // Form Shortcodes
78
  add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
89
  add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
90
  add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
91
  add_action( 'admin_init', 'FrmAppController::admin_init', 11 );
92
+ add_filter( 'admin_body_class', 'FrmAppController::wp_admin_body_class' );
93
+ add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
94
  register_activation_hook( FrmAppHelper::plugin_path() . '/formidable.php', 'FrmAppController::activation_install' );
95
 
96
  // Entries Controller
144
  add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
145
  add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
146
 
 
 
 
147
  // Fields Controller
148
  add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
149
  add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
178
  add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
179
  add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
180
  add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
181
+ add_action( 'wp_ajax_frmpro_css', 'FrmStylesController::load_saved_css' );
182
+ add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' );
183
 
184
  // XML Controller
185
  add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
204
  }
205
 
206
  public static function load_multisite_hooks() {
207
+ add_action( 'init', 'FrmAppController::front_head' );
208
  add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' );
209
 
210
  // drop tables when mu site is deleted
classes/controllers/FrmStylesController.php CHANGED
@@ -64,6 +64,70 @@ class FrmStylesController {
64
  }
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  public static function new_style($return = '') {
68
  FrmAppHelper::update_message( __( 'create multiple styling templates', 'formidable' ), 'wrap' );
69
  self::load_styler('default');
@@ -284,6 +348,13 @@ class FrmStylesController {
284
  wp_die();
285
  }
286
 
 
 
 
 
 
 
 
287
  /**
288
  * Check if the Formidable styling should be loaded,
289
  * then enqueue it for the footer
64
  }
65
  }
66
 
67
+ public static function enqueue_css( $register = 'enqueue' ) {
68
+ global $frm_vars;
69
+ $register_css = ( $register == 'register' );
70
+ if ( ( $frm_vars['load_css'] || $register_css ) && ! FrmAppHelper::is_admin() ) {
71
+ $frm_settings = FrmAppHelper::get_settings();
72
+ if ( $frm_settings->load_style == 'none' ) {
73
+ return;
74
+ }
75
+
76
+ $css = apply_filters( 'get_frm_stylesheet', self::custom_stylesheet() );
77
+
78
+ if ( ! empty( $css ) ) {
79
+ $version = FrmAppHelper::plugin_version();
80
+
81
+ foreach ( (array) $css as $css_key => $file ) {
82
+ if ( $register == 'register' ) {
83
+ wp_register_style( $css_key, $file, array(), $version );
84
+ }
85
+
86
+ if ( 'all' == $frm_settings->load_style || $register != 'register' ) {
87
+ wp_enqueue_style( $css_key );
88
+ }
89
+ unset( $css_key, $file );
90
+ }
91
+
92
+ if ( $frm_settings->load_style == 'all' ) {
93
+ $frm_vars['css_loaded'] = true;
94
+ }
95
+ }
96
+ unset( $css );
97
+ }
98
+ }
99
+
100
+ public static function custom_stylesheet() {
101
+ global $frm_vars;
102
+ $stylesheet_urls = array();
103
+ self::maybe_enqueue_jquery_css();
104
+
105
+ if ( ! isset( $frm_vars['css_loaded'] ) || ! $frm_vars['css_loaded'] ) {
106
+ //include css in head
107
+ self::get_url_to_custom_style( $stylesheet_urls );
108
+ }
109
+
110
+ return $stylesheet_urls;
111
+ }
112
+
113
+ private static function get_url_to_custom_style( &$stylesheet_urls ) {
114
+ $uploads = FrmStylesHelper::get_upload_base();
115
+ $saved_css_path = '/formidable/css/formidablepro.css';
116
+ if ( is_readable( $uploads['basedir'] . $saved_css_path ) ) {
117
+ $url = $uploads['baseurl'] . $saved_css_path;
118
+ } else {
119
+ $url = admin_url( 'admin-ajax.php' ) . '?action=frmpro_css';
120
+ }
121
+ $stylesheet_urls['formidable'] = $url;
122
+ }
123
+
124
+ private static function maybe_enqueue_jquery_css() {
125
+ global $frm_vars;
126
+ if ( isset( $frm_vars['datepicker_loaded'] ) && ! empty( $frm_vars['datepicker_loaded'] ) ) {
127
+ FrmStylesHelper::enqueue_jquery_css();
128
+ }
129
+ }
130
+
131
  public static function new_style($return = '') {
132
  FrmAppHelper::update_message( __( 'create multiple styling templates', 'formidable' ), 'wrap' );
133
  self::load_styler('default');
348
  wp_die();
349
  }
350
 
351
+ public static function load_saved_css() {
352
+ $css = get_transient( 'frmpro_css' );
353
+
354
+ include( FrmAppHelper::plugin_path() . '/css/custom_theme.css.php' );
355
+ wp_die();
356
+ }
357
+
358
  /**
359
  * Check if the Formidable styling should be loaded,
360
  * then enqueue it for the footer
classes/helpers/FrmAppHelper.php CHANGED
@@ -5,7 +5,7 @@ if ( ! defined('ABSPATH') ) {
5
 
6
  class FrmAppHelper {
7
  public static $db_version = 26; //version of the database we are moving to
8
- public static $pro_db_version = 27;
9
 
10
  /**
11
  * @since 2.0
@@ -43,6 +43,11 @@ class FrmAppHelper {
43
  return $url;
44
  }
45
 
 
 
 
 
 
46
  /**
47
  * @return string Site URL
48
  */
@@ -169,6 +174,10 @@ class FrmAppHelper {
169
  return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
170
  }
171
 
 
 
 
 
172
  /**
173
  * Get any value from the $_SERVER
174
  *
@@ -324,6 +333,13 @@ class FrmAppHelper {
324
  }
325
  }
326
 
 
 
 
 
 
 
 
327
  /**
328
  * Sanitize the value, and allow some HTML
329
  * @since 2.0
@@ -564,21 +580,6 @@ class FrmAppHelper {
564
  }
565
  }
566
 
567
- /**
568
- * Make sure admins have permission to see the menu items
569
- * @since 2.0.6
570
- */
571
- public static function force_capability( $cap = 'frm_change_settings' ) {
572
- // Make sure admins can see the menu items
573
- if ( current_user_can( 'administrator' ) && ! current_user_can( $cap ) ) {
574
- $role = get_role( 'administrator' );
575
- $frm_roles = self::frm_capabilities();
576
- foreach ( $frm_roles as $frm_role => $frm_role_description ) {
577
- $role->add_cap( $frm_role );
578
- }
579
- }
580
- }
581
-
582
  public static function frm_capabilities($type = 'auto') {
583
  $cap = array(
584
  'frm_view_forms' => __( 'View Forms and Templates', 'formidable' ),
@@ -644,6 +645,20 @@ class FrmAppHelper {
644
  }
645
  }
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
  /**
648
  * Check if the user has permision for action.
649
  * Return permission message and stop the action if no permission
@@ -1030,7 +1045,7 @@ class FrmAppHelper {
1030
  private static function fill_form_opts($record, $table, $post_values, array &$values) {
1031
  if ( $table == 'entries' ) {
1032
  $form = $record->form_id;
1033
- FrmFormsHelper::maybe_get_form( $form );
1034
  } else {
1035
  $form = $record;
1036
  }
@@ -1661,6 +1676,61 @@ class FrmAppHelper {
1661
  }
1662
  }
1663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1664
  /**
1665
  * @since 1.07.10
1666
  *
5
 
6
  class FrmAppHelper {
7
  public static $db_version = 26; //version of the database we are moving to
8
+ public static $pro_db_version = 28;
9
 
10
  /**
11
  * @since 2.0
43
  return $url;
44
  }
45
 
46
+ public static function relative_plugin_url( $url = '' ) {
47
+ $url = self::plugin_url( $url );
48
+ return str_replace( array( 'https:', 'http:' ), '', $url );
49
+ }
50
+
51
  /**
52
  * @return string Site URL
53
  */
174
  return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
175
  }
176
 
177
+ public static function is_not_empty_value( $value, $empty = '' ) {
178
+ return ! self::is_empty_value( $value, $empty );
179
+ }
180
+
181
  /**
182
  * Get any value from the $_SERVER
183
  *
333
  }
334
  }
335
 
336
+ public static function sanitize_array( &$values ) {
337
+ $temp_values = $values;
338
+ foreach ( $temp_values as $k => $val ) {
339
+ $values[ $k ] = wp_kses_post( $val );
340
+ }
341
+ }
342
+
343
  /**
344
  * Sanitize the value, and allow some HTML
345
  * @since 2.0
580
  }
581
  }
582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  public static function frm_capabilities($type = 'auto') {
584
  $cap = array(
585
  'frm_view_forms' => __( 'View Forms and Templates', 'formidable' ),
645
  }
646
  }
647
 
648
+ /**
649
+ * Make sure admins have permission to see the menu items
650
+ * @since 2.0.6
651
+ */
652
+ public static function force_capability( $cap = 'frm_change_settings' ) {
653
+ if ( current_user_can( 'administrator' ) && ! current_user_can( $cap ) ) {
654
+ $role = get_role( 'administrator' );
655
+ $frm_roles = self::frm_capabilities();
656
+ foreach ( $frm_roles as $frm_role => $frm_role_description ) {
657
+ $role->add_cap( $frm_role );
658
+ }
659
+ }
660
+ }
661
+
662
  /**
663
  * Check if the user has permision for action.
664
  * Return permission message and stop the action if no permission
1045
  private static function fill_form_opts($record, $table, $post_values, array &$values) {
1046
  if ( $table == 'entries' ) {
1047
  $form = $record->form_id;
1048
+ FrmForm::maybe_get_form( $form );
1049
  } else {
1050
  $form = $record;
1051
  }
1676
  }
1677
  }
1678
 
1679
+ /**
1680
+ * @since 2.0.9
1681
+ */
1682
+ public static function load_font_style() {
1683
+ wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1684
+ }
1685
+
1686
+ /**
1687
+ * @param string $location
1688
+ */
1689
+ public static function localize_script( $location ) {
1690
+ wp_localize_script( 'formidable', 'frm_js', array(
1691
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
1692
+ 'images_url' => self::plugin_url() . '/images',
1693
+ 'loading' => __( 'Loading&hellip;' ),
1694
+ 'remove' => __( 'Remove', 'formidable' ),
1695
+ 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
1696
+ 'nonce' => wp_create_nonce( 'frm_ajax' ),
1697
+ 'id' => __( 'ID', 'formidable' ),
1698
+ ) );
1699
+
1700
+ if ( $location == 'admin' ) {
1701
+ $frm_settings = self::get_settings();
1702
+ wp_localize_script( 'formidable_admin', 'frm_admin_js', array(
1703
+ 'confirm_uninstall' => __( 'Are you sure you want to do this? Clicking OK will delete all forms, form data, and all other Formidable data. There is no Undo.', 'formidable' ),
1704
+ 'desc' => __( '(Click to add description)', 'formidable' ),
1705
+ 'blank' => __( '(blank)', 'formidable' ),
1706
+ 'no_label' => __( '(no label)', 'formidable' ),
1707
+ 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
1708
+ 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
1709
+ 'ok' => __( 'OK' ),
1710
+ 'cancel' => __( 'Cancel', 'formidable' ),
1711
+ 'default' => __( 'Default', 'formidable' ),
1712
+ 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
1713
+ 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
1714
+ 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
1715
+ 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
1716
+ 'confirm' => __( 'Are you sure?', 'formidable' ),
1717
+ 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
1718
+ 'conf_delete_sec' => __( 'WARNING: This will delete all fields inside of the section as well.', 'formidable' ),
1719
+ 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
1720
+ 'default_unique' => $frm_settings->unique_msg,
1721
+ 'default_conf' => __( 'The entered values do not match', 'formidable' ),
1722
+ 'enter_email' => __( 'Enter Email', 'formidable' ),
1723
+ 'confirm_email' => __( 'Confirm Email', 'formidable' ),
1724
+ 'enter_password' => __( 'Enter Password', 'formidable' ),
1725
+ 'confirm_password' => __( 'Confirm Password', 'formidable' ),
1726
+ 'import_complete' => __( 'Import Complete', 'formidable' ),
1727
+ 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
1728
+ 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
1729
+ 'jquery_ui_url' => self::jquery_ui_base_url(),
1730
+ ) );
1731
+ }
1732
+ }
1733
+
1734
  /**
1735
  * @since 1.07.10
1736
  *
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -25,14 +25,14 @@ class FrmEntriesHelper {
25
  if ( ! $reset && $_POST && isset( $_POST['item_meta'][ $field->id ] ) && $_POST['item_meta'][ $field->id ] != '' ) {
26
  $new_value = stripslashes_deep( $_POST['item_meta'][ $field->id ] );
27
  $posted_val = true;
28
- } else if ( isset($field->field_options['clear_on_focus']) && $field->field_options['clear_on_focus'] ) {
29
  $new_value = '';
30
  }
31
 
32
  $is_default = ($new_value == $default) ? true : false;
33
 
34
  //If checkbox, multi-select dropdown, or checkbox data from entries field, set return array to true
35
- $return_array = FrmFieldsHelper::is_field_with_multiple_values( $field );
36
 
37
  $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
38
 
@@ -113,282 +113,28 @@ class FrmEntriesHelper {
113
  }
114
 
115
  public static function get_admin_params( $form = null ) {
116
- $form_id = $form;
117
- if ( $form === null ) {
118
- $form_id = self::get_current_form_id();
119
- } else if ( $form && is_object($form) ) {
120
- $form_id = $form->id;
121
- }
122
-
123
- $values = array();
124
- foreach ( array(
125
- 'id' => '', 'form_name' => '', 'paged' => 1, 'form' => $form_id,
126
- 'field_id' => '', 'search' => '', 'sort' => '', 'sdir' => '', 'fid' => '',
127
- 'keep_post' => '',
128
- ) as $var => $default ) {
129
- $values[ $var ] = FrmAppHelper::get_param( $var, $default );
130
- }
131
-
132
- return $values;
133
- }
134
-
135
- public static function set_current_form($form_id) {
136
- global $frm_vars;
137
-
138
- $query = array();
139
- if ( $form_id ) {
140
- $query['id'] = $form_id;
141
- }
142
-
143
- $frm_vars['current_form'] = FrmForm::get_published_forms( $query, 1 );
144
-
145
- return $frm_vars['current_form'];
146
  }
147
 
148
- public static function get_current_form($form_id = 0) {
149
- global $frm_vars, $wpdb;
150
-
151
- if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && ( ! $form_id || $form_id == $frm_vars['current_form']->id ) ) {
152
- return $frm_vars['current_form'];
153
- }
154
 
155
- $form_id = FrmAppHelper::get_param('form', $form_id, 'get', 'absint' );
156
- return self::set_current_form($form_id);
157
- }
 
158
 
159
  public static function get_current_form_id() {
160
- $form = self::get_current_form();
161
- $form_id = $form ? $form->id : 0;
162
-
163
- return $form_id;
164
  }
165
 
166
- /**
167
- * If $entry is numeric, get the entry object
168
- * @param int|object $entry by reference
169
- *
170
- */
171
  public static function maybe_get_entry( &$entry ) {
172
- if ( $entry && is_numeric($entry) ) {
173
- $entry = FrmEntry::getOne($entry);
174
- }
175
- }
176
-
177
- public static function fill_entry_values($atts, $f, array &$values) {
178
- if ( FrmFieldsHelper::is_no_save_field( $f->type ) ) {
179
- return;
180
- }
181
-
182
- if ( $atts['default_email'] ) {
183
- $values[ $f->id ] = array( 'label' => '['. $f->id .' show=field_label]', 'val' => '['. $f->id .']' );
184
- return;
185
- }
186
-
187
- //Remove signature from default-message shortcode
188
- if ( $f->type == 'signature' ) {
189
- return;
190
- }
191
-
192
- if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $f->id ] ) ) {
193
- // In case include_blank is set
194
- $atts['entry']->metas[ $f->id ] = '';
195
-
196
- if ( FrmAppHelper::pro_is_installed() ) {
197
- // If field is a post field
198
- if ( $atts['entry']->post_id && ( $f->type == 'tag' || (isset($f->field_options['post_field']) && $f->field_options['post_field'])) ) {
199
- $p_val = FrmProEntryMetaHelper::get_post_value($atts['entry']->post_id, $f->field_options['post_field'], $f->field_options['custom_field'], array(
200
- 'truncate' => (($f->field_options['post_field'] == 'post_category') ? true : false),
201
- 'form_id' => $atts['entry']->form_id, 'field' => $f, 'type' => $f->type,
202
- 'exclude_cat' => ( isset( $f->field_options['exclude_cat'] ) ? $f->field_options['exclude_cat'] : 0 ),
203
- ));
204
- if ( $p_val != '' ) {
205
- $atts['entry']->metas[ $f->id ] = $p_val;
206
- }
207
- }
208
-
209
- // If field is in a repeating section
210
- if ( $atts['entry']->form_id != $f->form_id ) {
211
- // get entry ids linked through repeat field or embeded form
212
- $child_entries = FrmProEntry::get_sub_entries($atts['entry']->id, true);
213
- $val = FrmProEntryMetaHelper::get_sub_meta_values($child_entries, $f);
214
- if ( ! empty( $val ) ) {
215
- //Flatten multi-dimensional array for multi-file upload field
216
- self::flatten_multi_file_upload( $val, $f );
217
- $atts['entry']->metas[ $f->id ] = $val;
218
- }
219
- } else {
220
- $val = '';
221
- FrmProEntriesHelper::get_dynamic_list_values( $f, $atts['entry'], $val );
222
- $atts['entry']->metas[ $f->id ] = $val;
223
- }
224
- }
225
- }
226
-
227
- $val = '';
228
- if ( $atts['entry'] ) {
229
- $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] );
230
- $meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type );
231
-
232
- //This filter applies to the default-message shortcode and frm-show-entry shortcode only
233
- if ( isset($atts['filter']) && $atts['filter'] == false ) {
234
- $val = $prev_val;
235
- } else {
236
- $val = apply_filters('frm_email_value', $prev_val, (object) $meta, $atts['entry']);
237
- }
238
- }
239
-
240
- // Don't include blank values
241
- if ( ! $atts['include_blank'] && FrmAppHelper::is_empty_value( $val ) ) {
242
- return;
243
- }
244
-
245
- self::textarea_display_value( $val, $f->type, $atts['plain_text'] );
246
-
247
- if ( is_array($val) && $atts['format'] == 'text' ) {
248
- $val = implode(', ', $val);
249
- }
250
-
251
- if ( $atts['format'] != 'text' ) {
252
- $values[ $f->field_key ] = $val;
253
- } else {
254
- $values[ $f->id ] = array( 'label' => $f->name, 'val' => $val );
255
- }
256
- }
257
-
258
- /**
259
- * Flatten multi-dimensional array for multi-file upload fields
260
- * @since 2.0
261
- */
262
- public static function flatten_multi_file_upload( &$val, $field ) {
263
- if ( $field->type == 'file' && isset( $field->field_options['multiple'] ) && $field->field_options['multiple'] ) {
264
- $val = FrmAppHelper::array_flatten( $val );
265
- }
266
- }
267
-
268
- /**
269
- * Replace returns with HTML line breaks for display
270
- * @since 2.0
271
- */
272
- public static function textarea_display_value( &$value, $type, $plain_text ) {
273
- if ( $type == 'textarea' && ! $plain_text ) {
274
- $value = str_replace( array( "\r\n", "\r", "\n" ), ' <br/>', $value );
275
- }
276
- }
277
-
278
- public static function fill_entry_user_info($atts, array &$values) {
279
- if ( ! $atts['user_info'] ) {
280
- return;
281
- }
282
-
283
- $data = self::get_entry_description_data( $atts );
284
-
285
- if ( $atts['default_email'] ) {
286
- $atts['entry']->ip = '[ip]';
287
- }
288
-
289
- if ( $atts['format'] != 'text' ) {
290
- $values['ip'] = $atts['entry']->ip;
291
- $values['browser'] = self::get_browser($data['browser']);
292
- $values['referrer'] = $data['referrer'];
293
- } else {
294
- $values['ip'] = array( 'label' => __( 'IP Address', 'formidable' ), 'val' => $atts['entry']->ip );
295
- $values['browser'] = array(
296
- 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ),
297
- 'val' => self::get_browser($data['browser']),
298
- );
299
- $values['referrer'] = array( 'label' => __( 'Referrer', 'formidable' ), 'val' => $data['referrer'] );
300
- }
301
- }
302
-
303
- /**
304
- * @param array $atts - include (object) entry, (boolean) default_email
305
- * @since 2.0.8
306
- */
307
- public static function get_entry_description_data( $atts ) {
308
- $default_data = array(
309
- 'browser' => '',
310
- 'referrer' => '',
311
- );
312
- $data = $default_data;
313
-
314
- if ( isset( $atts['entry']->description ) ) {
315
- $data = maybe_unserialize( $atts['entry']->description );
316
- } else if ( $atts['default_email'] ) {
317
- $data = array(
318
- 'browser' => '[browser]',
319
- 'referrer' => '[referrer]',
320
- );
321
- }
322
-
323
- return array_merge( $default_data, $data );
324
- }
325
-
326
- public static function convert_entry_to_content($values, $atts, array &$content) {
327
-
328
- if ( $atts['plain_text'] ) {
329
- $bg_color_alt = $row_style = '';
330
- } else {
331
- $default_settings = apply_filters('frm_show_entry_styles', array(
332
- 'border_color' => 'dddddd',
333
- 'bg_color' => 'f7f7f7',
334
- 'text_color' => '444444',
335
- 'font_size' => '12px',
336
- 'border_width' => '1px',
337
- 'alt_bg_color' => 'ffffff',
338
- ) );
339
-
340
- // merge defaults, global settings, and shortcode options
341
- foreach ( $default_settings as $key => $setting ) {
342
- if ( $atts[ $key ] != '' ) {
343
- continue;
344
- }
345
-
346
- $atts[ $key ] = $setting;
347
- unset($key, $setting);
348
- }
349
-
350
- unset($default_settings);
351
-
352
- $content[] = '<table cellspacing="0" style="font-size:'. $atts['font_size'] .';line-height:135%; border-bottom:'. $atts['border_width'] .' solid #'. $atts['border_color'] .';"><tbody>'."\r\n";
353
- $atts['bg_color'] = ' style="background-color:#'. $atts['bg_color'] .';"';
354
- $bg_color_alt = ' style="background-color:#'. $atts['alt_bg_color'] .';"';
355
- $row_style = 'style="text-align:'. ( $atts['direction'] == 'rtl' ? 'right' : 'left' ) .';color:#'. $atts['text_color'] .';padding:7px 9px;border-top:'. $atts['border_width'] .' solid #'. $atts['border_color'] .'"';
356
- }
357
-
358
- $odd = true;
359
- foreach ( $values as $id => $value ) {
360
- if ( $atts['plain_text'] ) {
361
- if ( 'rtl' == $atts['direction'] ) {
362
- $content[] = $value['val'] . ' :'. $value['label'] ."\r\n";
363
- } else {
364
- $content[] = $value['label'] . ': '. $value['val'] ."\r\n";
365
- }
366
- continue;
367
- }
368
-
369
- if ( $atts['default_email'] && is_numeric($id) ) {
370
- $content[] = '[if '. $id .']<tr style="[frm-alt-color]">';
371
- } else {
372
- $content[] = '<tr'. ( $odd ? $atts['bg_color'] : $bg_color_alt ) .'>';
373
- }
374
-
375
- $value['val'] = str_replace( "\r\n", '<br/>', $value['val'] );
376
- if ( 'rtl' == $atts['direction'] ) {
377
- $content[] = '<td '. $row_style .'>'. $value['val'] .'</td><th '. $row_style .'>'. $value['label'] . '</th>';
378
- } else {
379
- $content[] = '<th '. $row_style .'>'. $value['label'] .'</th><td '. $row_style .'>'. $value['val'] .'</td>';
380
- }
381
- $content[] = '</tr>'. "\r\n";
382
-
383
- if ( $atts['default_email'] && is_numeric($id) ) {
384
- $content[] = '[/if '. $id .']';
385
- }
386
- $odd = $odd ? false : true;
387
- }
388
-
389
- if ( ! $atts['plain_text'] ) {
390
- $content[] = '</tbody></table>';
391
- }
392
  }
393
 
394
  public static function replace_default_message($message, $atts) {
@@ -412,7 +158,7 @@ class FrmEntriesHelper {
412
  $this_atts = $atts;
413
  }
414
 
415
- $default = FrmEntriesController::show_entry_shortcode($this_atts);
416
 
417
  // Add the default message
418
  $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
@@ -585,7 +331,7 @@ class FrmEntriesHelper {
585
  self::set_other_repeating_vals( $field, $value, $args );
586
 
587
  // Check if there are any posted "Other" values
588
- if ( isset( $field->field_options['other'] ) && $field->field_options['other'] && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
589
 
590
  // Save original value
591
  $args['temp_value'] = $value;
@@ -612,7 +358,7 @@ class FrmEntriesHelper {
612
  }
613
 
614
  // Check if there are any other posted "other" values for this field
615
- if ( isset( $field->field_options['other'] ) && $field->field_options['other'] && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
616
  // Save original value
617
  $args['temp_value'] = $value;
618
  $args['other'] = true;
@@ -675,13 +421,10 @@ class FrmEntriesHelper {
675
  }
676
  }
677
 
678
- public static function entries_dropdown() {
679
- _deprecated_function( __FUNCTION__, '1.07.09');
680
- }
681
-
682
- public static function enqueue_scripts($params) {
683
- do_action('frm_enqueue_form_scripts', $params);
684
- }
685
 
686
  // Add submitted values to a string for spam checking
687
  public static function entry_array_to_string($values) {
@@ -701,69 +444,42 @@ class FrmEntriesHelper {
701