| @@ -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.2'; // 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 = 113; // 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`. |
| @@ -751,12 +749,8 @@ | ||
| 751 | 749 | 'item' => false, |
| 752 | 750 | ); |
| 753 | 751 | $params = array_merge( $default_params, $params ); |
| 754 | 752 | |
| 755 | - if ( isset( $params['error_details'] ) ) { | |
| 756 | - $params['error_details'] = rawurlencode( $params['error_details'] ); | |
| 757 | - } | |
| 758 | - | |
| 759 | 753 | $url = add_query_arg( $params, admin_url( $target ) ); |
| 760 | 754 | if ( $add_nonce ) { |
| 761 | 755 | $url = wp_nonce_url( $url, self::nonce( $nonce_action, $params['item'] ) ); // wp_nonce_url() does esc_html(). |
| 762 | 756 | } |
| @@ -819,210 +813,282 @@ | ||
| 819 | 813 | return 'other'; |
| 820 | 814 | } |
| 821 | 815 | |
| 822 | 816 | /** |
| 823 | - * Adds the (translated) names and descriptions to the list of feature modules. | |
| 817 | + * Initializes the list of TablePress premium modules. | |
| 824 | 818 | * |
| 825 | - * @since 3.3.0 | |
| 819 | + * @since 2.1.0 | |
| 826 | 820 | */ |
| 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 ) { | |
| 821 | + public static function init_modules(): void { | |
| 822 | + if ( ! empty( self::$modules ) ) { | |
| 831 | 823 | return; |
| 832 | 824 | } |
| 833 | - $modules_initialized = true; | |
| 834 | 825 | |
| 835 | - $modules = array( | |
| 826 | + self::$modules = array( | |
| 836 | 827 | 'advanced-access-rights' => array( |
| 837 | - 'name' => __( 'Advanced Access Rights', 'tablepress' ), | |
| 838 | - 'description' => __( 'Restrict access to individual tables for individual users.', 'tablepress' ), | |
| 828 | + 'name' => __( 'Advanced Access Rights', 'tablepress' ), | |
| 829 | + 'description' => __( 'Restrict access to individual tables for individual users.', 'tablepress' ), | |
| 830 | + 'category' => 'backend', | |
| 831 | + 'class' => 'TablePress_Module_Advanced_Access_Rights', | |
| 832 | + 'incompatible_classes' => array( 'TablePress_Advanced_Access_Rights_Controller' ), | |
| 833 | + 'minimum_plan' => 'max', | |
| 834 | + 'default_active' => false, | |
| 839 | 835 | ), |
| 840 | 836 | 'automatic-periodic-table-import' => array( |
| 841 | - 'name' => __( 'Automatic Periodic Table Import', 'tablepress' ), | |
| 842 | - 'description' => __( 'Periodically update tables from a configured import source.', 'tablepress' ), | |
| 837 | + 'name' => __( 'Automatic Periodic Table Import', 'tablepress' ), | |
| 838 | + 'description' => __( 'Periodically update tables from a configured import source.', 'tablepress' ), | |
| 839 | + 'category' => 'backend', | |
| 840 | + 'class' => 'TablePress_Module_Automatic_Periodic_Table_Import', | |
| 841 | + 'incompatible_classes' => array( 'TablePress_Table_Auto_Update' ), | |
| 842 | + 'minimum_plan' => 'max', | |
| 843 | + 'default_active' => true, | |
| 843 | 844 | ), |
| 844 | 845 | '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' ), | |
| 846 | + 'name' => __( 'Automatic Table Export', 'tablepress' ), | |
| 847 | + 'description' => __( 'Export and save tables to files on the server after they were modified.', 'tablepress' ), | |
| 848 | + 'category' => 'backend', | |
| 849 | + 'class' => 'TablePress_Module_Automatic_Table_Export', | |
| 850 | + 'incompatible_classes' => array(), | |
| 851 | + 'minimum_plan' => 'pro', | |
| 852 | + 'default_active' => false, | |
| 847 | 853 | ), |
| 848 | 854 | 'cell-highlighting' => array( |
| 849 | - 'name' => __( 'Cell Highlighting', 'tablepress' ), | |
| 850 | - 'description' => __( 'Add CSS classes to cells for highlighting based on their content.', 'tablepress' ), | |
| 855 | + 'name' => __( 'Cell Highlighting', 'tablepress' ), | |
| 856 | + 'description' => __( 'Add CSS classes to cells for highlighting based on their content.', 'tablepress' ), | |
| 857 | + 'category' => 'frontend', | |
| 858 | + 'class' => 'TablePress_Module_Cell_Highlighting', | |
| 859 | + 'incompatible_classes' => array( 'TablePress_Cell_Highlighting' ), | |
| 860 | + 'minimum_plan' => 'pro', | |
| 861 | + 'default_active' => false, | |
| 851 | 862 | ), |
| 852 | 863 | 'column-order' => array( |
| 853 | - 'name' => __( 'Column Order', 'tablepress' ), | |
| 854 | - 'description' => __( 'Order the columns in different ways when a table is shown.', 'tablepress' ), | |
| 864 | + 'name' => __( 'Column Order', 'tablepress' ), | |
| 865 | + 'description' => __( 'Order the columns in different ways when a table is shown.', 'tablepress' ), | |
| 866 | + 'category' => 'data-management', | |
| 867 | + 'class' => 'TablePress_Module_Column_Order', | |
| 868 | + 'incompatible_classes' => array( 'TablePress_Column_Order' ), | |
| 869 | + 'minimum_plan' => 'pro', | |
| 870 | + 'default_active' => false, | |
| 855 | 871 | ), |
| 856 | 872 | 'datatables-advanced-loading' => array( |
| 857 | - 'name' => __( 'Advanced Loading', 'tablepress' ), | |
| 858 | - 'description' => __( 'Load the table data from a JSON array for faster loading.', 'tablepress' ), | |
| 873 | + 'name' => __( 'Advanced Loading', 'tablepress' ), | |
| 874 | + 'description' => __( 'Load the table data from a JSON array for faster loading.', 'tablepress' ), | |
| 875 | + 'category' => 'backend', | |
| 876 | + 'class' => 'TablePress_Module_DataTables_Advanced_Loading', | |
| 877 | + 'incompatible_classes' => array( 'TablePress_DataTables_Advanced_Loading' ), | |
| 878 | + 'minimum_plan' => 'max', | |
| 879 | + 'default_active' => false, | |
| 859 | 880 | ), |
| 860 | 881 | 'datatables-alphabetsearch' => array( |
| 861 | - 'name' => __( 'Alphabet Search', 'tablepress' ), | |
| 862 | - 'description' => __( 'Show Alphabet buttons above the table to filter rows by their first letter.', 'tablepress' ), | |
| 882 | + 'name' => __( 'Alphabet Search', 'tablepress' ), | |
| 883 | + 'description' => __( 'Show Alphabet buttons above the table to filter rows by their first letter.', 'tablepress' ), | |
| 884 | + 'category' => 'search-filter', | |
| 885 | + 'class' => 'TablePress_Module_DataTables_Alphabetsearch', | |
| 886 | + 'incompatible_classes' => array(), | |
| 887 | + 'minimum_plan' => 'pro', | |
| 888 | + 'default_active' => false, | |
| 863 | 889 | ), |
| 864 | 890 | 'datatables-auto-filter' => array( |
| 865 | - 'name' => __( 'Automatic Filter', 'tablepress' ), | |
| 866 | - 'description' => __( 'Pre-filter a table when it is shown.', 'tablepress' ), | |
| 891 | + 'name' => __( 'Automatic Filter', 'tablepress' ), | |
| 892 | + 'description' => __( 'Pre-filter a table when it is shown.', 'tablepress' ), | |
| 893 | + 'category' => 'search-filter', | |
| 894 | + 'class' => 'TablePress_Module_DataTables_Auto_Filter', | |
| 895 | + 'incompatible_classes' => array( 'TablePress_DataTables_Auto_Filter' ), | |
| 896 | + 'minimum_plan' => 'pro', | |
| 897 | + 'default_active' => false, | |
| 867 | 898 | ), |
| 868 | 899 | 'datatables-buttons' => array( |
| 869 | - 'name' => __( 'User Action Buttons', 'tablepress' ), | |
| 870 | - 'description' => __( 'Add buttons for downloading, copying, printing, and changing column visibility of tables.', 'tablepress' ), | |
| 900 | + 'name' => __( 'User Action Buttons', 'tablepress' ), | |
| 901 | + 'description' => __( 'Add buttons for downloading, copying, printing, and changing column visibility of tables.', 'tablepress' ), | |
| 902 | + 'category' => 'frontend', | |
| 903 | + 'class' => 'TablePress_Module_DataTables_Buttons', | |
| 904 | + 'incompatible_classes' => array( 'TablePress_DataTables_Buttons' ), | |
| 905 | + 'minimum_plan' => 'pro', | |
| 906 | + 'default_active' => true, | |
| 871 | 907 | ), |
| 872 | 908 | 'datatables-columnfilterwidgets' => array( |
| 873 | - 'name' => __( 'Column Filter Dropdowns', 'tablepress' ), | |
| 874 | - 'description' => __( 'Add a search dropdown for each column above the table.', 'tablepress' ), | |
| 909 | + 'name' => __( 'Column Filter Dropdowns', 'tablepress' ), | |
| 910 | + 'description' => __( 'Add a search dropdown for each column above the table.', 'tablepress' ), | |
| 911 | + 'category' => 'search-filter', | |
| 912 | + 'class' => 'TablePress_Module_DataTables_ColumnFilterWidgets', | |
| 913 | + 'incompatible_classes' => array(), | |
| 914 | + 'minimum_plan' => 'pro', | |
| 915 | + 'default_active' => true, | |
| 875 | 916 | ), |
| 876 | 917 | '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' ), | |
| 918 | + 'name' => __( 'Individual Column Filtering', 'tablepress' ), | |
| 919 | + 'description' => __( 'Add a search field for each column to the table head or foot row.', 'tablepress' ), | |
| 920 | + 'category' => 'search-filter', | |
| 921 | + 'class' => 'TablePress_Module_DataTables_Column_Filter', | |
| 922 | + 'incompatible_classes' => array(), | |
| 923 | + 'minimum_plan' => 'pro', | |
| 924 | + 'default_active' => false, | |
| 879 | 925 | ), |
| 880 | 926 | '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' ), | |
| 927 | + 'name' => __( 'Index Column', 'tablepress' ), | |
| 928 | + 'description' => __( 'Make the first column an index or counter column with the row position.', 'tablepress' ), | |
| 929 | + 'category' => 'frontend', | |
| 930 | + 'class' => 'TablePress_Module_DataTables_Counter_Column', | |
| 931 | + 'incompatible_classes' => array(), | |
| 932 | + 'minimum_plan' => 'pro', | |
| 933 | + 'default_active' => false, | |
| 883 | 934 | ), |
| 884 | 935 | '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' ), | |
| 936 | + 'name' => __( 'Fixed Rows and Columns', 'tablepress' ), | |
| 937 | + 'description' => __( 'Fix the header and footer row and the first and last column when scrolling the table.', 'tablepress' ), | |
| 938 | + 'category' => 'frontend', | |
| 939 | + 'class' => 'TablePress_Module_DataTables_FixedHeader_FixedColumns', | |
| 940 | + 'incompatible_classes' => array( | |
| 941 | + 'TablePress_DataTables_FixedHeader', | |
| 942 | + 'TablePress_DataTables_FixedColumns', | |
| 943 | + ), | |
| 944 | + 'minimum_plan' => 'pro', | |
| 945 | + 'default_active' => true, | |
| 887 | 946 | ), |
| 888 | 947 | 'datatables-layout' => array( |
| 889 | - 'name' => __( 'Table Layout', 'tablepress' ), | |
| 890 | - 'description' => __( 'Customize the layout and position of features around a table.', 'tablepress' ), | |
| 948 | + 'name' => __( 'Table Layout', 'tablepress' ), | |
| 949 | + 'description' => __( 'Customize the layout and position of features around a table.', 'tablepress' ), | |
| 950 | + 'category' => 'frontend', | |
| 951 | + 'class' => 'TablePress_Module_DataTables_Layout', | |
| 952 | + 'incompatible_classes' => array(), | |
| 953 | + 'minimum_plan' => 'pro', | |
| 954 | + 'default_active' => true, | |
| 891 | 955 | ), |
| 892 | 956 | 'datatables-fuzzysearch' => array( |
| 893 | - 'name' => __( 'Fuzzy Search', 'tablepress' ), | |
| 894 | - 'description' => __( 'Let the search account for spelling mistakes and typos and find similar matches.', 'tablepress' ), | |
| 957 | + 'name' => __( 'Fuzzy Search', 'tablepress' ), | |
| 958 | + 'description' => __( 'Let the search account for spelling mistakes and typos and find similar matches.', 'tablepress' ), | |
| 959 | + 'category' => 'search-filter', | |
| 960 | + 'class' => 'TablePress_Module_DataTables_FuzzySearch', | |
| 961 | + 'incompatible_classes' => array(), | |
| 962 | + 'minimum_plan' => 'max', | |
| 963 | + 'default_active' => false, | |
| 895 | 964 | ), |
| 896 | 965 | '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' ), | |
| 966 | + 'name' => __( 'Inverted Filtering', 'tablepress' ), | |
| 967 | + 'description' => __( 'Turn the filtering into a search and hide the table if no search term is entered.', 'tablepress' ), | |
| 968 | + 'category' => 'search-filter', | |
| 969 | + 'class' => 'TablePress_Module_DataTables_Inverted_Filter', | |
| 970 | + 'incompatible_classes' => array(), | |
| 971 | + 'minimum_plan' => 'max', | |
| 972 | + 'default_active' => false, | |
| 899 | 973 | ), |
| 900 | 974 | 'datatables-pagination' => array( |
| 901 | - 'name' => __( 'Advanced Pagination Settings', 'tablepress' ), | |
| 902 | - 'description' => __( 'Customize the pagination settings of the table.', 'tablepress' ), | |
| 975 | + 'name' => __( 'Advanced Pagination Settings', 'tablepress' ), | |
| 976 | + 'description' => __( 'Customize the pagination settings of the table.', 'tablepress' ), | |
| 977 | + 'category' => 'frontend', | |
| 978 | + 'class' => 'TablePress_Module_DataTables_Pagination', | |
| 979 | + 'incompatible_classes' => array(), | |
| 980 | + 'minimum_plan' => 'pro', | |
| 981 | + 'default_active' => false, | |
| 903 | 982 | ), |
| 904 | 983 | 'datatables-rowgroup' => array( |
| 905 | - 'name' => __( 'Row Grouping', 'tablepress' ), | |
| 906 | - 'description' => __( 'Group table rows by a common keyword, category, or title.', 'tablepress' ), | |
| 984 | + 'name' => __( 'Row Grouping', 'tablepress' ), | |
| 985 | + 'description' => __( 'Group table rows by a common keyword, category, or title.', 'tablepress' ), | |
| 986 | + 'category' => 'frontend', | |
| 987 | + 'class' => 'TablePress_Module_DataTables_RowGroup', | |
| 988 | + 'incompatible_classes' => array( 'TablePress_DataTables_RowGroup' ), | |
| 989 | + 'minimum_plan' => 'pro', | |
| 990 | + 'default_active' => false, | |
| 907 | 991 | ), |
| 908 | 992 | 'datatables-searchbuilder' => array( |
| 909 | - 'name' => __( 'Custom Search Builder', 'tablepress' ), | |
| 910 | - 'description' => __( 'Show a search builder interface for filtering from groups and using conditions.', 'tablepress' ), | |
| 993 | + 'name' => __( 'Custom Search Builder', 'tablepress' ), | |
| 994 | + 'description' => __( 'Show a search builder interface for filtering from groups and using conditions.', 'tablepress' ), | |
| 995 | + 'category' => 'search-filter', | |
| 996 | + 'class' => 'TablePress_Module_DataTables_SearchBuilder', | |
| 997 | + 'incompatible_classes' => array(), | |
| 998 | + 'minimum_plan' => 'max', | |
| 999 | + 'default_active' => false, | |
| 911 | 1000 | ), |
| 912 | 1001 | 'datatables-searchhighlight' => array( |
| 913 | - 'name' => __( 'Search Highlighting', 'tablepress' ), | |
| 914 | - 'description' => __( 'Highlight found search terms in the table.', 'tablepress' ), | |
| 1002 | + 'name' => __( 'Search Highlighting', 'tablepress' ), | |
| 1003 | + 'description' => __( 'Highlight found search terms in the table.', 'tablepress' ), | |
| 1004 | + 'category' => 'search-filter', | |
| 1005 | + 'class' => 'TablePress_Module_DataTables_SearchHighlight', | |
| 1006 | + 'incompatible_classes' => array(), | |
| 1007 | + 'minimum_plan' => 'pro', | |
| 1008 | + 'default_active' => false, | |
| 915 | 1009 | ), |
| 916 | 1010 | 'datatables-searchpanes' => array( |
| 917 | - 'name' => __( 'Search Panes', 'tablepress' ), | |
| 918 | - 'description' => __( 'Show panes for filtering the columns.', 'tablepress' ), | |
| 1011 | + 'name' => __( 'Search Panes', 'tablepress' ), | |
| 1012 | + 'description' => __( 'Show panes for filtering the columns.', 'tablepress' ), | |
| 1013 | + 'category' => 'search-filter', | |
| 1014 | + 'class' => 'TablePress_Module_DataTables_SearchPanes', | |
| 1015 | + 'incompatible_classes' => array(), | |
| 1016 | + 'minimum_plan' => 'pro', | |
| 1017 | + 'default_active' => false, | |
| 919 | 1018 | ), |
| 920 | 1019 | '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' ), | |
| 1020 | + 'name' => __( 'Server-side Processing', 'tablepress' ), | |
| 1021 | + 'description' => __( 'Process sorting, filtering, and pagination on the server for faster loading of large tables.', 'tablepress' ), | |
| 1022 | + 'category' => 'backend', | |
| 1023 | + 'class' => 'TablePress_Module_DataTables_ServerSide_Processing', | |
| 1024 | + 'incompatible_classes' => array(), | |
| 1025 | + 'minimum_plan' => 'max', | |
| 1026 | + 'default_active' => true, | |
| 923 | 1027 | ), |
| 924 | 1028 | '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' ), | |
| 1029 | + 'name' => __( 'Default Style Customizer', 'tablepress' ), | |
| 1030 | + 'description' => __( 'Change the default styling of your tables in the visual style customizer.', 'tablepress' ), | |
| 1031 | + 'category' => 'frontend', | |
| 1032 | + 'class' => 'TablePress_Module_Default_Style_Customizer', | |
| 1033 | + 'incompatible_classes' => array(), | |
| 1034 | + 'minimum_plan' => 'pro', | |
| 1035 | + 'default_active' => true, | |
| 927 | 1036 | ), |
| 928 | 1037 | 'email-notifications' => array( |
| 929 | - 'name' => __( 'Email Notifications', 'tablepress' ), | |
| 930 | - 'description' => __( 'Get email notifications when certain actions are performed on tables.', 'tablepress' ), | |
| 1038 | + 'name' => __( 'Email Notifications', 'tablepress' ), | |
| 1039 | + 'description' => __( 'Get email notifications when certain actions are performed on tables.', 'tablepress' ), | |
| 1040 | + 'category' => 'backend', | |
| 1041 | + 'class' => 'TablePress_Module_Email_Notifications', | |
| 1042 | + 'incompatible_classes' => array(), | |
| 1043 | + 'minimum_plan' => 'max', | |
| 1044 | + 'default_active' => false, | |
| 931 | 1045 | ), |
| 932 | 1046 | 'responsive-tables' => array( |
| 933 | - 'name' => __( 'Responsive Tables', 'tablepress' ), | |
| 934 | - 'description' => __( 'Make your tables look good on different screen sizes.', 'tablepress' ), | |
| 1047 | + 'name' => __( 'Responsive Tables', 'tablepress' ), | |
| 1048 | + 'description' => __( 'Make your tables look good on different screen sizes.', 'tablepress' ), | |
| 1049 | + 'category' => 'frontend', | |
| 1050 | + 'class' => 'TablePress_Module_Responsive_Tables', | |
| 1051 | + 'incompatible_classes' => array( 'TablePress_Responsive_Tables' ), | |
| 1052 | + 'minimum_plan' => 'pro', | |
| 1053 | + 'default_active' => true, | |
| 935 | 1054 | ), |
| 936 | 1055 | 'rest-api' => array( |
| 937 | - 'name' => __( 'REST API', 'tablepress' ), | |
| 938 | - 'description' => __( 'Read table data via the WordPress REST API, e.g. in external apps.', 'tablepress' ), | |
| 1056 | + 'name' => __( 'REST API', 'tablepress' ), | |
| 1057 | + 'description' => __( 'Read table data via the WordPress REST API, e.g. in external apps.', 'tablepress' ), | |
| 1058 | + 'category' => 'backend', | |
| 1059 | + 'class' => 'TablePress_Module_REST_API', | |
| 1060 | + 'incompatible_classes' => array( 'TablePress_REST_API_Controller' ), | |
| 1061 | + 'minimum_plan' => 'max', | |
| 1062 | + 'default_active' => false, | |
| 939 | 1063 | ), |
| 940 | 1064 | 'row-filtering' => array( |
| 941 | - 'name' => __( 'Row Filtering', 'tablepress' ), | |
| 942 | - 'description' => __( 'Show only table rows that contain defined keywords.', 'tablepress' ), | |
| 1065 | + 'name' => __( 'Row Filtering', 'tablepress' ), | |
| 1066 | + 'description' => __( 'Show only table rows that contain defined keywords.', 'tablepress' ), | |
| 1067 | + 'category' => 'data-management', | |
| 1068 | + 'class' => 'TablePress_Module_Row_Filtering', | |
| 1069 | + 'incompatible_classes' => array( 'TablePress_Row_Filter' ), | |
| 1070 | + 'minimum_plan' => 'pro', | |
| 1071 | + 'default_active' => true, | |
| 943 | 1072 | ), |
| 944 | 1073 | 'row-highlighting' => array( |
| 945 | - 'name' => __( 'Row Highlighting', 'tablepress' ), | |
| 946 | - 'description' => __( 'Add CSS classes to rows for highlighting based on their content.', 'tablepress' ), | |
| 1074 | + 'name' => __( 'Row Highlighting', 'tablepress' ), | |
| 1075 | + 'description' => __( 'Add CSS classes to rows for highlighting based on their content.', 'tablepress' ), | |
| 1076 | + 'category' => 'frontend', | |
| 1077 | + 'class' => 'TablePress_Module_Row_Highlighting', | |
| 1078 | + 'incompatible_classes' => array( 'TablePress_Row_Highlighting' ), | |
| 1079 | + 'minimum_plan' => 'pro', | |
| 1080 | + 'default_active' => false, | |
| 947 | 1081 | ), |
| 948 | 1082 | 'row-order' => array( |
| 949 | - 'name' => __( 'Row Order', 'tablepress' ), | |
| 950 | - 'description' => __( 'Order the rows in different ways when a table is shown.', 'tablepress' ), | |
| 1083 | + 'name' => __( 'Row Order', 'tablepress' ), | |
| 1084 | + 'description' => __( 'Order the rows in different ways when a table is shown.', 'tablepress' ), | |
| 1085 | + 'category' => 'data-management', | |
| 1086 | + 'class' => 'TablePress_Module_Row_Order', | |
| 1087 | + 'incompatible_classes' => array( 'TablePress_Row_Order' ), | |
| 1088 | + 'minimum_plan' => 'pro', | |
| 1089 | + 'default_active' => false, | |
| 951 | 1090 | ), |
| 952 | 1091 | ); |
| 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 | 1092 | } |
| 1027 | 1093 | |
| 1028 | 1094 | } // class TablePress |