| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | * |
| 27 | 27 | * @since 2.0.0 |
| 28 | 28 | * @var string[] |
| 29 | 29 | */ |
| 30 | - protected $wp_pointers = array( 'tp20_import_drag_drop_detect_format' ); | |
| 30 | + protected array $wp_pointers = array( 'tp20_import_drag_drop_detect_format' ); | |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Set up the view with data and do things that are specific for this view. |
| 34 | 34 | * |
| @@ -36,8 +36,9 @@ | ||
| 36 | 36 | * |
| 37 | 37 | * @param string $action Action for this view. |
| 38 | 38 | * @param array<string, mixed> $data Data for this view. |
| 39 | 39 | */ |
| 40 | + #[\Override] | |
| 40 | 41 | public function setup( /* string */ $action, array $data ) /* : void */ { |
| 41 | 42 | // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. |
| 42 | 43 | |
| 43 | 44 | parent::setup( $action, $data ); |
| @@ -43,12 +44,10 @@ | ||
| 43 | 44 | parent::setup( $action, $data ); |
| 44 | 45 | |
| 45 | 46 | $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' ); |
| 46 | 47 | |
| 47 | - $this->admin_page->enqueue_style( 'jsuites' ); | |
| 48 | - $this->admin_page->enqueue_style( 'import', array( 'tablepress-jsuites' ) ); | |
| 49 | - $this->admin_page->enqueue_script( 'jsuites' ); | |
| 50 | - $this->admin_page->enqueue_script( 'import', array( 'tablepress-jsuites' ) ); | |
| 48 | + $this->admin_page->enqueue_style( 'import' ); | |
| 49 | + $this->admin_page->enqueue_script( 'import' ); | |
| 51 | 50 | |
| 52 | 51 | $this->process_action_messages( array( |
| 53 | 52 | 'error_import' => __( 'Error: The import failed.', 'tablepress' ), |
| 54 | 53 | ) ); |
| @@ -55,9 +54,9 @@ | ||
| 55 | 54 | |
| 56 | 55 | $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); |
| 57 | 56 | $this->add_meta_box( 'import-form', __( 'Import Tables', 'tablepress' ), array( $this, 'postbox_import_form' ), 'normal' ); |
| 58 | 57 | $screen = get_current_screen(); |
| 59 | - add_filter( "postbox_classes_{$screen->id}_tablepress_{$this->action}-import-form", array( $this, 'postbox_classes' ) ); | |
| 58 | + add_filter( "postbox_classes_{$screen->id}_tablepress_{$this->action}-import-form", array( $this, 'postbox_classes' ) ); // @phpstan-ignore property.nonObject | |
| 60 | 59 | $this->add_meta_box( 'tables-auto-import', __( 'Automatic Periodic Table Import', 'tablepress' ), array( $this, 'postbox_auto_import' ), 'additional' ); |
| 61 | 60 | } |
| 62 | 61 | |
| 63 | 62 | /** |
| @@ -70,9 +69,9 @@ | ||
| 70 | 69 | */ |
| 71 | 70 | public function textbox_head( array $data, array $box ): void { |
| 72 | 71 | ?> |
| 73 | 72 | <p> |
| 74 | - <?php _e( 'TablePress can import tables from common spreadsheet applications, like XLSX files fom Excel, or CSV, ODS, HTML, and JSON files.', 'tablepress' ); ?> | |
| 73 | + <?php _e( 'TablePress can import tables from common spreadsheet applications, like XLSX files from Excel, or CSV, ODS, HTML, and JSON files.', 'tablepress' ); ?> | |
| 75 | 74 | </p> |
| 76 | 75 | <p> |
| 77 | 76 | <?php _e( 'To import tables, select and enter the import source in the following form.', 'tablepress' ); ?> |
| 78 | 77 | <?php _e( 'You can also choose to import it as a new table, to replace an existing table, or to append the rows to an existing table.', 'tablepress' ); ?> |
| @@ -96,10 +95,10 @@ | ||
| 96 | 95 | 'importUrl' => $this->admin_page->convert_to_json_parse_output( esc_url( $data['import_url'] ) ), |
| 97 | 96 | 'importServer' => $this->admin_page->convert_to_json_parse_output( $data['import_server'] ), |
| 98 | 97 | 'importFormField' => $this->admin_page->convert_to_json_parse_output( $data['import_form-field'] ), |
| 99 | 98 | 'importExistingTable' => $this->admin_page->convert_to_json_parse_output( $data['import_existing_table'] ), |
| 100 | - 'zipSupportAvailable' => $this->admin_page->convert_to_json_parse_output( $data['zip_support_available'] ), | |
| 101 | 99 | 'showImportSourceServer' => ( ( ! is_multisite() && current_user_can( 'manage_options' ) ) || is_super_admin() ) ? 'true' : 'false', |
| 100 | + 'showImportSourceUrl' => current_user_can( 'tablepress_import_tables_url' ) ? 'true' : 'false', | |
| 102 | 101 | 'legacyImport' => $this->admin_page->convert_to_json_parse_output( $data['legacy_import'] ), |
| 103 | 102 | ); |
| 104 | 103 | |
| 105 | 104 | echo "<script>\n"; |
| @@ -133,9 +132,9 @@ | ||
| 133 | 132 | * |
| 134 | 133 | * @param array<string, mixed> $data Data for this screen. |
| 135 | 134 | * @param array<string, mixed> $box Information about the meta box. |
| 136 | 135 | * |
| 137 | - * @phpstan-ignore-next-line (PHPStan would like to see a type hint.) | |
| 136 | + * @phpstan-ignore missingType.return (The method is extended elsewhere and can't have type hints.) | |
| 138 | 137 | */ |
| 139 | 138 | public function postbox_auto_import( /* array */ $data, /* array */ $box ) /* : void */ { |
| 140 | 139 | // Don't use type hints in the method declaration, as the method is extended in the TablePress Table Auto Update Extension which is no longer updated. |
| 141 | 140 | |
| @@ -156,9 +155,9 @@ | ||
| 156 | 155 | * @since 2.0.0 |
| 157 | 156 | */ |
| 158 | 157 | public function wp_pointer_tp20_import_drag_drop_detect_format(): void { |
| 159 | 158 | $content = '<h3>' . __( 'TablePress feature: Drag and Drop Import with Format Detection', 'tablepress' ) . '</h3>'; |
| 160 | - $content .= '<p>' . __( 'Did you know?', 'tablepress' ) . ' ' . __( 'The import of tables is now even more powerful! You can simply drag and drop your files into this area and TablePress will automatically detect the file format!', 'tablepress' ) . '</p>'; | |
| 159 | + $content .= '<p>' . __( 'Did you know?', 'tablepress' ) . ' ' . __( 'To import tables, you can simply drag and drop your spreadsheet files into this area and TablePress will automatically detect the file format!', 'tablepress' ) . '</p>'; | |
| 161 | 160 | |
| 162 | 161 | $this->admin_page->print_wp_pointer_js( |
| 163 | 162 | 'tp20_import_drag_drop_detect_format', |
| 164 | 163 | '#tables-import-file-upload-dropzone span', |
| @@ -164,9 +163,9 @@ | ||
| 164 | 163 | '#tables-import-file-upload-dropzone span', |
| 165 | 164 | array( |
| 166 | 165 | 'content' => $content, |
| 167 | 166 | 'position' => array( 'edge' => 'bottom', 'align' => 'center' ), |
| 168 | - ) | |
| 167 | + ), | |
| 169 | 168 | ); |
| 170 | 169 | } |
| 171 | 170 | |
| 172 | 171 | } // class TablePress_Import_View |