| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | * |
| 27 | 27 | * @since 1.0.0 |
| 28 | 28 | * @const string |
| 29 | 29 | */ |
| 30 | - public const version = '3.3.4'; // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase | |
| 30 | + public const version = '3.0'; // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase | |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * TablePress internal plugin version ("options scheme" version). |
| 34 | 34 | * |
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | * |
| 37 | 37 | * @since 1.0.0 |
| 38 | 38 | * @const int |
| 39 | 39 | */ |
| 40 | - public const db_version = 131; // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase | |
| 40 | + public const db_version = 96; // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase | |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * TablePress "table scheme" (data format structure) version. |
| 44 | 44 | * |
| @@ -76,9 +76,8 @@ | ||
| 76 | 76 | * |
| 77 | 77 | * Should only be modified through the filter hook 'tablepress_table_shortcode'. |
| 78 | 78 | * |
| 79 | 79 | * @since 1.0.0 |
| 80 | - * @var non-empty-string | |
| 81 | 80 | */ |
| 82 | 81 | public static string $shortcode = 'table'; |
| 83 | 82 | |
| 84 | 83 | /** |
| @@ -86,9 +85,8 @@ | ||
| 86 | 85 | * |
| 87 | 86 | * Should only be modified through the filter hook 'tablepress_table_info_shortcode'. |
| 88 | 87 | * |
| 89 | 88 | * @since 1.0.0 |
| 90 | - * @var non-empty-string | |
| 91 | 89 | */ |
| 92 | 90 | public static string $shortcode_info = 'table-info'; |
| 93 | 91 | |
| 94 | 92 | /** |
| @@ -94,9 +92,9 @@ | ||
| 94 | 92 | /** |
| 95 | 93 | * List of TablePress premium modules. |
| 96 | 94 | * |
| 97 | 95 | * @since 2.1.0 |
| 98 | - * @var array<string, array<string, mixed>> $modules Array with module slugs as keys and module data as values. | |
| 96 | + * @var array<string, array{name: string, description: string, category: string, class: string, incompatible_classes: string[], minimum_plan: string, default_active: bool}> | |
| 99 | 97 | */ |
| 100 | 98 | public static array $modules = array(); |
| 101 | 99 | |
| 102 | 100 | /** |
| @@ -118,9 +116,9 @@ | ||
| 118 | 116 | * Filters the string that is used as the [table] Shortcode. |
| 119 | 117 | * |
| 120 | 118 | * @since 1.0.0 |
| 121 | 119 | * |
| 122 | - * @param non-empty-string $shortcode The [table] Shortcode string. | |
| 120 | + * @param string $shortcode The [table] Shortcode string. | |
| 123 | 121 | */ |
| 124 | 122 | self::$shortcode = apply_filters( 'tablepress_table_shortcode', self::$shortcode ); |
| 125 | 123 | /** |
| 126 | 124 | * Filters the string that is used as the [table-info] Shortcode. |
| @@ -126,9 +124,9 @@ | ||
| 126 | 124 | * Filters the string that is used as the [table-info] Shortcode. |
| 127 | 125 | * |
| 128 | 126 | * @since 1.0.0 |
| 129 | 127 | * |
| 130 | - * @param non-empty-string $shortcode_info The [table-info] Shortcode string. | |
| 128 | + * @param string $shortcode_info The [table-info] Shortcode string. | |
| 131 | 129 | */ |
| 132 | 130 | self::$shortcode_info = apply_filters( 'tablepress_table_info_shortcode', self::$shortcode_info ); |
| 133 | 131 | |
| 134 | 132 | // Load modals for table and options, to be accessible from everywhere via `TablePress::$model_options` and `TablePress::$model_table`. |
| @@ -403,9 +401,8 @@ | ||
| 403 | 401 | * @return string Nickname of the WP user with the $user_id. |
| 404 | 402 | */ |
| 405 | 403 | public static function get_user_display_name( int $user_id ): string { |
| 406 | 404 | $user = get_userdata( $user_id ); |
| 407 | - /* translators: %s: Label for unknown user */ | |
| 408 | 405 | return $user->display_name ?? sprintf( '<em>%s</em>', __( 'unknown', 'tablepress' ) ); |
| 409 | 406 | } |
| 410 | 407 | |
| 411 | 408 | /** |
| @@ -751,12 +748,8 @@ | ||
| 751 | 748 | 'item' => false, |
| 752 | 749 | ); |
| 753 | 750 | $params = array_merge( $default_params, $params ); |
| 754 | 751 | |
| 755 | - if ( isset( $params['error_details'] ) ) { | |
| 756 | - $params['error_details'] = rawurlencode( $params['error_details'] ); | |
| 757 | - } | |
| 758 | - | |
| 759 | 752 | $url = add_query_arg( $params, admin_url( $target ) ); |
| 760 | 753 | if ( $add_nonce ) { |
| 761 | 754 | $url = wp_nonce_url( $url, self::nonce( $nonce_action, $params['item'] ) ); // wp_nonce_url() does esc_html(). |
| 762 | 755 | } |
| @@ -784,25 +777,22 @@ | ||
| 784 | 777 | exit; |
| 785 | 778 | } |
| 786 | 779 | |
| 787 | 780 | /** |
| 788 | - * Determines the editor that the site uses, so that certain text and input fields referring to Shortcodes can be displayed or not. | |
| 781 | + * Determines whether the site uses the block editor, so that certain text and input fields referring to Shortcodes can be displayed or not. | |
| 789 | 782 | * |
| 790 | - * @since 3.1.0 | |
| 783 | + * @since 2.0.1 | |
| 791 | 784 | * |
| 792 | - * @return string The editor that the site uses, either "block", "elementor", or "other". | |
| 785 | + * @return bool True if the site uses the block editor, false otherwise. | |
| 793 | 786 | */ |
| 794 | - public static function site_used_editor(): string { | |
| 795 | - if ( is_plugin_active( 'elementor/elementor.php' ) ) { | |
| 796 | - return 'elementor'; | |
| 797 | - } | |
| 798 | - | |
| 799 | - // Checking for Elementor is not needed anymore in this condition. | |
| 787 | + public static function site_uses_block_editor(): bool { | |
| 800 | 788 | $site_uses_block_editor = use_block_editor_for_post_type( 'post' ) |
| 789 | + && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) | |
| 801 | 790 | && ! is_plugin_active( 'classic-editor/classic-editor.php' ) |
| 802 | 791 | && ! is_plugin_active( 'classic-editor-addon/classic-editor-addon.php' ) |
| 803 | - && ! is_plugin_active( 'siteorigin-panels/siteorigin-panels.php' ) | |
| 804 | - && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ); | |
| 792 | + && ! is_plugin_active( 'elementor/elementor.php' ) | |
| 793 | + && ! is_plugin_active( 'siteorigin-panels/siteorigin-panels.php' ); | |
| 794 | + | |
| 805 | 795 | /** |
| 806 | 796 | * Filters the outcome of the check whether the site uses the block editor. |
| 807 | 797 | * |
| 808 | 798 | * This can be used when certain conditions (e.g. new site builders) are not (yet) accounted for. |
| @@ -811,218 +801,274 @@ | ||
| 811 | 801 | * |
| 812 | 802 | * @param bool $site_uses_block_editor True if the site uses the block editor, false otherwise. |
| 813 | 803 | */ |
| 814 | 804 | $site_uses_block_editor = (bool) apply_filters( 'tablepress_site_uses_block_editor', $site_uses_block_editor ); |
| 815 | - if ( $site_uses_block_editor ) { | |
| 816 | - return 'block'; | |
| 817 | - } | |
| 818 | 805 | |
| 819 | - return 'other'; | |
| 806 | + return $site_uses_block_editor; | |
| 820 | 807 | } |
| 821 | 808 | |
| 822 | 809 | /** |
| 823 | - * Adds the (translated) names and descriptions to the list of feature modules. | |
| 810 | + * Initializes the list of TablePress premium modules. | |
| 824 | 811 | * |
| 825 | - * @since 3.3.0 | |
| 812 | + * @since 2.1.0 | |
| 826 | 813 | */ |
| 827 | - public static function load_modules_data(): void { | |
| 828 | - // Prevent repeated execution of expensive translation functions via a static variable. | |
| 829 | - static $modules_initialized = false; | |
| 830 | - if ( $modules_initialized ) { | |
| 831 | - return; | |
| 832 | - } | |
| 833 | - $modules_initialized = true; | |
| 834 | - | |
| 835 | - $modules = array( | |
| 814 | + public static function init_modules(): void { | |
| 815 | + self::$modules = array( | |
| 836 | 816 | 'advanced-access-rights' => array( |
| 837 | - 'name' => __( 'Advanced Access Rights', 'tablepress' ), | |
| 838 | - 'description' => __( 'Restrict access to individual tables for individual users.', 'tablepress' ), | |
| 817 | + 'name' => __( 'Advanced Access Rights', 'tablepress' ), | |
| 818 | + 'description' => __( 'Restrict access to individual tables for individual users.', 'tablepress' ), | |
| 819 | + 'category' => 'backend', | |
| 820 | + 'class' => 'TablePress_Module_Advanced_Access_Rights', | |
| 821 | + 'incompatible_classes' => array( 'TablePress_Advanced_Access_Rights_Controller' ), | |
| 822 | + 'minimum_plan' => 'max', | |
| 823 | + 'default_active' => false, | |
| 839 | 824 | ), |
| 840 | 825 | 'automatic-periodic-table-import' => array( |
| 841 | - 'name' => __( 'Automatic Periodic Table Import', 'tablepress' ), | |
| 842 | - 'description' => __( 'Periodically update tables from a configured import source.', 'tablepress' ), | |
| 826 | + 'name' => __( 'Automatic Periodic Table Import', 'tablepress' ), | |
| 827 | + 'description' => __( 'Periodically update tables from a configured import source.', 'tablepress' ), | |
| 828 | + 'category' => 'backend', | |
| 829 | + 'class' => 'TablePress_Module_Automatic_Periodic_Table_Import', | |
| 830 | + 'incompatible_classes' => array( 'TablePress_Table_Auto_Update' ), | |
| 831 | + 'minimum_plan' => 'max', | |
| 832 | + 'default_active' => true, | |
| 843 | 833 | ), |
| 844 | 834 | 'automatic-table-export' => array( |
| 845 | - 'name' => __( 'Automatic Table Export', 'tablepress' ), | |
| 846 | - 'description' => __( 'Export and save tables to files on the server after they were modified.', 'tablepress' ), | |
| 835 | + 'name' => __( 'Automatic Table Export', 'tablepress' ), | |
| 836 | + 'description' => __( 'Export and save tables to files on the server after they were modified.', 'tablepress' ), | |
| 837 | + 'category' => 'backend', | |
| 838 | + 'class' => 'TablePress_Module_Automatic_Table_Export', | |
| 839 | + 'incompatible_classes' => array(), | |
| 840 | + 'minimum_plan' => 'pro', | |
| 841 | + 'default_active' => false, | |
| 847 | 842 | ), |
| 848 | 843 | 'cell-highlighting' => array( |
| 849 | - 'name' => __( 'Cell Highlighting', 'tablepress' ), | |
| 850 | - 'description' => __( 'Add CSS classes to cells for highlighting based on their content.', 'tablepress' ), | |
| 844 | + 'name' => __( 'Cell Highlighting', 'tablepress' ), | |
| 845 | + 'description' => __( 'Add CSS classes to cells for highlighting based on their content.', 'tablepress' ), | |
| 846 | + 'category' => 'frontend', | |
| 847 | + 'class' => 'TablePress_Module_Cell_Highlighting', | |
| 848 | + 'incompatible_classes' => array( 'TablePress_Cell_Highlighting' ), | |
| 849 | + 'minimum_plan' => 'pro', | |
| 850 | + 'default_active' => false, | |
| 851 | 851 | ), |
| 852 | 852 | 'column-order' => array( |
| 853 | - 'name' => __( 'Column Order', 'tablepress' ), | |
| 854 | - 'description' => __( 'Order the columns in different ways when a table is shown.', 'tablepress' ), | |
| 853 | + 'name' => __( 'Column Order', 'tablepress' ), | |
| 854 | + 'description' => __( 'Order the columns in different ways when a table is shown.', 'tablepress' ), | |
| 855 | + 'category' => 'data-management', | |
| 856 | + 'class' => 'TablePress_Module_Column_Order', | |
| 857 | + 'incompatible_classes' => array( 'TablePress_Column_Order' ), | |
| 858 | + 'minimum_plan' => 'pro', | |
| 859 | + 'default_active' => false, | |
| 855 | 860 | ), |
| 856 | 861 | 'datatables-advanced-loading' => array( |
| 857 | - 'name' => __( 'Advanced Loading', 'tablepress' ), | |
| 858 | - 'description' => __( 'Load the table data from a JSON array for faster loading.', 'tablepress' ), | |
| 862 | + 'name' => __( 'Advanced Loading', 'tablepress' ), | |
| 863 | + 'description' => __( 'Load the table data from a JSON array for faster loading.', 'tablepress' ), | |
| 864 | + 'category' => 'backend', | |
| 865 | + 'class' => 'TablePress_Module_DataTables_Advanced_Loading', | |
| 866 | + 'incompatible_classes' => array( 'TablePress_DataTables_Advanced_Loading' ), | |
| 867 | + 'minimum_plan' => 'max', | |
| 868 | + 'default_active' => false, | |
| 859 | 869 | ), |
| 860 | 870 | 'datatables-alphabetsearch' => array( |
| 861 | - 'name' => __( 'Alphabet Search', 'tablepress' ), | |
| 862 | - 'description' => __( 'Show Alphabet buttons above the table to filter rows by their first letter.', 'tablepress' ), | |
| 871 | + 'name' => __( 'Alphabet Search', 'tablepress' ), | |
| 872 | + 'description' => __( 'Show Alphabet buttons above the table to filter rows by their first letter.', 'tablepress' ), | |
| 873 | + 'category' => 'search-filter', | |
| 874 | + 'class' => 'TablePress_Module_DataTables_Alphabetsearch', | |
| 875 | + 'incompatible_classes' => array(), | |
| 876 | + 'minimum_plan' => 'pro', | |
| 877 | + 'default_active' => false, | |
| 863 | 878 | ), |
| 864 | 879 | 'datatables-auto-filter' => array( |
| 865 | - 'name' => __( 'Automatic Filter', 'tablepress' ), | |
| 866 | - 'description' => __( 'Pre-filter a table when it is shown.', 'tablepress' ), | |
| 880 | + 'name' => __( 'Automatic Filter', 'tablepress' ), | |
| 881 | + 'description' => __( 'Pre-filter a table when it is shown.', 'tablepress' ), | |
| 882 | + 'category' => 'search-filter', | |
| 883 | + 'class' => 'TablePress_Module_DataTables_Auto_Filter', | |
| 884 | + 'incompatible_classes' => array( 'TablePress_DataTables_Auto_Filter' ), | |
| 885 | + 'minimum_plan' => 'pro', | |
| 886 | + 'default_active' => false, | |
| 867 | 887 | ), |
| 868 | 888 | 'datatables-buttons' => array( |
| 869 | - 'name' => __( 'User Action Buttons', 'tablepress' ), | |
| 870 | - 'description' => __( 'Add buttons for downloading, copying, printing, and changing column visibility of tables.', 'tablepress' ), | |
| 889 | + 'name' => __( 'User Action Buttons', 'tablepress' ), | |
| 890 | + 'description' => __( 'Add buttons for downloading, copying, printing, and changing column visibility of tables.', 'tablepress' ), | |
| 891 | + 'category' => 'frontend', | |
| 892 | + 'class' => 'TablePress_Module_DataTables_Buttons', | |
| 893 | + 'incompatible_classes' => array( 'TablePress_DataTables_Buttons' ), | |
| 894 | + 'minimum_plan' => 'pro', | |
| 895 | + 'default_active' => true, | |
| 871 | 896 | ), |
| 872 | 897 | 'datatables-columnfilterwidgets' => array( |
| 873 | - 'name' => __( 'Column Filter Dropdowns', 'tablepress' ), | |
| 874 | - 'description' => __( 'Add a search dropdown for each column above the table.', 'tablepress' ), | |
| 898 | + 'name' => __( 'Column Filter Dropdowns', 'tablepress' ), | |
| 899 | + 'description' => __( 'Add a search dropdown for each column above the table.', 'tablepress' ), | |
| 900 | + 'category' => 'search-filter', | |
| 901 | + 'class' => 'TablePress_Module_DataTables_ColumnFilterWidgets', | |
| 902 | + 'incompatible_classes' => array(), | |
| 903 | + 'minimum_plan' => 'pro', | |
| 904 | + 'default_active' => true, | |
| 875 | 905 | ), |
| 876 | 906 | 'datatables-column-filter' => array( |
| 877 | - 'name' => __( 'Individual Column Filtering', 'tablepress' ), | |
| 878 | - 'description' => __( 'Add a search field or filter dropdown for each column to a table head or foot row.', 'tablepress' ), | |
| 907 | + 'name' => __( 'Individual Column Filtering', 'tablepress' ), | |
| 908 | + 'description' => __( 'Add a search field for each column to the table head or foot row.', 'tablepress' ), | |
| 909 | + 'category' => 'search-filter', | |
| 910 | + 'class' => 'TablePress_Module_DataTables_Column_Filter', | |
| 911 | + 'incompatible_classes' => array(), | |
| 912 | + 'minimum_plan' => 'pro', | |
| 913 | + 'default_active' => false, | |
| 879 | 914 | ), |
| 880 | 915 | 'datatables-counter-column' => array( |
| 881 | - 'name' => __( 'Index Column', 'tablepress' ), | |
| 882 | - 'description' => __( 'Make the first column an index or counter column with the row position.', 'tablepress' ), | |
| 916 | + 'name' => __( 'Index Column', 'tablepress' ), | |
| 917 | + 'description' => __( 'Make the first column an index or counter column with the row position.', 'tablepress' ), | |
| 918 | + 'category' => 'frontend', | |
| 919 | + 'class' => 'TablePress_Module_DataTables_Counter_Column', | |
| 920 | + 'incompatible_classes' => array(), | |
| 921 | + 'minimum_plan' => 'pro', | |
| 922 | + 'default_active' => false, | |
| 883 | 923 | ), |
| 884 | 924 | 'datatables-fixedheader-fixedcolumns' => array( |
| 885 | - 'name' => __( 'Fixed Rows and Columns', 'tablepress' ), | |
| 886 | - 'description' => __( 'Fix the header and footer row and the first and last column when scrolling the table.', 'tablepress' ), | |
| 925 | + 'name' => __( 'Fixed Rows and Columns', 'tablepress' ), | |
| 926 | + 'description' => __( 'Fix the header and footer row and the first and last column when scrolling the table.', 'tablepress' ), | |
| 927 | + 'category' => 'frontend', | |
| 928 | + 'class' => 'TablePress_Module_DataTables_FixedHeader_FixedColumns', | |
| 929 | + 'incompatible_classes' => array( | |
| 930 | + 'TablePress_DataTables_FixedHeader', | |
| 931 | + 'TablePress_DataTables_FixedColumns', | |
| 932 | + ), | |
| 933 | + 'minimum_plan' => 'pro', | |
| 934 | + 'default_active' => true, | |
| 887 | 935 | ), |
| 888 | 936 | 'datatables-layout' => array( |
| 889 | - 'name' => __( 'Table Layout', 'tablepress' ), | |
| 890 | - 'description' => __( 'Customize the layout and position of features around a table.', 'tablepress' ), | |
| 937 | + 'name' => __( 'Table Layout', 'tablepress' ), | |
| 938 | + 'description' => __( 'Customize the layout and position of features around a table.', 'tablepress' ), | |
| 939 | + 'category' => 'frontend', | |
| 940 | + 'class' => 'TablePress_Module_DataTables_Layout', | |
| 941 | + 'incompatible_classes' => array(), | |
| 942 | + 'minimum_plan' => 'pro', | |
| 943 | + 'default_active' => true, | |
| 891 | 944 | ), |
| 892 | 945 | 'datatables-fuzzysearch' => array( |
| 893 | - 'name' => __( 'Fuzzy Search', 'tablepress' ), | |
| 894 | - 'description' => __( 'Let the search account for spelling mistakes and typos and find similar matches.', 'tablepress' ), | |
| 946 | + 'name' => __( 'Fuzzy Search', 'tablepress' ), | |
| 947 | + 'description' => __( 'Let the search account for spelling mistakes and typos and find similar matches.', 'tablepress' ), | |
| 948 | + 'category' => 'search-filter', | |
| 949 | + 'class' => 'TablePress_Module_DataTables_FuzzySearch', | |
| 950 | + 'incompatible_classes' => array(), | |
| 951 | + 'minimum_plan' => 'max', | |
| 952 | + 'default_active' => false, | |
| 895 | 953 | ), |
| 896 | 954 | 'datatables-inverted-filter' => array( |
| 897 | - 'name' => __( 'Inverted Filtering', 'tablepress' ), | |
| 898 | - 'description' => __( 'Turn the filtering into a search and hide the table if no search term is entered.', 'tablepress' ), | |
| 955 | + 'name' => __( 'Inverted Filtering', 'tablepress' ), | |
| 956 | + 'description' => __( 'Turn the filtering into a search and hide the table if no search term is entered.', 'tablepress' ), | |
| 957 | + 'category' => 'search-filter', | |
| 958 | + 'class' => 'TablePress_Module_DataTables_Inverted_Filter', | |
| 959 | + 'incompatible_classes' => array(), | |
| 960 | + 'minimum_plan' => 'max', | |
| 961 | + 'default_active' => false, | |
| 899 | 962 | ), |
| 900 | 963 | 'datatables-pagination' => array( |
| 901 | - 'name' => __( 'Advanced Pagination Settings', 'tablepress' ), | |
| 902 | - 'description' => __( 'Customize the pagination settings of the table.', 'tablepress' ), | |
| 964 | + 'name' => __( 'Advanced Pagination Settings', 'tablepress' ), | |
| 965 | + 'description' => __( 'Customize the pagination settings of the table.', 'tablepress' ), | |
| 966 | + 'category' => 'frontend', | |
| 967 | + 'class' => 'TablePress_Module_DataTables_Pagination', | |
| 968 | + 'incompatible_classes' => array(), | |
| 969 | + 'minimum_plan' => 'pro', | |
| 970 | + 'default_active' => false, | |
| 903 | 971 | ), |
| 904 | 972 | 'datatables-rowgroup' => array( |
| 905 | - 'name' => __( 'Row Grouping', 'tablepress' ), | |
| 906 | - 'description' => __( 'Group table rows by a common keyword, category, or title.', 'tablepress' ), | |
| 973 | + 'name' => __( 'Row Grouping', 'tablepress' ), | |
| 974 | + 'description' => __( 'Group table rows by a common keyword, category, or title.', 'tablepress' ), | |
| 975 | + 'category' => 'frontend', | |
| 976 | + 'class' => 'TablePress_Module_DataTables_RowGroup', | |
| 977 | + 'incompatible_classes' => array( 'TablePress_DataTables_RowGroup' ), | |
| 978 | + 'minimum_plan' => 'pro', | |
| 979 | + 'default_active' => false, | |
| 907 | 980 | ), |
| 908 | 981 | 'datatables-searchbuilder' => array( |
| 909 | - 'name' => __( 'Custom Search Builder', 'tablepress' ), | |
| 910 | - 'description' => __( 'Show a search builder interface for filtering from groups and using conditions.', 'tablepress' ), | |
| 982 | + 'name' => __( 'Custom Search Builder', 'tablepress' ), | |
| 983 | + 'description' => __( 'Show a search builder interface for filtering from groups and using conditions.', 'tablepress' ), | |
| 984 | + 'category' => 'search-filter', | |
| 985 | + 'class' => 'TablePress_Module_DataTables_SearchBuilder', | |
| 986 | + 'incompatible_classes' => array(), | |
| 987 | + 'minimum_plan' => 'max', | |
| 988 | + 'default_active' => false, | |
| 911 | 989 | ), |
| 912 | 990 | 'datatables-searchhighlight' => array( |
| 913 | - 'name' => __( 'Search Highlighting', 'tablepress' ), | |
| 914 | - 'description' => __( 'Highlight found search terms in the table.', 'tablepress' ), | |
| 991 | + 'name' => __( 'Search Highlighting', 'tablepress' ), | |
| 992 | + 'description' => __( 'Highlight found search terms in the table.', 'tablepress' ), | |
| 993 | + 'category' => 'search-filter', | |
| 994 | + 'class' => 'TablePress_Module_DataTables_SearchHighlight', | |
| 995 | + 'incompatible_classes' => array(), | |
| 996 | + 'minimum_plan' => 'pro', | |
| 997 | + 'default_active' => false, | |
| 915 | 998 | ), |
| 916 | 999 | 'datatables-searchpanes' => array( |
| 917 | - 'name' => __( 'Search Panes', 'tablepress' ), | |
| 918 | - 'description' => __( 'Show panes for filtering the columns.', 'tablepress' ), | |
| 1000 | + 'name' => __( 'Search Panes', 'tablepress' ), | |
| 1001 | + 'description' => __( 'Show panes for filtering the columns.', 'tablepress' ), | |
| 1002 | + 'category' => 'search-filter', | |
| 1003 | + 'class' => 'TablePress_Module_DataTables_SearchPanes', | |
| 1004 | + 'incompatible_classes' => array(), | |
| 1005 | + 'minimum_plan' => 'pro', | |
| 1006 | + 'default_active' => false, | |
| 919 | 1007 | ), |
| 920 | 1008 | 'datatables-serverside-processing' => array( |
| 921 | - 'name' => __( 'Server-side Processing', 'tablepress' ), | |
| 922 | - 'description' => __( 'Process sorting, filtering, and pagination on the server for faster loading of large tables.', 'tablepress' ), | |
| 1009 | + 'name' => __( 'Server-side Processing', 'tablepress' ), | |
| 1010 | + 'description' => __( 'Process sorting, filtering, and pagination on the server for faster loading of large tables.', 'tablepress' ), | |
| 1011 | + 'category' => 'backend', | |
| 1012 | + 'class' => 'TablePress_Module_DataTables_ServerSide_Processing', | |
| 1013 | + 'incompatible_classes' => array(), | |
| 1014 | + 'minimum_plan' => 'max', | |
| 1015 | + 'default_active' => true, | |
| 923 | 1016 | ), |
| 924 | 1017 | 'default-style-customizer' => array( |
| 925 | - 'name' => __( 'Default Style Customizer', 'tablepress' ), | |
| 926 | - 'description' => __( 'Change the default styling of your tables in the visual style customizer.', 'tablepress' ), | |
| 1018 | + 'name' => __( 'Default Style Customizer', 'tablepress' ), | |
| 1019 | + 'description' => __( 'Change the default styling of your tables in the visual style customizer.', 'tablepress' ), | |
| 1020 | + 'category' => 'frontend', | |
| 1021 | + 'class' => 'TablePress_Module_Default_Style_Customizer', | |
| 1022 | + 'incompatible_classes' => array(), | |
| 1023 | + 'minimum_plan' => 'pro', | |
| 1024 | + 'default_active' => true, | |
| 927 | 1025 | ), |
| 928 | - 'email-notifications' => array( | |
| 929 | - 'name' => __( 'Email Notifications', 'tablepress' ), | |
| 930 | - 'description' => __( 'Get email notifications when certain actions are performed on tables.', 'tablepress' ), | |
| 931 | - ), | |
| 932 | 1026 | 'responsive-tables' => array( |
| 933 | - 'name' => __( 'Responsive Tables', 'tablepress' ), | |
| 934 | - 'description' => __( 'Make your tables look good on different screen sizes.', 'tablepress' ), | |
| 1027 | + 'name' => __( 'Responsive Tables', 'tablepress' ), | |
| 1028 | + 'description' => __( 'Make your tables look good on different screen sizes.', 'tablepress' ), | |
| 1029 | + 'category' => 'frontend', | |
| 1030 | + 'class' => 'TablePress_Module_Responsive_Tables', | |
| 1031 | + 'incompatible_classes' => array( 'TablePress_Responsive_Tables' ), | |
| 1032 | + 'minimum_plan' => 'pro', | |
| 1033 | + 'default_active' => true, | |
| 935 | 1034 | ), |
| 936 | 1035 | 'rest-api' => array( |
| 937 | - 'name' => __( 'REST API', 'tablepress' ), | |
| 938 | - 'description' => __( 'Read table data via the WordPress REST API, e.g. in external apps.', 'tablepress' ), | |
| 1036 | + 'name' => __( 'REST API', 'tablepress' ), | |
| 1037 | + 'description' => __( 'Read table data via the WordPress REST API, e.g. in external apps.', 'tablepress' ), | |
| 1038 | + 'category' => 'backend', | |
| 1039 | + 'class' => 'TablePress_Module_REST_API', | |
| 1040 | + 'incompatible_classes' => array( 'TablePress_REST_API_Controller' ), | |
| 1041 | + 'minimum_plan' => 'max', | |
| 1042 | + 'default_active' => false, | |
| 939 | 1043 | ), |
| 940 | 1044 | 'row-filtering' => array( |
| 941 | - 'name' => __( 'Row Filtering', 'tablepress' ), | |
| 942 | - 'description' => __( 'Show only table rows that contain defined keywords.', 'tablepress' ), | |
| 1045 | + 'name' => __( 'Row Filtering', 'tablepress' ), | |
| 1046 | + 'description' => __( 'Show only table rows that contain defined keywords.', 'tablepress' ), | |
| 1047 | + 'category' => 'data-management', | |
| 1048 | + 'class' => 'TablePress_Module_Row_Filtering', | |
| 1049 | + 'incompatible_classes' => array( 'TablePress_Row_Filter' ), | |
| 1050 | + 'minimum_plan' => 'pro', | |
| 1051 | + 'default_active' => true, | |
| 943 | 1052 | ), |
| 944 | 1053 | 'row-highlighting' => array( |
| 945 | - 'name' => __( 'Row Highlighting', 'tablepress' ), | |
| 946 | - 'description' => __( 'Add CSS classes to rows for highlighting based on their content.', 'tablepress' ), | |
| 1054 | + 'name' => __( 'Row Highlighting', 'tablepress' ), | |
| 1055 | + 'description' => __( 'Add CSS classes to rows for highlighting based on their content.', 'tablepress' ), | |
| 1056 | + 'category' => 'frontend', | |
| 1057 | + 'class' => 'TablePress_Module_Row_Highlighting', | |
| 1058 | + 'incompatible_classes' => array( 'TablePress_Row_Highlighting' ), | |
| 1059 | + 'minimum_plan' => 'pro', | |
| 1060 | + 'default_active' => false, | |
| 947 | 1061 | ), |
| 948 | 1062 | 'row-order' => array( |
| 949 | - 'name' => __( 'Row Order', 'tablepress' ), | |
| 950 | - 'description' => __( 'Order the rows in different ways when a table is shown.', 'tablepress' ), | |
| 1063 | + 'name' => __( 'Row Order', 'tablepress' ), | |
| 1064 | + 'description' => __( 'Order the rows in different ways when a table is shown.', 'tablepress' ), | |
| 1065 | + 'category' => 'data-management', | |
| 1066 | + 'class' => 'TablePress_Module_Row_Order', | |
| 1067 | + 'incompatible_classes' => array( 'TablePress_Row_Order' ), | |
| 1068 | + 'minimum_plan' => 'pro', | |
| 1069 | + 'default_active' => false, | |
| 951 | 1070 | ), |
| 952 | 1071 | ); |
| 953 | - | |
| 954 | - // Append translated module names and descriptions to potentially existing module meta data. | |
| 955 | - self::$modules = array_merge_recursive( self::$modules, $modules ); | |
| 956 | - } | |
| 957 | - | |
| 958 | - /** | |
| 959 | - * Enqueues a CSS file, possibly with dependencies. | |
| 960 | - * | |
| 961 | - * @since 3.3.0 | |
| 962 | - * | |
| 963 | - * @param string $name Name of the CSS file, without extension. | |
| 964 | - * @param string[] $dependencies Optional. List of names of CSS stylesheets that this stylesheet depends on, and which need to be included before this one. | |
| 965 | - * @param string $path Optional. Path to the CSS file. | |
| 966 | - */ | |
| 967 | - public static function enqueue_style( string $name, array $dependencies = array(), string $path = 'admin/css/build/' ): void { | |
| 968 | - $css_file = "{$path}{$name}.css"; | |
| 969 | - $css_url = plugins_url( $css_file, TABLEPRESS__FILE__ ); | |
| 970 | - wp_enqueue_style( "tablepress-{$name}", $css_url, $dependencies, self::version ); | |
| 971 | - } | |
| 972 | - | |
| 973 | - /** | |
| 974 | - * Enqueues a JavaScript file, possibly with dependencies and extra information. | |
| 975 | - * | |
| 976 | - * @since 3.3.0 | |
| 977 | - * | |
| 978 | - * @param string $name Name of the JS file, without extension. | |
| 979 | - * @param string[] $dependencies Optional. List of names of JS scripts that this script depends on, and which need to be included before this one. | |
| 980 | - * @param array<string, mixed> $script_data Optional. JS data that is printed to the page before the script is included. The array key will be used as the name, the value will be JSON encoded. | |
| 981 | - * @param string $path Optional. Path to the JS file. | |
| 982 | - */ | |
| 983 | - public static function enqueue_script( string $name, array $dependencies = array(), array $script_data = array(), string $path = 'admin/js/build/' ): void { | |
| 984 | - $js_file = "{$path}{$name}.js"; | |
| 985 | - $js_url = plugins_url( $js_file, TABLEPRESS__FILE__ ); | |
| 986 | - | |
| 987 | - $version = self::version; | |
| 988 | - | |
| 989 | - // Load dependencies and version from the auto-generated asset PHP file. | |
| 990 | - $script_asset_path = TABLEPRESS_ABSPATH . "{$path}{$name}.asset.php"; | |
| 991 | - if ( file_exists( $script_asset_path ) ) { | |
| 992 | - $script_asset = require $script_asset_path; | |
| 993 | - if ( isset( $script_asset['dependencies'] ) ) { | |
| 994 | - $dependencies = array_merge( $dependencies, $script_asset['dependencies'] ); | |
| 995 | - } | |
| 996 | - if ( isset( $script_asset['version'] ) ) { | |
| 997 | - $version = $script_asset['version']; | |
| 998 | - } | |
| 999 | - } | |
| 1000 | - | |
| 1001 | - /** | |
| 1002 | - * Filters the dependencies of a TablePress script file. | |
| 1003 | - * | |
| 1004 | - * @since 2.0.0 | |
| 1005 | - * | |
| 1006 | - * @param string[] $dependencies List of the dependencies that the $name script relies on. | |
| 1007 | - * @param string $name Name of the JS script, without extension. | |
| 1008 | - */ | |
| 1009 | - $dependencies = apply_filters( 'tablepress_admin_page_script_dependencies', $dependencies, $name ); | |
| 1010 | - | |
| 1011 | - $script_name = "tablepress-{$name}"; | |
| 1012 | - | |
| 1013 | - wp_enqueue_script( $script_name, $js_url, $dependencies, $version, array( 'in_footer' => true ) ); | |
| 1014 | - | |
| 1015 | - // Load JavaScript translation files, for all scripts that rely on `wp-i18n`. | |
| 1016 | - if ( in_array( 'wp-i18n', $dependencies, true ) ) { | |
| 1017 | - wp_set_script_translations( $script_name, 'tablepress' ); | |
| 1018 | - } | |
| 1019 | - | |
| 1020 | - if ( ! empty( $script_data ) ) { | |
| 1021 | - foreach ( $script_data as $var_name => $var_data ) { | |
| 1022 | - $var_data = wp_json_encode( $var_data, JSON_FORCE_OBJECT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); | |
| 1023 | - wp_add_inline_script( $script_name, "const tablepress_{$var_name} = {$var_data};", 'before' ); | |
| 1024 | - } | |
| 1025 | - } | |
| 1026 | 1072 | } |
| 1027 | 1073 | |
| 1028 | 1074 | } // class TablePress |