| @@ -222,9 +222,9 @@ | ||
| 222 | 222 | public static function prepare_display_value( $entry, $field, $atts ) { |
| 223 | 223 | $field_value = $entry->metas[ $field->id ] ?? false; |
| 224 | 224 | |
| 225 | 225 | if ( FrmAppHelper::pro_is_installed() ) { |
| 226 | - $empty = empty( $field_value ); | |
| 226 | + $empty = ! $field_value; | |
| 227 | 227 | FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
| 228 | 228 | |
| 229 | 229 | if ( $empty && $field_value ) { |
| 230 | 230 | // We've got an entry id, so switch it to a value. |
| @@ -449,8 +449,9 @@ | ||
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
| 452 | 452 | * @since 4.02.04 |
| 453 | + * @since 6.29 This is public. | |
| 453 | 454 | * |
| 454 | 455 | * @param int|string $field_id Field ID. |
| 455 | 456 | * @param array $args Additional arguments. |
| 456 | 457 | * |
| @@ -455,9 +456,9 @@ | ||
| 455 | 456 | * @param array $args Additional arguments. |
| 456 | 457 | * |
| 457 | 458 | * @return mixed |
| 458 | 459 | */ |
| 459 | - private static function get_posted_meta( $field_id, $args ) { | |
| 460 | + public static function get_posted_meta( $field_id, $args ) { | |
| 460 | 461 | if ( empty( $args['parent_field_id'] ) ) { |
| 461 | 462 | // Sanitizing is done next. |
| 462 | 463 | $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing, SlevomatCodingStandard.Files.LineLength.LineTooLong |
| 463 | 464 | } else { |
| @@ -760,8 +761,20 @@ | ||
| 760 | 761 | private static function get_action_links( $id, $entry ) { |
| 761 | 762 | $page = FrmAppHelper::get_param( 'frm_action' ); |
| 762 | 763 | $actions = array(); |
| 763 | 764 | |
| 765 | + $actions['frm_edit'] = array( | |
| 766 | + 'url' => '#', | |
| 767 | + 'label' => __( 'Edit Entry', 'formidable' ), | |
| 768 | + 'class' => 'frm_noallow', | |
| 769 | + 'data' => array( | |
| 770 | + 'upgrade' => __( 'Entry edits', 'formidable' ), | |
| 771 | + 'medium' => 'edit-entries', | |
| 772 | + 'content' => 'entry', | |
| 773 | + ), | |
| 774 | + 'icon' => 'frmfont frm_pencil_icon', | |
| 775 | + ); | |
| 776 | + | |
| 764 | 777 | if ( $page !== 'show' ) { |
| 765 | 778 | $actions['frm_view'] = array( |
| 766 | 779 | 'url' => admin_url( 'admin.php?page=formidable-entries&frm_action=show&id=' . $id . '&form=' . $entry->form_id ), |
| 767 | 780 | 'label' => __( 'View Entry', 'formidable' ), |
| @@ -768,20 +781,8 @@ | ||
| 768 | 781 | 'icon' => 'frmfont frm_save_icon', |
| 769 | 782 | ); |
| 770 | 783 | } |
| 771 | 784 | |
| 772 | - if ( current_user_can( 'frm_delete_entries' ) ) { | |
| 773 | - $actions['frm_delete'] = array( | |
| 774 | - 'url' => wp_nonce_url( admin_url( 'admin.php?page=formidable-entries&frm_action=destroy&id=' . $id . '&form=' . $entry->form_id ) ), | |
| 775 | - 'label' => __( 'Delete Entry', 'formidable' ), | |
| 776 | - 'icon' => 'frmfont frm_delete_icon', | |
| 777 | - 'data' => array( | |
| 778 | - 'frmverify' => __( 'Permanently delete this entry?', 'formidable' ), | |
| 779 | - 'frmverify-btn' => 'frm-button-red', | |
| 780 | - ), | |
| 781 | - ); | |
| 782 | - } | |
| 783 | - | |
| 784 | 785 | if ( $page === 'show' ) { |
| 785 | 786 | $actions['frm_print'] = array( |
| 786 | 787 | 'url' => '#', |
| 787 | 788 | 'label' => __( 'Print Entry', 'formidable' ), |
| @@ -791,20 +792,8 @@ | ||
| 791 | 792 | 'icon' => 'frmfont frm_printer_icon', |
| 792 | 793 | ); |
| 793 | 794 | } |
| 794 | 795 | |
| 795 | - $actions['frm_resend'] = array( | |
| 796 | - 'url' => '#', | |
| 797 | - 'label' => __( 'Resend Emails', 'formidable' ), | |
| 798 | - 'class' => 'frm_noallow', | |
| 799 | - 'data' => array( | |
| 800 | - 'upgrade' => __( 'Resend Emails', 'formidable' ), | |
| 801 | - 'medium' => 'resend-email', | |
| 802 | - 'content' => 'entry', | |
| 803 | - ), | |
| 804 | - 'icon' => 'frmfont frm_email_icon', | |
| 805 | - ); | |
| 806 | - | |
| 807 | 796 | if ( ! function_exists( 'frm_pdfs_autoloader' ) ) { |
| 808 | 797 | $actions['frm_download_pdf'] = array( |
| 809 | 798 | 'url' => '#', |
| 810 | 799 | 'label' => __( 'Download as PDF', 'formidable' ), |
| @@ -813,21 +802,45 @@ | ||
| 813 | 802 | 'icon' => 'frmfont frm_download_icon', |
| 814 | 803 | ); |
| 815 | 804 | } |
| 816 | 805 | |
| 817 | - $actions['frm_edit'] = array( | |
| 806 | + $actions['frm_resend'] = array( | |
| 818 | 807 | 'url' => '#', |
| 819 | - 'label' => __( 'Edit Entry', 'formidable' ), | |
| 808 | + 'label' => __( 'Resend Emails', 'formidable' ), | |
| 820 | 809 | 'class' => 'frm_noallow', |
| 821 | 810 | 'data' => array( |
| 822 | - 'upgrade' => __( 'Entry edits', 'formidable' ), | |
| 823 | - 'medium' => 'edit-entries', | |
| 811 | + 'upgrade' => __( 'Resend Emails', 'formidable' ), | |
| 812 | + 'medium' => 'resend-email', | |
| 824 | 813 | 'content' => 'entry', |
| 825 | 814 | ), |
| 826 | - 'icon' => 'frmfont frm_pencil_icon', | |
| 815 | + 'icon' => 'frmfont frm_email_icon', | |
| 827 | 816 | ); |
| 828 | 817 | |
| 829 | - return apply_filters( 'frm_entry_actions_dropdown', $actions, compact( 'id', 'entry' ) ); | |
| 818 | + if ( current_user_can( 'frm_delete_entries' ) ) { | |
| 819 | + $actions['frm_delete'] = array( | |
| 820 | + 'url' => wp_nonce_url( admin_url( 'admin.php?page=formidable-entries&frm_action=destroy&id=' . $id . '&form=' . $entry->form_id ) ), | |
| 821 | + 'label' => __( 'Delete Entry', 'formidable' ), | |
| 822 | + 'class' => 'frm_delete_entry', | |
| 823 | + 'icon' => 'frmfont frm_delete_icon', | |
| 824 | + 'data' => array( | |
| 825 | + 'frmverify' => __( 'Permanently delete this entry?', 'formidable' ), | |
| 826 | + 'frmverify-btn' => 'frm-button-red', | |
| 827 | + ), | |
| 828 | + ); | |
| 829 | + } | |
| 830 | + | |
| 831 | + $actions = apply_filters( 'frm_entry_actions_dropdown', $actions, compact( 'id', 'entry' ) ); | |
| 832 | + | |
| 833 | + if ( ! isset( $actions['frm_delete'] ) ) { | |
| 834 | + return $actions; | |
| 835 | + } | |
| 836 | + | |
| 837 | + // Make delete the last link. | |
| 838 | + $delete_action = $actions['frm_delete']; | |
| 839 | + unset( $actions['frm_delete'] ); | |
| 840 | + $actions['frm_delete'] = $delete_action; | |
| 841 | + | |
| 842 | + return $actions; | |
| 830 | 843 | } |
| 831 | 844 | |
| 832 | 845 | /** |
| 833 | 846 | * Gets data attributes for PDFs addon upgrade link. |
| @@ -892,11 +905,9 @@ | ||
| 892 | 905 | * |
| 893 | 906 | * @return int |
| 894 | 907 | */ |
| 895 | 908 | public static function get_entry_status( $status ) { |
| 896 | - $statuses = self::get_entry_statuses(); | |
| 897 | - | |
| 898 | - if ( array_key_exists( $status, $statuses ) ) { | |
| 909 | + if ( array_key_exists( $status, self::get_entry_statuses() ) ) { | |
| 899 | 910 | return $status; |
| 900 | 911 | } |
| 901 | 912 | |
| 902 | 913 | if ( ! $status ) { |
| @@ -917,10 +928,9 @@ | ||
| 917 | 928 | * |
| 918 | 929 | * @return string |
| 919 | 930 | */ |
| 920 | 931 | public static function get_entry_status_label( $status ) { |
| 921 | - $statuses = self::get_entry_statuses(); | |
| 922 | - return $statuses[ self::get_entry_status( $status ) ]; | |
| 932 | + return self::get_entry_statuses()[ self::get_entry_status( $status ) ]; | |
| 923 | 933 | } |
| 924 | 934 | |
| 925 | 935 | /** |
| 926 | 936 | * Get all entry statuses. |
| @@ -961,11 +971,9 @@ | ||
| 961 | 971 | * |
| 962 | 972 | * @return int |
| 963 | 973 | */ |
| 964 | 974 | public static function get_visible_unread_inbox_count() { |
| 965 | - $menu_name = FrmAppHelper::get_menu_name(); | |
| 966 | - | |
| 967 | - if ( ! in_array( $menu_name, array( 'Formidable', 'Forms' ), true ) ) { | |
| 975 | + if ( ! in_array( FrmAppHelper::get_menu_name(), array( 'Formidable', 'Forms' ), true ) ) { | |
| 968 | 976 | return 0; |
| 969 | 977 | } |
| 970 | 978 | |
| 971 | 979 | $inbox = new FrmInbox(); |