PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0
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 +57 -91 6.55.0 View file →
@@ -23,9 +23,9 @@
23 23 /**
24 24 * @since 2.05.07
25 25 */
26 26 private static function load_manage_entries_hooks() {
27 - if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) {
27 + if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new' ) ) ) {
28 28 $menu_name = FrmAppHelper::get_menu_name();
29 29 $base = self::base_column_key( $menu_name );
30 30
31 31 add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
@@ -80,14 +80,13 @@
80 80
81 81 if ( $form_id ) {
82 82 self::get_columns_for_form( $form_id, $columns );
83 83 } 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' );
84 + $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
85 + $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
86 + $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
87 87 }
88 88
89 - $columns[ $form_id . '_is_draft' ] = esc_html__( 'Entry Status', 'formidable' );
90 89 $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
91 90 $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
92 91 self::maybe_add_ip_col( $form_id, $columns );
93 92
@@ -97,9 +96,9 @@
97 96 if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
98 97 add_screen_option(
99 98 'per_page',
100 99 array(
101 - 'label' => esc_html__( 'Entries', 'formidable' ),
100 + 'label' => __( 'Entries', 'formidable' ),
102 101 'default' => 20,
103 102 'option' => 'formidable_page_formidable_entries_per_page',
104 103 )
105 104 );
@@ -110,18 +109,8 @@
110 109
111 110 private static function get_columns_for_form( $form_id, &$columns ) {
112 111 $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
113 112
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 113 foreach ( $form_cols as $form_col ) {
125 114 if ( FrmField::is_no_save_field( $form_col->type ) ) {
126 115 continue;
127 116 }
@@ -286,9 +275,10 @@
286 275 $form_id . '_is_draft' => 'is_draft',
287 276 );
288 277
289 278 foreach ( $fields as $field ) {
290 - if ( self::field_supports_sorting( $field ) ) {
279 + if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
280 + // Can't sort on checkboxes because they are stored serialized, or post fields
291 281 $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
292 282 }
293 283 }
294 284
@@ -294,32 +284,9 @@
294 284
295 285 return $columns;
296 286 }
297 287
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 288 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 289 $form_id = FrmForm::get_current_form_id();
323 290
324 291 $hidden = self::user_hidden_columns_for_form( $form_id, $result );
325 292
@@ -417,9 +384,9 @@
417 384 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
418 385 if ( $pagenum > $total_pages && $total_pages > 0 ) {
419 386 $url = add_query_arg( 'paged', $total_pages );
420 387 if ( headers_sent() ) {
421 - FrmAppHelper::js_redirect( $url, true );
388 + echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok.
422 389 } else {
423 390 wp_redirect( esc_url_raw( $url ) );
424 391 }
425 392 die();
@@ -428,9 +395,9 @@
428 395 if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
429 396 $message = __( 'Your import is complete', 'formidable' );
430 397 }
431 398
432 - require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
399 + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
433 400 }
434 401
435 402 private static function get_delete_form_time( $form, &$errors ) {
436 403 if ( 'trash' == $form->status ) {
@@ -473,19 +440,10 @@
473 440
474 441 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
475 442 }
476 443
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 444 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 - }
445 + FrmAppHelper::permission_check( 'frm_delete_entries' );
488 446
489 447 $params = FrmForm::get_admin_params();
490 448
491 449 if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
@@ -493,9 +451,9 @@
493 451 }
494 452
495 453 $message = '';
496 454 if ( FrmEntry::destroy( $params['id'] ) ) {
497 - $message = __( 'Entry was successfully deleted', 'formidable' );
455 + $message = __( 'Entry was Successfully Deleted', 'formidable' );
498 456 }
499 457
500 458 self::display_list( $message );
501 459 }
@@ -511,9 +469,9 @@
511 469 }
512 470
513 471 public static function process_entry( $errors = '', $ajax = false ) {
514 472 $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
473 + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
516 474 return;
517 475 }
518 476
519 477 global $frm_vars;
@@ -534,9 +492,9 @@
534 492 return;
535 493 }
536 494
537 495 if ( $errors == '' && ! $ajax ) {
538 - $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
496 + $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) );
539 497 }
540 498
541 499 /**
542 500 * Use this filter to add trigger actions and add errors after
@@ -550,11 +508,11 @@
550 508
551 509 if ( empty( $errors ) ) {
552 510 $_POST['frm_skip_cookie'] = 1;
553 511 $do_success = false;
554 - if ( $params['action'] === 'create' ) {
512 + if ( $params['action'] == 'create' ) {
555 513 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
514 + $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
557 515
558 516 $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
559 517 $do_success = true;
560 518 }
@@ -563,9 +521,9 @@
563 521 do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
564 522 if ( $do_success ) {
565 523 FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
566 524 }
567 - unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
525 + unset( $_POST['frm_skip_cookie'] );
568 526 }
569 527 }
570 528
571 529 /**
@@ -623,34 +581,33 @@
623 581 * @return array|string
624 582 */
625 583 public static function show_entry_shortcode( $atts ) {
626 584 $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' => ', ',
585 + 'id' => false,
586 + 'entry' => false,
587 + 'fields' => false,
588 + 'plain_text' => false,
589 + 'user_info' => false,
590 + 'include_blank' => false,
591 + 'default_email' => false,
592 + 'form_id' => false,
593 + 'format' => 'text',
594 + 'array_key' => 'key',
595 + 'direction' => 'ltr',
596 + 'font_size' => '',
597 + 'text_color' => '',
598 + 'border_width' => '',
599 + 'border_color' => '',
600 + 'bg_color' => '',
601 + 'alt_bg_color' => '',
602 + 'class' => '',
603 + 'clickable' => false,
604 + 'exclude_fields' => '',
605 + 'include_fields' => '',
606 + 'include_extras' => '',
607 + 'inline_style' => 1,
608 + 'child_array' => false, // return embedded fields as nested array
609 + 'line_breaks' => true,
653 610 );
654 611 $defaults = apply_filters( 'frm_show_entry_defaults', $defaults );
655 612
656 613 $atts = shortcode_atts( $defaults, $atts );
@@ -686,15 +643,8 @@
686 643 $data = $entry->description;
687 644 if ( isset( $data['browser'] ) ) {
688 645 $browser = FrmEntriesHelper::get_browser( $data['browser'] );
689 646 }
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 647 }
698 648
699 649 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
700 650 }
@@ -704,6 +654,22 @@
704 654 */
705 655 public static function contextual_help( $help, $screen_id, $screen ) {
706 656 _deprecated_function( __METHOD__, '4.0' );
707 657 return $help;
658 + }
659 +
660 + /**
661 + * @deprecated 1.07.05
662 + * @codeCoverageIgnore
663 + */
664 + public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
665 + return FrmDeprecated::show_form( $id, $key, $title, $description );
666 + }
667 +
668 + /**
669 + * @deprecated 1.07.05
670 + * @codeCoverageIgnore
671 + */
672 + public static function get_form( $filename, $form, $title, $description ) {
673 + return FrmDeprecated::get_form( $filename, $form, $title, $description );
708 674 }
709 675 }