theme_screenshot = get_template_directory_uri()."/screenshot.png"; } else { $this->theme_screenshot = get_stylesheet_directory_uri()."/screenshot.png"; } $this->theme_name = $theme->get( 'Name' ); } /** * Localize array for import button AJAX request. */ public function articlewave_enqueue_scripts() { wp_enqueue_style( 'articlewave-admin-style', get_template_directory_uri() . '/inc/admin/assets/css/admin.css', array(), ARTICLEWAVE_VERSION ); wp_enqueue_script( 'articlewave-plugin-install-helper', get_template_directory_uri() . '/inc/admin/assets/js/plugin-handle.js', array( 'jquery' ), ARTICLEWAVE_VERSION ); $demo_importer_plugin = WP_PLUGIN_DIR . '/mysterythemes-demo-importer/mysterythemes-demo-importer.php'; if ( ! file_exists( $demo_importer_plugin ) ) { $action = 'install'; } elseif ( file_exists( $demo_importer_plugin ) && !is_plugin_active( 'mysterythemes-demo-importer/mysterythemes-demo-importer.php' ) ) { $action = 'activate'; } else { $action = 'redirect'; } wp_localize_script( 'articlewave-plugin-install-helper', 'ogAdminObject', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), '_wpnonce' => wp_create_nonce( 'articlewave_plugin_install_nonce' ), 'buttonStatus' => esc_html( $action ) ) ); } /** * Add admin welcome notice. */ public function articlewave_welcome_notice() { if ( isset( $_GET['activated'] ) ) { update_option( 'articlewave_admin_notice_welcome', true ); } $welcome_notice_option = get_option( 'articlewave_admin_notice_welcome' ); // Let's bail on theme activation. if ( $welcome_notice_option ) { add_action( 'admin_notices', array( $this, 'articlewave_welcome_notice_html' ) ); } } /** * Hide a notice if the GET variable is set. */ public static function articlewave_hide_welcome_notices() { if ( isset( $_GET['articlewave-hide-welcome-notice'] ) && isset( $_GET['_articlewave_welcome_notice_nonce'] ) ) { if ( ! wp_verify_nonce( $_GET['_articlewave_welcome_notice_nonce'], 'articlewave_hide_welcome_notices_nonce' ) ) { wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'articlewave' ) ); } if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Cheat in ’ huh?', 'articlewave' ) ); } $hide_notice = sanitize_text_field( $_GET['articlewave-hide-welcome-notice'] ); update_option( 'articlewave_admin_notice_' . $hide_notice, false ); } } /** * function to display welcome notice section */ public function articlewave_welcome_notice_html() { $current_screen = get_current_screen(); if ( $current_screen->id !== 'dashboard' && $current_screen->id !== 'themes' ) { return; } ?>
theme_name ); ?>