theme_name = $theme->Name; $this->theme_version = $theme->Version; /* Enqueue Styles & Scripts for Welcome Page */ add_action('admin_enqueue_scripts', array($this, 'welcome_styles_and_scripts')); /* Hide Notice */ add_filter('wp_loaded', array($this, 'hide_admin_notice'), 10); /* Create a Welcome Page */ add_action('wp_loaded', array($this, 'admin_notice'), 20); add_action('aspace_theme_name_after', array($this, 'aspace_theme_name')); add_action('aspace_theme_version_after', array($this, 'aspace_theme_version')); add_action('after_switch_theme', array($this, 'erase_hide_notice')); } public function aspace_theme_name() { $theme = wp_get_theme(); return $theme->name; } public function aspace_theme_version() { $theme = wp_get_theme(); return $theme->version; } /** Trigger Welcome Message Notification */ public function admin_notice() { $hide_notice = get_option('aspace_hide_notice'); if (!$hide_notice) { add_action('admin_notices', array($this, 'admin_notice_content')); } } /** Welcome Message Notification */ public function admin_notice_content() { $screen = get_current_screen(); if ('appearance_page_aspace-welcome' === $screen->id || (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) || 'theme-install' === $screen->id) { return; } $slug = $filename = 'aspace-demo-importer'; ?>
check_plugin_installed_state($slug, $filename) && !$this->check_plugin_active_state($slug, $filename)) { $import_class = 'button button-primary aspace-activate-plugin'; $import_button_text = esc_html__('Activate Demo Importer Plugin', 'aspace'); } elseif ($this->check_plugin_installed_state($slug, $filename)) { $import_class = 'button button-primary'; $import_button_text = esc_html__('Go to Demo Importer Page', 'aspace'); $import_url = admin_url('themes.php?page=hdi-demo-importer'); } else { $import_class = 'button button-primary'; $import_button_text = esc_html__('Install plugins', 'aspace'); } return '' . esc_html($import_button_text) . ''; } /** Check for Available Image */ public function image_exist($url = NULL) { if (!$url) return FALSE; $headers = get_headers($url); return stripos($headers[0], "200 OK") ? TRUE : FALSE; } public function erase_hide_notice() { delete_option('aspace_hide_notice'); } } new Aspace_Started(); endif;