screen_columns ) { $screen->add_option( 'layout_columns', array( 'max' => $this->screen_columns ) ); } // Enable two column layout. add_filter( "get_user_option_screen_layout_{$screen->id}", array( $this, 'set_current_screen_layout_columns' ) ); $screen->add_help_tab( array( 'id' => 'tablepress-help', // This should be unique for the screen. 'title' => __( 'TablePress Help', 'tablepress' ), 'content' => '
' . $this->help_tab_content() . '
' . '' . sprintf( __( 'More information about TablePress can be found on the plugin’s website or on its page in the WordPress Plugin Directory.', 'tablepress' ), 'https://tablepress.org/', 'https://wordpress.org/plugins/tablepress/' ) . ' '
. sprintf( __( 'For technical information, please see the documentation.', 'tablepress' ), 'https://tablepress.org/documentation/' ) . ' '
. sprintf( __( 'Support is provided through the WordPress Support Forums.', 'tablepress' ), 'https://tablepress.org/support/', 'https://wordpress.org/tags/tablepress' ) . ' '
. sprintf( __( 'Before asking for support, please carefully read the Frequently Asked Questions, where you will find answers to the most common questions, and search through the forums.', 'tablepress' ), 'https://tablepress.org/faq/' ) . '
'
. sprintf( __( 'If you like the plugin, a donation is recommended.', 'tablepress' ), 'https://tablepress.org/donate/' ) . '
' . __( 'For more information:', 'tablepress' ) . '
' ); } /** * Change the value of the user option "screen_layout_{$screen->id}" through a filter. * * @since 1.0.0 * * @param int|bool Current value of the user option. * @return int New value for the user option. */ public function set_current_screen_layout_columns( $result ) { if ( false === $result ) { // The user option does not yet exist. $result = $this->screen_columns; } elseif ( $result > $this->screen_columns ) { // The value of the user option is bigger than what is possible on this screen (e.g. because the number of columns was reduced in an update). $result = $this->screen_columns; } return $result; } /** * Set up the view with data and do things that are necessary for all views. * * @since 1.0.0 * * @param string $action Action for this view. * @param array $data Data for this view. */ public function setup( $action, array $data ) { $this->action = $action; $this->data = $data; // Set page title. $GLOBALS['title'] = sprintf( __( '%1$s ‹ %2$s', 'tablepress' ), $this->data['view_actions'][ $this->action ]['page_title'], 'TablePress' ); // Admin page helpers, like script/style loading, could be moved to view. $this->admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' ); $this->admin_page->enqueue_style( 'common' ); // RTL styles for the admin interface. if ( is_rtl() ) { $this->admin_page->enqueue_style( 'common-rtl', array( 'tablepress-common' ) ); } $this->admin_page->enqueue_script( 'common', array( 'jquery', 'postbox' ), array( 'common' => array( 'ays_delete_single_table' => _n( 'Do you really want to delete this table?', 'Do you really want to delete these tables?', 1, 'tablepress' ), 'ays_delete_multiple_tables' => _n( 'Do you really want to delete this table?', 'Do you really want to delete these tables?', 2, 'tablepress' ), ) ) ); $this->admin_page->add_admin_footer_text(); // Initialize WP feature pointers for TablePress. $this->_init_wp_pointers(); // Necessary fields for all views. $this->add_text_box( 'default_nonce_fields', array( $this, 'default_nonce_fields' ), 'header', false ); $this->add_text_box( 'action_nonce_field', array( $this, 'action_nonce_field' ), 'header', false ); $this->add_text_box( 'action_field', array( $this, 'action_field' ), 'header', false ); } /** * Register a header message for the view. * * @since 1.0.0 * * @param string $text Text for the header message. * @param string $class Optional. Additional CSS class for the header message. */ protected function add_header_message( $text, $class = 'notice-success' ) { if ( ! stripos( $class, 'not-dismissible' ) ) { $class .= ' is-dismissible'; } $this->header_messages[] = "{$text}