| @@ -4,24 +4,8 @@ | ||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | class FrmEntriesHelper { |
| 7 | 7 | |
| 8 | - /** | |
| 9 | - * "Submitted" entry status. | |
| 10 | - * | |
| 11 | - * @since 6.4.2 | |
| 12 | - * @var int | |
| 13 | - */ | |
| 14 | - const SUBMITTED_ENTRY_STATUS = 0; | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * "Draft" entry status. | |
| 18 | - * | |
| 19 | - * @since 6.4.2 | |
| 20 | - * @var int | |
| 21 | - */ | |
| 22 | - const DRAFT_ENTRY_STATUS = 1; | |
| 23 | - | |
| 24 | 8 | public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) { |
| 25 | 9 | remove_action( 'media_buttons', 'FrmFormsController::insert_form_button' ); |
| 26 | 10 | |
| 27 | 11 | $values = array( |
| @@ -708,18 +692,8 @@ | ||
| 708 | 692 | ), |
| 709 | 693 | 'icon' => 'frm_icon_font frm_email_icon', |
| 710 | 694 | ); |
| 711 | 695 | |
| 712 | - if ( ! function_exists( 'frm_pdfs_autoloader' ) && FrmAppHelper::show_new_feature( 'pdfs' ) ) { | |
| 713 | - $actions['frm_download_pdf'] = array( | |
| 714 | - 'url' => '#', | |
| 715 | - 'label' => __( 'Download as PDF', 'formidable' ), | |
| 716 | - 'class' => 'frm_noallow', | |
| 717 | - 'data' => self::get_pdfs_upgrade_link_data( 'download-pdf-entry' ), | |
| 718 | - 'icon' => 'frm_icon_font frm_download_icon', | |
| 719 | - ); | |
| 720 | - } | |
| 721 | - | |
| 722 | 696 | $actions['frm_edit'] = array( |
| 723 | 697 | 'url' => '#', |
| 724 | 698 | 'label' => __( 'Edit Entry', 'formidable' ), |
| 725 | 699 | 'class' => 'frm_noallow', |
| @@ -734,32 +708,8 @@ | ||
| 734 | 708 | return apply_filters( 'frm_entry_actions_dropdown', $actions, compact( 'id', 'entry' ) ); |
| 735 | 709 | } |
| 736 | 710 | |
| 737 | 711 | /** |
| 738 | - * Gets data attributes for PDFs addon upgrade link. | |
| 739 | - * | |
| 740 | - * @param string $medium The source of the upgrade link used for analytics data. | |
| 741 | - * @return array | |
| 742 | - */ | |
| 743 | - private static function get_pdfs_upgrade_link_data( $medium = 'pdfs' ) { | |
| 744 | - $data = array( | |
| 745 | - 'oneclick' => '', | |
| 746 | - 'requires' => '', | |
| 747 | - 'upgrade' => __( 'Forms to PDF', 'formidable' ), | |
| 748 | - 'medium' => $medium, | |
| 749 | - ); | |
| 750 | - | |
| 751 | - $upgrading = FrmAddonsController::install_link( 'pdfs' ); | |
| 752 | - if ( isset( $upgrading['url'] ) ) { | |
| 753 | - $data['oneclick'] = json_encode( $upgrading ); | |
| 754 | - } else { | |
| 755 | - $data['requires'] = FrmAddonsController::get_addon_required_plan( 28136428 ); | |
| 756 | - } | |
| 757 | - | |
| 758 | - return $data; | |
| 759 | - } | |
| 760 | - | |
| 761 | - /** | |
| 762 | 712 | * @since 5.0.15 |
| 763 | 713 | * |
| 764 | 714 | * @param string|int $entry_id |
| 765 | 715 | * @return void |
| @@ -780,80 +730,5 @@ | ||
| 780 | 730 | return; |
| 781 | 731 | } |
| 782 | 732 | } |
| 783 | 733 | } |
| 784 | - | |
| 785 | - /** | |
| 786 | - * Return entry status based on is_draft column value. | |
| 787 | - * | |
| 788 | - * @since 6.5 | |
| 789 | - * | |
| 790 | - * @param int $status is_draft column. | |
| 791 | - * | |
| 792 | - * @return int | |
| 793 | - */ | |
| 794 | - public static function get_entry_status( $status ) { | |
| 795 | - $statuses = self::get_entry_statuses(); | |
| 796 | - | |
| 797 | - if ( array_key_exists( $status, $statuses ) ) { | |
| 798 | - return $status; | |
| 799 | - } | |
| 800 | - | |
| 801 | - if ( empty( $status ) ) { | |
| 802 | - return self::SUBMITTED_ENTRY_STATUS; // If the status is empty, let's default to 0. | |
| 803 | - } | |
| 804 | - | |
| 805 | - return self::DRAFT_ENTRY_STATUS; // If it has a value that isn't in the array, let's default to 1. There may be old entries that don't have a value for is_draft. | |
| 806 | - } | |
| 807 | - | |
| 808 | - /** | |
| 809 | - * Return entry status label based on passed value. | |
| 810 | - * | |
| 811 | - * @since 6.5 | |
| 812 | - * | |
| 813 | - * @param int $status is_draft column. | |
| 814 | - * | |
| 815 | - * @return string | |
| 816 | - */ | |
| 817 | - public static function get_entry_status_label( $status ) { | |
| 818 | - $statuses = self::get_entry_statuses(); | |
| 819 | - | |
| 820 | - return $statuses[ self::get_entry_status( $status ) ]; | |
| 821 | - } | |
| 822 | - | |
| 823 | - /** | |
| 824 | - * Get all entry statuses. | |
| 825 | - * | |
| 826 | - * @since 6.5 | |
| 827 | - * | |
| 828 | - * @return array<string> | |
| 829 | - */ | |
| 830 | - private static function get_entry_statuses() { | |
| 831 | - | |
| 832 | - $default_entry_statuses = array( | |
| 833 | - self::SUBMITTED_ENTRY_STATUS => __( 'Submitted', 'formidable' ), | |
| 834 | - self::DRAFT_ENTRY_STATUS => __( 'Draft', 'formidable' ), | |
| 835 | - ); | |
| 836 | - | |
| 837 | - /** | |
| 838 | - * Register entry status. | |
| 839 | - * | |
| 840 | - * "2" is used in abandonment-addon and reserved for "In progress". | |
| 841 | - * "3" is used in abandonment-addon and reserved for "Abandoned". | |
| 842 | - * | |
| 843 | - * @since 6.5 | |
| 844 | - * | |
| 845 | - * @param array<string> $extended_entry_status Entry statuses. | |
| 846 | - */ | |
| 847 | - $extended_entry_status = apply_filters( 'frm_entry_statuses', array() ); | |
| 848 | - | |
| 849 | - if ( ! is_array( $extended_entry_status ) ) { | |
| 850 | - _doing_it_wrong( __METHOD__, esc_html__( 'Entry status must be return in array format.', 'formidable' ), 'x.x' ); | |
| 851 | - $extended_entry_status = array(); | |
| 852 | - } | |
| 853 | - | |
| 854 | - $existing_entry_statuses = array_replace( $default_entry_statuses, $extended_entry_status ); | |
| 855 | - | |
| 856 | - return $existing_entry_statuses; | |
| 857 | - } | |
| 858 | - | |
| 859 | 734 | } |