| @@ -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' ); |
| @@ -305,20 +305,9 @@ | ||
| 305 | 305 | $is_sortable = 'checkbox' !== $field->type && empty( $field->field_options['post_field'] ); |
| 306 | 306 | return apply_filters( 'frm_field_column_is_sortable', $is_sortable, $field ); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - /** | |
| 310 | - * @param mixed $result Option value from database for hidden columns in entries table. | |
| 311 | - * @return array | |
| 312 | - */ | |
| 313 | 309 | 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 | 310 | $form_id = FrmForm::get_current_form_id(); |
| 322 | 311 | |
| 323 | 312 | $hidden = self::user_hidden_columns_for_form( $form_id, $result ); |
| 324 | 313 | |
| @@ -416,9 +405,9 @@ | ||
| 416 | 405 | $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
| 417 | 406 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
| 418 | 407 | $url = add_query_arg( 'paged', $total_pages ); |
| 419 | 408 | if ( headers_sent() ) { |
| 420 | - FrmAppHelper::js_redirect( $url, true ); | |
| 409 | + echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok. | |
| 421 | 410 | } else { |
| 422 | 411 | wp_redirect( esc_url_raw( $url ) ); |
| 423 | 412 | } |
| 424 | 413 | die(); |
| @@ -427,9 +416,9 @@ | ||
| 427 | 416 | if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
| 428 | 417 | $message = __( 'Your import is complete', 'formidable' ); |
| 429 | 418 | } |
| 430 | 419 | |
| 431 | - require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php'; | |
| 420 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); | |
| 432 | 421 | } |
| 433 | 422 | |
| 434 | 423 | private static function get_delete_form_time( $form, &$errors ) { |
| 435 | 424 | if ( 'trash' == $form->status ) { |
| @@ -472,19 +461,10 @@ | ||
| 472 | 461 | |
| 473 | 462 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
| 474 | 463 | } |
| 475 | 464 | |
| 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 | 465 | 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 | - } | |
| 466 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); | |
| 487 | 467 | |
| 488 | 468 | $params = FrmForm::get_admin_params(); |
| 489 | 469 | |
| 490 | 470 | if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
| @@ -492,9 +472,9 @@ | ||
| 492 | 472 | } |
| 493 | 473 | |
| 494 | 474 | $message = ''; |
| 495 | 475 | if ( FrmEntry::destroy( $params['id'] ) ) { |
| 496 | - $message = __( 'Entry was successfully deleted', 'formidable' ); | |
| 476 | + $message = __( 'Entry was Successfully Deleted', 'formidable' ); | |
| 497 | 477 | } |
| 498 | 478 | |
| 499 | 479 | self::display_list( $message ); |
| 500 | 480 | } |
| @@ -510,9 +490,9 @@ | ||
| 510 | 490 | } |
| 511 | 491 | |
| 512 | 492 | public static function process_entry( $errors = '', $ajax = false ) { |
| 513 | 493 | $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 | |
| 494 | + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { | |
| 515 | 495 | return; |
| 516 | 496 | } |
| 517 | 497 | |
| 518 | 498 | global $frm_vars; |
| @@ -533,9 +513,9 @@ | ||
| 533 | 513 | return; |
| 534 | 514 | } |
| 535 | 515 | |
| 536 | 516 | if ( $errors == '' && ! $ajax ) { |
| 537 | - $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 517 | + $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); | |
| 538 | 518 | } |
| 539 | 519 | |
| 540 | 520 | /** |
| 541 | 521 | * Use this filter to add trigger actions and add errors after |
| @@ -549,11 +529,11 @@ | ||
| 549 | 529 | |
| 550 | 530 | if ( empty( $errors ) ) { |
| 551 | 531 | $_POST['frm_skip_cookie'] = 1; |
| 552 | 532 | $do_success = false; |
| 553 | - if ( $params['action'] === 'create' ) { | |
| 533 | + if ( $params['action'] == 'create' ) { | |
| 554 | 534 | 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 | |
| 535 | + $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); | |
| 556 | 536 | |
| 557 | 537 | $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
| 558 | 538 | $do_success = true; |
| 559 | 539 | } |
| @@ -562,9 +542,9 @@ | ||
| 562 | 542 | do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
| 563 | 543 | if ( $do_success ) { |
| 564 | 544 | FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) ); |
| 565 | 545 | } |
| 566 | - unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 546 | + unset( $_POST['frm_skip_cookie'] ); | |
| 567 | 547 | } |
| 568 | 548 | } |
| 569 | 549 | |
| 570 | 550 | /** |
| @@ -622,34 +602,33 @@ | ||
| 622 | 602 | * @return array|string |
| 623 | 603 | */ |
| 624 | 604 | public static function show_entry_shortcode( $atts ) { |
| 625 | 605 | $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' => ', ', | |
| 606 | + 'id' => false, | |
| 607 | + 'entry' => false, | |
| 608 | + 'fields' => false, | |
| 609 | + 'plain_text' => false, | |
| 610 | + 'user_info' => false, | |
| 611 | + 'include_blank' => false, | |
| 612 | + 'default_email' => false, | |
| 613 | + 'form_id' => false, | |
| 614 | + 'format' => 'text', | |
| 615 | + 'array_key' => 'key', | |
| 616 | + 'direction' => 'ltr', | |
| 617 | + 'font_size' => '', | |
| 618 | + 'text_color' => '', | |
| 619 | + 'border_width' => '', | |
| 620 | + 'border_color' => '', | |
| 621 | + 'bg_color' => '', | |
| 622 | + 'alt_bg_color' => '', | |
| 623 | + 'class' => '', | |
| 624 | + 'clickable' => false, | |
| 625 | + 'exclude_fields' => '', | |
| 626 | + 'include_fields' => '', | |
| 627 | + 'include_extras' => '', | |
| 628 | + 'inline_style' => 1, | |
| 629 | + 'child_array' => false, // return embedded fields as nested array | |
| 630 | + 'line_breaks' => true, | |
| 652 | 631 | ); |
| 653 | 632 | $defaults = apply_filters( 'frm_show_entry_defaults', $defaults ); |
| 654 | 633 | |
| 655 | 634 | $atts = shortcode_atts( $defaults, $atts ); |
| @@ -685,15 +664,8 @@ | ||
| 685 | 664 | $data = $entry->description; |
| 686 | 665 | if ( isset( $data['browser'] ) ) { |
| 687 | 666 | $browser = FrmEntriesHelper::get_browser( $data['browser'] ); |
| 688 | 667 | } |
| 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 | 668 | } |
| 697 | 669 | |
| 698 | 670 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
| 699 | 671 | } |
| @@ -703,6 +675,22 @@ | ||
| 703 | 675 | */ |
| 704 | 676 | public static function contextual_help( $help, $screen_id, $screen ) { |
| 705 | 677 | _deprecated_function( __METHOD__, '4.0' ); |
| 706 | 678 | return $help; |
| 679 | + } | |
| 680 | + | |
| 681 | + /** | |
| 682 | + * @deprecated 1.07.05 | |
| 683 | + * @codeCoverageIgnore | |
| 684 | + */ | |
| 685 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { | |
| 686 | + return FrmDeprecated::show_form( $id, $key, $title, $description ); | |
| 687 | + } | |
| 688 | + | |
| 689 | + /** | |
| 690 | + * @deprecated 1.07.05 | |
| 691 | + * @codeCoverageIgnore | |
| 692 | + */ | |
| 693 | + public static function get_form( $filename, $form, $title, $description ) { | |
| 694 | + return FrmDeprecated::get_form( $filename, $form, $title, $description ); | |
| 707 | 695 | } |
| 708 | 696 | } |