| @@ -23,14 +23,12 @@ | ||
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * File/Data Formats that are available for import. |
| 26 | 26 | * |
| 27 | - * The constructor also adds 'html', if the PHP prerequisites are met. | |
| 28 | - * | |
| 29 | 27 | * @since 1.0.0 |
| 30 | - * @var string[] | |
| 28 | + * @var array<string, string> | |
| 31 | 29 | */ |
| 32 | - public array $import_formats = array( 'csv', 'json', 'xls', 'xlsx' ); | |
| 30 | + public array $import_formats = array(); | |
| 33 | 31 | |
| 34 | 32 | /** |
| 35 | 33 | * Whether HTML import support is available in the PHP installation on the server. |
| 36 | 34 | * |
| @@ -62,11 +60,17 @@ | ||
| 62 | 60 | if ( class_exists( 'DOMDocument', false ) && function_exists( 'simplexml_import_dom' ) && function_exists( 'libxml_use_internal_errors' ) ) { |
| 63 | 61 | $this->html_import_support_available = true; |
| 64 | 62 | } |
| 65 | 63 | |
| 64 | + // Initiate here, because function call not possible outside a class method. | |
| 65 | + $this->import_formats = array(); | |
| 66 | + $this->import_formats['csv'] = __( 'CSV - Character-Separated Values', 'tablepress' ); | |
| 66 | 67 | if ( $this->html_import_support_available ) { |
| 67 | - $this->import_formats[] = 'html'; | |
| 68 | + $this->import_formats['html'] = __( 'HTML - Hypertext Markup Language', 'tablepress' ); | |
| 68 | 69 | } |
| 70 | + $this->import_formats['json'] = __( 'JSON - JavaScript Object Notation', 'tablepress' ); | |
| 71 | + $this->import_formats['xls'] = __( 'XLS - Microsoft Excel 97-2003 (experimental)', 'tablepress' ); | |
| 72 | + $this->import_formats['xlsx'] = __( 'XLSX - Microsoft Excel 2007-2019 (experimental)', 'tablepress' ); | |
| 69 | 73 | } |
| 70 | 74 | |
| 71 | 75 | /** |
| 72 | 76 | * Import a table. |