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 +53 -86 6.45.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' );
@@ -109,18 +109,8 @@
109 109
110 110 private static function get_columns_for_form( $form_id, &$columns ) {
111 111 $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
112 112
113 - /**
114 - * Allows changing fields in the Entries list table heading.
115 - *
116 - * @since 5.0.04
117 - *
118 - * @param array $fields Array of fields.
119 - * @param array $args The arguments. Contains `form_id`.
120 - */
121 - $form_cols = apply_filters( 'frm_fields_in_entries_list_table', $form_cols, compact( 'form_id' ) );
122 -
123 113 foreach ( $form_cols as $form_col ) {
124 114 if ( FrmField::is_no_save_field( $form_col->type ) ) {
125 115 continue;
126 116 }
@@ -285,9 +275,10 @@
285 275 $form_id . '_is_draft' => 'is_draft',
286 276 );
287 277
288 278 foreach ( $fields as $field ) {
289 - 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
290 281 $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
291 282 }
292 283 }
293 284
@@ -293,32 +284,9 @@
293 284
294 285 return $columns;
295 286 }
296 287
297 - /**
298 - * Can't sort on checkboxes because they are sorted serialized.
299 - * Some post content can be sorted but not everything.
300 - *
301 - * @param stdClass $field
302 - * @return bool
303 - */
304 - private static function field_supports_sorting( $field ) {
305 - $is_sortable = 'checkbox' !== $field->type && empty( $field->field_options['post_field'] );
306 - return apply_filters( 'frm_field_column_is_sortable', $is_sortable, $field );
307 - }
308 -
309 - /**
310 - * @param mixed $result Option value from database for hidden columns in entries table.
311 - * @return array
312 - */
313 288 public static function hidden_columns( $result ) {
314 - if ( ! is_array( $result ) ) {
315 - // Force an unexpected value to be an array.
316 - // Since $result is a filtered option and gets saved to the database, it's possible it could be a string.
317 - // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error.
318 - $result = array();
319 - }
320 -
321 289 $form_id = FrmForm::get_current_form_id();
322 290
323 291 $hidden = self::user_hidden_columns_for_form( $form_id, $result );
324 292
@@ -416,9 +384,9 @@
416 384 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
417 385 if ( $pagenum > $total_pages && $total_pages > 0 ) {
418 386 $url = add_query_arg( 'paged', $total_pages );
419 387 if ( headers_sent() ) {
420 - FrmAppHelper::js_redirect( $url, true );
388 + echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok.
421 389 } else {
422 390 wp_redirect( esc_url_raw( $url ) );
423 391 }
424 392 die();
@@ -427,9 +395,9 @@
427 395 if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
428 396 $message = __( 'Your import is complete', 'formidable' );
429 397 }
430 398
431 - require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
399 + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
432 400 }
433 401
434 402 private static function get_delete_form_time( $form, &$errors ) {
435 403 if ( 'trash' == $form->status ) {
@@ -472,19 +440,10 @@
472 440
473 441 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
474 442 }
475 443
476 - /**
477 - * Destroy an entry from the admin page.
478 - * 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.
479 - *
480 - * @return void
481 - */
482 444 public static function destroy() {
483 - $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_entries', '_wpnonce', -1 );
484 - if ( false !== $permission_error ) {
485 - wp_die( esc_html( $permission_error ) );
486 - }
445 + FrmAppHelper::permission_check( 'frm_delete_entries' );
487 446
488 447 $params = FrmForm::get_admin_params();
489 448
490 449 if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
@@ -492,9 +451,9 @@
492 451 }
493 452
494 453 $message = '';
495 454 if ( FrmEntry::destroy( $params['id'] ) ) {
496 - $message = __( 'Entry was successfully deleted', 'formidable' );
455 + $message = __( 'Entry was Successfully Deleted', 'formidable' );
497 456 }
498 457
499 458 self::display_list( $message );
500 459 }
@@ -510,9 +469,9 @@
510 469 }
511 470
512 471 public static function process_entry( $errors = '', $ajax = false ) {
513 472 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
514 - 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'] ) ) {
515 474 return;
516 475 }
517 476
518 477 global $frm_vars;
@@ -533,9 +492,9 @@
533 492 return;
534 493 }
535 494
536 495 if ( $errors == '' && ! $ajax ) {
537 - $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
496 + $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) );
538 497 }
539 498
540 499 /**
541 500 * Use this filter to add trigger actions and add errors after
@@ -549,11 +508,11 @@
549 508
550 509 if ( empty( $errors ) ) {
551 510 $_POST['frm_skip_cookie'] = 1;
552 511 $do_success = false;
553 - if ( $params['action'] === 'create' ) {
512 + if ( $params['action'] == 'create' ) {
554 513 if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
555 - $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 );
556 515
557 516 $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
558 517 $do_success = true;
559 518 }
@@ -562,9 +521,9 @@
562 521 do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
563 522 if ( $do_success ) {
564 523 FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
565 524 }
566 - unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
525 + unset( $_POST['frm_skip_cookie'] );
567 526 }
568 527 }
569 528
570 529 /**
@@ -622,34 +581,33 @@
622 581 * @return array|string
623 582 */
624 583 public static function show_entry_shortcode( $atts ) {
625 584 $defaults = array(
626 - 'id' => false,
627 - 'entry' => false,
628 - 'fields' => false,
629 - 'plain_text' => false,
630 - 'user_info' => false,
631 - 'include_blank' => false,
632 - 'default_email' => false,
633 - 'form_id' => false,
634 - 'format' => 'text',
635 - 'array_key' => 'key',
636 - 'direction' => 'ltr',
637 - 'font_size' => '',
638 - 'text_color' => '',
639 - 'border_width' => '',
640 - 'border_color' => '',
641 - 'bg_color' => '',
642 - 'alt_bg_color' => '',
643 - 'class' => '',
644 - 'clickable' => false,
645 - 'exclude_fields' => '',
646 - 'include_fields' => '',
647 - 'include_extras' => '',
648 - 'inline_style' => 1,
649 - 'child_array' => false, // return embedded fields as nested array
650 - 'line_breaks' => true,
651 - '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,
652 610 );
653 611 $defaults = apply_filters( 'frm_show_entry_defaults', $defaults );
654 612
655 613 $atts = shortcode_atts( $defaults, $atts );
@@ -685,15 +643,8 @@
685 643 $data = $entry->description;
686 644 if ( isset( $data['browser'] ) ) {
687 645 $browser = FrmEntriesHelper::get_browser( $data['browser'] );
688 646 }
689 - /**
690 - * Add or remove information in the entry sidebar.
691 - *
692 - * @since 5.5.2
693 - * @param array $data
694 - */
695 - $data = apply_filters( 'frm_sidebar_data', $data, compact( 'entry' ) );
696 647 }
697 648
698 649 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
699 650 }
@@ -703,6 +654,22 @@
703 654 */
704 655 public static function contextual_help( $help, $screen_id, $screen ) {
705 656 _deprecated_function( __METHOD__, '4.0' );
706 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 );
707 674 }
708 675 }