PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 4.07.01
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v4.07.01
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmEntriesController.php +58 -93 6.54.07.01 View file →
@@ -9,10 +9,9 @@
9 9 FrmAppHelper::force_capability( 'frm_view_entries' );
10 10
11 11 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
12 12
13 - $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
14 - if ( ! $views_installed ) {
13 + if ( ! FrmAppHelper::pro_is_installed() ) {
15 14 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), __( 'Views', 'formidable' ), 'frm_view_entries', 'formidable-views', 'FrmFormsController::no_views' );
16 15 }
17 16
18 17 if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
@@ -23,9 +22,9 @@
23 22 /**
24 23 * @since 2.05.07
25 24 */
26 25 private static function load_manage_entries_hooks() {
27 - if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) {
26 + if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new' ) ) ) {
28 27 $menu_name = FrmAppHelper::get_menu_name();
29 28 $base = self::base_column_key( $menu_name );
30 29
31 30 add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
@@ -80,14 +79,13 @@
80 79
81 80 if ( $form_id ) {
82 81 self::get_columns_for_form( $form_id, $columns );
83 82 } else {
84 - $columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' );
85 - $columns[ $form_id . '_name' ] = esc_html__( 'Entry Name', 'formidable' );
86 - $columns[ $form_id . '_user_id' ] = esc_html__( 'Created By', 'formidable' );
83 + $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
84 + $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
85 + $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
87 86 }
88 87
89 - $columns[ $form_id . '_is_draft' ] = esc_html__( 'Entry Status', 'formidable' );
90 88 $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
91 89 $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
92 90 self::maybe_add_ip_col( $form_id, $columns );
93 91
@@ -97,9 +95,9 @@
97 95 if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
98 96 add_screen_option(
99 97 'per_page',
100 98 array(
101 - 'label' => esc_html__( 'Entries', 'formidable' ),
99 + 'label' => __( 'Entries', 'formidable' ),
102 100 'default' => 20,
103 101 'option' => 'formidable_page_formidable_entries_per_page',
104 102 )
105 103 );
@@ -110,18 +108,8 @@
110 108
111 109 private static function get_columns_for_form( $form_id, &$columns ) {
112 110 $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
113 111
114 - /**
115 - * Allows changing fields in the Entries list table heading.
116 - *
117 - * @since 5.0.04
118 - *
119 - * @param array $fields Array of fields.
120 - * @param array $args The arguments. Contains `form_id`.
121 - */
122 - $form_cols = apply_filters( 'frm_fields_in_entries_list_table', $form_cols, compact( 'form_id' ) );
123 -
124 112 foreach ( $form_cols as $form_col ) {
125 113 if ( FrmField::is_no_save_field( $form_col->type ) ) {
126 114 continue;
127 115 }
@@ -286,9 +274,10 @@
286 274 $form_id . '_is_draft' => 'is_draft',
287 275 );
288 276
289 277 foreach ( $fields as $field ) {
290 - if ( self::field_supports_sorting( $field ) ) {
278 + if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
279 + // Can't sort on checkboxes because they are stored serialized, or post fields
291 280 $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
292 281 }
293 282 }
294 283
@@ -294,32 +283,9 @@
294 283
295 284 return $columns;
296 285 }
297 286
298 - /**
299 - * Can't sort on checkboxes because they are sorted serialized.
300 - * Some post content can be sorted but not everything.
301 - *
302 - * @param stdClass $field
303 - * @return bool
304 - */
305 - private static function field_supports_sorting( $field ) {
306 - $is_sortable = 'checkbox' !== $field->type && empty( $field->field_options['post_field'] );
307 - return apply_filters( 'frm_field_column_is_sortable', $is_sortable, $field );
308 - }
309 -
310 - /**
311 - * @param mixed $result Option value from database for hidden columns in entries table.
312 - * @return array
313 - */
314 287 public static function hidden_columns( $result ) {
315 - if ( ! is_array( $result ) ) {
316 - // Force an unexpected value to be an array.
317 - // Since $result is a filtered option and gets saved to the database, it's possible it could be a string.
318 - // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error.
319 - $result = array();
320 - }
321 -
322 288 $form_id = FrmForm::get_current_form_id();
323 289
324 290 $hidden = self::user_hidden_columns_for_form( $form_id, $result );
325 291
@@ -417,9 +383,9 @@
417 383 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
418 384 if ( $pagenum > $total_pages && $total_pages > 0 ) {
419 385 $url = add_query_arg( 'paged', $total_pages );
420 386 if ( headers_sent() ) {
421 - FrmAppHelper::js_redirect( $url, true );
387 + echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok.
422 388 } else {
423 389 wp_redirect( esc_url_raw( $url ) );
424 390 }
425 391 die();
@@ -428,9 +394,9 @@
428 394 if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
429 395 $message = __( 'Your import is complete', 'formidable' );
430 396 }
431 397
432 - require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
398 + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
433 399 }
434 400
435 401 private static function get_delete_form_time( $form, &$errors ) {
436 402 if ( 'trash' == $form->status ) {
@@ -473,19 +439,10 @@
473 439
474 440 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
475 441 }
476 442
477 - /**
478 - * Destroy an entry from the admin page.
479 - * This is triggered from the entries list from the "Delete" row action, and also from the "Delete Entry" trigger in the view/edit entry sidebar.
480 - *
481 - * @return void
482 - */
483 443 public static function destroy() {
484 - $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_entries', '_wpnonce', -1 );
485 - if ( false !== $permission_error ) {
486 - wp_die( esc_html( $permission_error ) );
487 - }
444 + FrmAppHelper::permission_check( 'frm_delete_entries' );
488 445
489 446 $params = FrmForm::get_admin_params();
490 447
491 448 if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
@@ -493,9 +450,9 @@
493 450 }
494 451
495 452 $message = '';
496 453 if ( FrmEntry::destroy( $params['id'] ) ) {
497 - $message = __( 'Entry was successfully deleted', 'formidable' );
454 + $message = __( 'Entry was Successfully Deleted', 'formidable' );
498 455 }
499 456
500 457 self::display_list( $message );
501 458 }
@@ -511,9 +468,9 @@
511 468 }
512 469
513 470 public static function process_entry( $errors = '', $ajax = false ) {
514 471 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
515 - if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
472 + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
516 473 return;
517 474 }
518 475
519 476 global $frm_vars;
@@ -534,9 +491,9 @@
534 491 return;
535 492 }
536 493
537 494 if ( $errors == '' && ! $ajax ) {
538 - $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
495 + $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) );
539 496 }
540 497
541 498 /**
542 499 * Use this filter to add trigger actions and add errors after
@@ -550,11 +507,11 @@
550 507
551 508 if ( empty( $errors ) ) {
552 509 $_POST['frm_skip_cookie'] = 1;
553 510 $do_success = false;
554 - if ( $params['action'] === 'create' ) {
511 + if ( $params['action'] == 'create' ) {
555 512 if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
556 - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
513 + $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
557 514
558 515 $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
559 516 $do_success = true;
560 517 }
@@ -563,9 +520,9 @@
563 520 do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
564 521 if ( $do_success ) {
565 522 FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
566 523 }
567 - unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
524 + unset( $_POST['frm_skip_cookie'] );
568 525 }
569 526 }
570 527
571 528 /**
@@ -623,34 +580,33 @@
623 580 * @return array|string
624 581 */
625 582 public static function show_entry_shortcode( $atts ) {
626 583 $defaults = array(
627 - 'id' => false,
628 - 'entry' => false,
629 - 'fields' => false,
630 - 'plain_text' => false,
631 - 'user_info' => false,
632 - 'include_blank' => false,
633 - 'default_email' => false,
634 - 'form_id' => false,
635 - 'format' => 'text',
636 - 'array_key' => 'key',
637 - 'direction' => 'ltr',
638 - 'font_size' => '',
639 - 'text_color' => '',
640 - 'border_width' => '',
641 - 'border_color' => '',
642 - 'bg_color' => '',
643 - 'alt_bg_color' => '',
644 - 'class' => '',
645 - 'clickable' => false,
646 - 'exclude_fields' => '',
647 - 'include_fields' => '',
648 - 'include_extras' => '',
649 - 'inline_style' => 1,
650 - 'child_array' => false, // return embedded fields as nested array
651 - 'line_breaks' => true,
652 - 'array_separator' => ', ',
584 + 'id' => false,
585 + 'entry' => false,
586 + 'fields' => false,
587 + 'plain_text' => false,
588 + 'user_info' => false,
589 + 'include_blank' => false,
590 + 'default_email' => false,
591 + 'form_id' => false,
592 + 'format' => 'text',
593 + 'array_key' => 'key',
594 + 'direction' => 'ltr',
595 + 'font_size' => '',
596 + 'text_color' => '',
597 + 'border_width' => '',
598 + 'border_color' => '',
599 + 'bg_color' => '',
600 + 'alt_bg_color' => '',
601 + 'class' => '',
602 + 'clickable' => false,
603 + 'exclude_fields' => '',
604 + 'include_fields' => '',
605 + 'include_extras' => '',
606 + 'inline_style' => 1,
607 + 'child_array' => false, // return embedded fields as nested array
608 + 'line_breaks' => true,
653 609 );
654 610 $defaults = apply_filters( 'frm_show_entry_defaults', $defaults );
655 611
656 612 $atts = shortcode_atts( $defaults, $atts );
@@ -686,15 +642,8 @@
686 642 $data = $entry->description;
687 643 if ( isset( $data['browser'] ) ) {
688 644 $browser = FrmEntriesHelper::get_browser( $data['browser'] );
689 645 }
690 - /**
691 - * Add or remove information in the entry sidebar.
692 - *
693 - * @since 5.5.2
694 - * @param array $data
695 - */
696 - $data = apply_filters( 'frm_sidebar_data', $data, compact( 'entry' ) );
697 646 }
698 647
699 648 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
700 649 }
@@ -704,6 +653,22 @@
704 653 */
705 654 public static function contextual_help( $help, $screen_id, $screen ) {
706 655 _deprecated_function( __METHOD__, '4.0' );
707 656 return $help;
657 + }
658 +
659 + /**
660 + * @deprecated 1.07.05
661 + * @codeCoverageIgnore
662 + */
663 + public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
664 + return FrmDeprecated::show_form( $id, $key, $title, $description );
665 + }
666 +
667 + /**
668 + * @deprecated 1.07.05
669 + * @codeCoverageIgnore
670 + */
671 + public static function get_form( $filename, $form, $title, $description ) {
672 + return FrmDeprecated::get_form( $filename, $form, $title, $description );
708 673 }
709 674 }