$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 ); add_thickbox(); // For the table preview. $this->admin_page->enqueue_script( 'list' ); if ( $data['messages']['first_visit'] ) { $message = '
' . __( 'Thank you for choosing TablePress, the most popular table plugin for WordPress!', 'tablepress' ) . '
'; $message .= '' . sprintf( __( 'If you encounter any questions or problems, please visit the FAQ, the Documentation, and the Support section on the plugin website.', 'tablepress' ), 'https://tablepress.org/faq/', 'https://tablepress.org/documentation/', 'https://tablepress.org/support/', 'https://tablepress.org/' ) . '
'; if ( tb_tp_fs()->is_free_plan() ) { $message .= '' . sprintf( __( 'More great features for you and your site’s visitors and priority email support are available with a Premium license plan of TablePress. Go check them out!', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=first-visit-message' ) . '
'; } $message .= '' . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'first_visit', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '
'; $title = '' . __( 'Welcome!', 'tablepress' ) . ''; $this->add_header_message( $message, 'notice-info not-dismissible', $title ); } if ( $data['messages']['donation_message'] ) { $message = '' . __( 'Hi, my name is Tobias, I’m the developer of the TablePress plugin.', 'tablepress' ) . '
'; $message .= '' . __( 'Thank you for using it!', 'tablepress' ) . ' '; if ( $data['table_count'] > 0 ) { $message .= sprintf( _n( 'I hope that everything works and that you are satisfied with the results of managing your %s table.', 'I hope that everything works and that you are satisfied with the results of managing your %s tables.', $data['table_count'], 'tablepress' ), $data['table_count'] ); } else { $message .= sprintf( __( 'It looks like you haven’t added a table yet. If you need help to get started, please find more information in the FAQ and Documentation on the TablePress website.', 'tablepress' ), 'https://tablepress.org/' ); } $message .= '
'; $message .= '' . sprintf( __( 'I would like to invite you to check out the Premium versions of TablePress.', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=upgrade-message' ) . '
'
. __( 'The available Pro and Max plans offer user support and many exciting and helpful features for your tables.', 'tablepress' ) . '
' . __( 'Sincerely, Tobias', 'tablepress' ) . '
'; $message .= '' . sprintf( '%s', 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=upgrade-message', __( 'Tell me more about the Premium features', 'tablepress' ) ) . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '
'; $title = '' . __( 'TablePress has more to offer!', 'tablepress' ) . ''; $this->add_header_message( $message, 'notice-success not-dismissible', $title ); } if ( $data['messages']['plugin_update_message'] ) { $message = '' . sprintf( __( 'To find out more about what’s new, please read the release announcement.', 'tablepress' ), 'https://tablepress.org/news/?utm_source=plugin&utm_medium=textlink&utm_content=plugin-update-message' ) . '
'; if ( tb_tp_fs()->is_free_plan() ) { $message .= '' . sprintf( __( 'More great features and priority email support are available with a Premium license plan. Check them out!', 'tablepress' ), 'https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=plugin-update-message' ) . '
'; } $message .= '' . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'plugin_update', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ) . '
'; $title = '' . sprintf( __( 'Thank you for updating to TablePress %s!', 'tablepress' ), TablePress::version ) . ''; $this->add_header_message( $message, 'notice-info not-dismissible', $title ); } $this->process_action_messages( array( 'success_delete' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress' ), 'success_delete_plural' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 2, 'tablepress' ), 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ), 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ( ( false !== $data['table_id'] ) ? ' ' . sprintf( __( 'The copied table has the table ID “%s”.', 'tablepress' ), esc_html( $data['table_id'] ) ) : '' ), 'success_copy_plural' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 2, 'tablepress' ), 'error_copy' => __( 'Error: The table could not be copied.', 'tablepress' ), 'error_no_table' => __( 'Error: You did not specify a valid table ID.', 'tablepress' ), 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ), 'error_bulk_action_invalid' => __( 'Error: This bulk action is invalid!', 'tablepress' ), 'error_no_selection' => __( 'Error: You did not select any tables!', 'tablepress' ), 'error_delete_not_all_tables' => __( 'Notice: Not all selected tables could be deleted!', 'tablepress' ), 'error_copy_not_all_tables' => __( 'Notice: Not all selected tables could be copied!', 'tablepress' ), 'success_import' => __( 'The tables were imported successfully.', 'tablepress' ), ) ); $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); $this->add_text_box( 'tables-list', array( $this, 'textbox_tables_list' ), 'normal' ); add_screen_option( 'per_page', array( 'label' => __( 'Tables', 'tablepress' ), 'default' => 20 ) ); // Admin_Controller contains function to allow changes to this in the Screen Options to be saved. $this->wp_list_table = TablePress::load_class( 'TablePress_All_Tables_List_Table', 'class-all-tables-list-table.php', 'views' ); $this->wp_list_table->set_items( $this->data['table_ids'] ); $this->wp_list_table->prepare_items(); // Cleanup Request URI string, which WP_List_Table uses to generate the sort URLs. $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'table_id' ), $_SERVER['REQUEST_URI'] ); } /** * Render the current view (in this view: without form tag). * * @since 1.0.0 */ #[\Override] public function render(): void { ?>'; _e( 'This is a list of your tables.', 'tablepress' ); echo ' '; // Show the instructions string depending on whether the Block Editor is used on the site or not. if ( $data['site_uses_block_editor'] ) { printf( __( 'To insert a table into a post or page, add a “%1$s” block in the block editor and select the desired table.', 'tablepress' ), __( 'TablePress table', 'tablepress' ) ); } else { _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' ); echo ' '; _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' ); } echo '
'; } /** * Print the content of the "All Tables" text box. * * @since 1.0.0 * * @param array