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' ) ); $common_content = '
' . sprintf( __( 'More information about TablePress can be found on the plugin website or on its page in the WordPress Plugin Directory.', 'tablepress' ), 'https://tablepress.org/', 'https://wordpress.org/plugins/tablepress/' ) . '
'; $common_content .= '' . sprintf( __( 'For technical information, please see the Documentation.', 'tablepress' ), 'https://tablepress.org/documentation/' ) . ' ' . sprintf( __( 'Common questions are answered in the FAQ.', 'tablepress' ), 'https://tablepress.org/faq/' ) . '
'; if ( tb_tp_fs()->is_free_plan() ) { $common_content .= '' . 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/' ) . '
'; $common_content .= '' . 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/' ) . '
'; } $screen->add_help_tab( array( 'id' => 'tablepress-help', // This should be unique for the screen. 'title' => __( 'TablePress Help', 'tablepress' ), 'content' => '' . $this->help_tab_content() . '
' . $common_content, ) ); // "Sidebar" in the help tab. $screen->set_help_sidebar( '' . __( 'For more information:', 'tablepress' ) . '
' . '' . '' . '' . '' ); } /** * Change the value of the user option "screen_layout_{$screen->id}" through a filter. * * @since 1.0.0 * * @param int|false $result 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-core', 'postbox' ) ); $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 $css_class Optional. Additional CSS class for the header message. * @param string $title Optional. Text for the header title. */ protected function add_header_message( $text, $css_class = 'notice-success', $title = '' ) { if ( ! strpos( $css_class, 'not-dismissible' ) ) { $css_class .= ' is-dismissible'; } if ( '' !== $title ) { $title = "tags if it does not already start with one (potentially with attributes), indicating custom message HTML. if ( '' !== $text && 0 !== strpos( $text, '
{$text}
"; } $this->header_messages[] = "' . sprintf( __( 'Error code: %s', 'tablepress' ), '' . esc_html( $this->data['error_details'] ) . '' );
}
$this->add_header_message( "{$action_messages[ $this->data['message'] ]}{$this->data['error_details']}", $class );
}
}
/**
* Register a text box for the view.
*
* @since 1.0.0
*
* @param string $id Unique HTML ID for the text box container (only visible with $wrap = true).
* @param callback $callback Callback that prints the contents of the text box.
* @param string $context Optional. Context/position of the text box (normal, side, additional, header, submit).
* @param bool $wrap Whether the content of the text box shall be wrapped in a