theme_name = $theme->parent()->get( 'Name' ); $this->theme = $theme->parent(); } else { $this->theme_name = $theme->get( 'Name' ); $this->theme = $theme->parent(); } $this->theme_version = $theme->get( 'Version' ); $this->theme_slug = $theme->get_template(); $this->menu_name = sprintf( esc_html__( '%s', 'aytias' ), $this->theme_name ); $this->page_name = sprintf( esc_html__( '%s', 'aytias' ), $this->theme_name ); $this->page_slug = $this->theme_slug . '-welcome'; if ( current_user_can( 'manage_options' ) ) { add_action( 'admin_menu', array( $this, 'add_menu' ) ); add_action( 'admin_bar_menu', array( $this, 'add_bar_menu' ), 999 ); add_action( 'admin_notices', array( $this, 'display_admin_notice' ), 99 ); } add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'wp_ajax_aytias_dismiss', array( $this, 'dismiss_callback' ) ); add_action( 'wp_ajax_nopriv_aytias_dismiss', array( $this, 'dismiss_callback' ) ); } /** * Add theme dashboard page. * * @since 1.0.0 */ public function add_menu() { add_theme_page( $this->menu_name, $this->page_name, 'manage_options', $this->page_slug, array( $this, 'render_main_page') ); } /** * Add link in menu bar * * @since 1.0.0 */ public function add_bar_menu() { global $wp_admin_bar; if ( ! is_super_admin() || ! is_admin_bar_showing() ) { return; } $wp_admin_bar->add_menu( array( 'parent' => 'site-name', 'id' => $this->page_slug, 'title' => $this->theme_name, 'href' => admin_url( "themes.php?page=$this->page_slug" ) ) ); } /** * Display notice in admin area * * @since 1.0.1 */ public function display_admin_notice(){ $screen_id = null; $current_screen = get_current_screen(); if ( $current_screen ) { $screen_id = $current_screen->id; } $user_id = get_current_user_id(); $dismiss_status = get_user_meta( $user_id, 'aytias_dismiss_status', true ); ?>

theme_name ) ) ;?>

page_slug" ) )?>" class="button button-primary"> theme_name )?>

theme_name ); ?> - theme_version ); ?>

{$method}(); } else { printf( esc_html__( '%s() method does not exist.', 'aytias' ), $method ); } ?>
get_tgmpa_url(); $tgmpa_complete = $tgmpa->is_tgmpa_complete(); } ?>

get_tgmpa_url(); $tgmpa_complete = $tgmpa->is_tgmpa_complete(); $plugins = $tgmpa->plugins; ?>

page_slug", "appearance_page_$this->page_slug", ); if ( in_array( $hook, $valid_pages, true ) ) { wp_enqueue_media(); wp_enqueue_style( "aytias-dashboard-style", get_template_directory_uri() . '/inc/dashboard/css/style.css', array(), $this->theme_version ); wp_enqueue_script( "aytias-dashboard-script", get_template_directory_uri() . '/inc/dashboard/js/script.js', array( 'jquery' ), $this->theme_version, true ); $localize_script = array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'ajax-nonce' ), 'domain' => get_home_url( '/' ) ); wp_localize_script( "aytias-dashboard-script", 'UNFOLDDASHBOARD', $localize_script ); } } /** * Callback for AJAX dismiss. * * @since 1.0.1 */ public function dismiss_callback() { $output = array(); $output['status'] = false; $userid = ( isset( $_GET['userid'] ) ) ? esc_attr( wp_unslash( $_GET['userid'] ) ) : ''; $wpnonce = ( isset( $_GET['_wpnonce'] ) ) ? esc_attr( wp_unslash( $_GET['_wpnonce'] ) ) : ''; if ( false === wp_verify_nonce( $wpnonce, 'aytias_dismiss_nonce' ) ) { wp_send_json( $output ); } update_user_meta( $userid, 'aytias_dismiss_status', 1 ); $output['status'] = true; wp_send_json( $output ); } } }