$data Data for this view. */ #[\Override] public function setup( /* string */ $action, array $data ) /* : void */ { // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. parent::setup( $action, $data ); $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' ); $this->admin_page->enqueue_style( 'jsuites' ); $this->admin_page->enqueue_style( 'import', array( 'tablepress-jsuites' ) ); $this->admin_page->enqueue_script( 'jsuites' ); $this->admin_page->enqueue_script( 'import', array( 'tablepress-jsuites' ) ); $this->process_action_messages( array( 'error_import' => __( 'Error: The import failed.', 'tablepress' ), ) ); $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); $this->add_meta_box( 'import-form', __( 'Import Tables', 'tablepress' ), array( $this, 'postbox_import_form' ), 'normal' ); $screen = get_current_screen(); add_filter( "postbox_classes_{$screen->id}_tablepress_{$this->action}-import-form", array( $this, 'postbox_classes' ) ); $this->add_meta_box( 'tables-auto-import', __( 'Automatic Periodic Table Import', 'tablepress' ), array( $this, 'postbox_auto_import' ), 'additional' ); } /** * Print the screen head text. * * @since 1.0.0 * * @param array $data Data for this screen. * @param array $box Information about the text box. */ public function textbox_head( array $data, array $box ): void { ?>

$data Data for this screen. * @param array $box Information about the meta box. */ public function postbox_import_form( array $data, array $box ): void { $script_data = array( 'tables' => $this->admin_page->convert_to_json_parse_output( $data['tables'] ), 'importSource' => $this->admin_page->convert_to_json_parse_output( $data['import_source'] ), 'importType' => $this->admin_page->convert_to_json_parse_output( $data['import_type'] ), 'importUrl' => $this->admin_page->convert_to_json_parse_output( esc_url( $data['import_url'] ) ), 'importServer' => $this->admin_page->convert_to_json_parse_output( $data['import_server'] ), 'importFormField' => $this->admin_page->convert_to_json_parse_output( $data['import_form-field'] ), 'importExistingTable' => $this->admin_page->convert_to_json_parse_output( $data['import_existing_table'] ), 'zipSupportAvailable' => $this->admin_page->convert_to_json_parse_output( $data['zip_support_available'] ), 'showImportSourceServer' => ( ( ! is_multisite() && current_user_can( 'manage_options' ) ) || is_super_admin() ) ? 'true' : 'false', 'legacyImport' => $this->admin_page->convert_to_json_parse_output( $data['legacy_import'] ), ); echo "\n"; echo '
'; } /** * Adds the "no-validation-highlighting" class to the "Import Tables" post meta box. * * @since 2.2.0 * * @param string[] $classes The array of postbox classes. * @return string[] The modified array of postbox classes. */ public function postbox_classes( array $classes ): array { $classes[] = 'no-validation-highlighting'; return $classes; } /** * Prints the content of the "Automatic Periodic Table Import Screen" post meta box. * * @since 2.2.0 * * @param array $data Data for this screen. * @param array $box Information about the meta box. * * @phpstan-ignore-next-line (PHPStan would like to see a type hint.) */ public function postbox_auto_import( /* array */ $data, /* array */ $box ) /* : void */ { // 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. if ( tb_tp_fs()->is_free_plan() ) : ?>

“%2$s” premium feature!', 'tablepress' ), 'https://tablepress.org/modules/automatic-periodic-table-import/?utm_source=plugin&utm_medium=textlink&utm_content=import-screen', __( 'Automatic Periodic Table Import', 'tablepress' ) ); ?>

' . __( 'TablePress feature: Drag and Drop Import with Format Detection', 'tablepress' ) . ''; $content .= '

' . __( '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' ) . '

'; $this->admin_page->print_wp_pointer_js( 'tp20_import_drag_drop_detect_format', '#tables-import-file-upload-dropzone span', array( 'content' => $content, 'position' => array( 'edge' => 'bottom', 'align' => 'center' ), ) ); } } // class TablePress_Import_View