setup_actions(); } return self::$instance; } /** * Sets up initial actions. * * @access private * @return void */ private function setup_actions() { // Display activation notice. add_action( 'load-themes.php', array( self::$instance, 'add_admin_notices' ) ); // Add theme's info page to the Dashboard menu. add_action( 'admin_menu', array( self::$instance, 'register_menu_page' ) ); // Add theme's info page scripts. add_action( 'admin_enqueue_scripts', array( self::$instance, 'admin_scripts' ) ); } /** * Load theme's info page styles. * * @access public * @return void */ public function admin_scripts() { global $pagenow; if ( 'themes.php' != $pagenow ) { return; } wp_enqueue_style( 'blogbaster-dashboard', BLOGBASTER_DIR_URI . '/inc/welcome-screen/assets/dashboard-style.css', false, '1.0.0' ); } /** * Create theme's info page. * * @access public * @return void */ public function register_menu_page() { add_theme_page( esc_html__( 'Underboot Dashboard', 'blogbaster' ), esc_html__( 'Theme Info', 'blogbaster' ), 'edit_theme_options', 'blogbaster-dashboard', array( self::$instance, 'theme_dashboard_page' ) ); } /** * Display a welcome notice upon successful activation. * * @access public * @return void */ public function add_admin_notices() { global $pagenow; if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( self::$instance, 'welcome_admin_notice' ) ); } } /** * Display a welcome notice when the theme is activated. * * @access public * @return void */ public function welcome_admin_notice() { $theme_data = wp_get_theme(); ?>

welcome page.', 'blogbaster' ), array( 'a' => array( 'href' => array() ) ) ), esc_attr( $theme_data->Name ), esc_url( admin_url( 'themes.php?page=blogbaster-dashboard' ) ) ); ?>

'getting_started', 'title' => esc_html__( 'Getting Started', 'blogbaster' ), ), array( 'slug' => 'compare', 'title' => esc_html__( 'Free vs Pro version', 'blogbaster' ), ), array( 'slug' => 'support', 'title' => esc_html__( 'Support', 'blogbaster' ), ), array( 'slug' => 'contribute', 'title' => esc_html__( 'Contribute', 'blogbaster' ), ), ); $tabs = apply_filters( 'blogbaster_dashboard_page_tabs', $tabs ); foreach ( $tabs as $tab ) { if ( $current_tab === $tab['slug'] ) { $class = 'nav-tab nav-tab-active'; } else { $class = 'nav-tab'; } // Create URL for the current tab. $url = esc_url( admin_url( 'themes.php?page=blogbaster-dashboard&tab=' . $tab['slug'] ) ); /* translators: %1$s, %2$s and %3$s are a placeholders that will be replaced by variables passed as an argument. */ printf( '%3$s', $class, $url, $tab['title'] ); // WPCS: XSS OK. } } /** * Display tabs content on the theme's dashabord page. * * @access public * @param string * @return void */ public function get_dashboard_page_tab_content( $current_tab = '' ) { $content = array( 'support' => BLOGBASTER_DIR . '/inc/welcome-screen/partials/theme-dashboard-support.php', 'contribute' => BLOGBASTER_DIR . '/inc/welcome-screen/partials/theme-dashboard-contribute.php', 'getting_started' => BLOGBASTER_DIR . '/inc/welcome-screen/partials/theme-dashboard-getting-started.php', 'compare' => BLOGBASTER_DIR . '/inc/welcome-screen/partials/theme-dashboard-compare.php', ); $content = apply_filters( 'blogbaster_dashboard_page_tab_content', $content ); if ( isset( $content[$current_tab] ) && file_exists( $content[$current_tab] ) ) { require_once $content[$current_tab]; } } } Blogbaster_Welcome_Screen::instance();