esc_url(admin_url('/themes.php?page=blogarc&tab=starter-templates')), 'btn_text' => esc_html__('Processing...', 'blogarc'), 'nonce' => wp_create_nonce('blogarc_demo_import_nonce'), 'admin_url' => esc_url(admin_url()), 'ajaxurl' => admin_url('admin-ajax.php'), // Include this line for using admin-ajax.php ); wp_localize_script('blogarc-plugin-install-helper', 'ogAdminObject', $welcome_data); } public function show_welcome_notice() { if (!get_option('blogarc_admin_notice_welcome')) { add_action('admin_notices', function () { $screen = get_current_screen(); if (in_array($screen->id, ['dashboard', 'plugins', 'themes'], true)) { remove_all_actions('admin_notices'); $this->render_welcome_notice(); } }); } } private function get_import_button_html() { return sprintf( '%s', esc_attr('mailchimp-for-wp, contact-form-7, one-click-demo-import'), esc_attr('mailchimp-for-wp, contact-form-7, one-click-demo-import'), esc_attr__('Start with ', 'blogarc') . esc_html($this->theme_name), esc_html__('Start with ', 'blogarc') . esc_html($this->theme_name), ); } public function render_welcome_notice() { $dismiss_url = wp_nonce_url( remove_query_arg(['activated'], add_query_arg('blogarc-hide-notice', 'welcome')), 'blogarc_hide_notices_nonce', '_blogarc_notice_nonce' ); $current_user = wp_get_current_user(); $theme = wp_get_theme(); $this->theme_name = $theme->get('Name'); $this->theme_version = $theme->get('Version'); $this->theme_slug = $theme->get_template(); if (!is_child_theme()) { $this->theme_screenshot = get_template_directory_uri() . "/screenshot.png"; } else { $this->theme_screenshot = get_stylesheet_directory_uri() . "/screenshot.png"; } if (is_plugin_active('mailchimp-for-wp/mailchimp-for-wp.php') && is_plugin_active('contact-form-7/wp-contact-form-7.php') && is_plugin_active('one-click-demo-import/one-click-demo-import.php')) { return; } ?>

theme_name) ); ?>

' . esc_html__( 'Hello %1$s!', 'blogarc' ) . ' ' . esc_html__( 'Thank you for activating %2$s! We’re thrilled to have you on board and can’t wait to see how you bring your website to life with our theme.', 'blogarc' ), esc_html($current_user->user_login), esc_html($this->theme_name) ); ?>

' . esc_html__('Help and Support Center', 'blogarc') . '' ); ?>

%1$s and its features to clear any doubts.', 'blogarc'), $this->theme_name); ?>

admin_url('/themes.php?page=blogarc-dashboard&tab=dashboard')]; foreach (['mailchimp-for-wp','contact-form-7' ,'one-click-demo-import'] as $plugin) { if (isset($state[$plugin]) && ('activated' === $state[$plugin] || 'installed' === $state[$plugin])) { if (current_user_can('activate_plugin')) { $result = activate_plugin($plugin . '/' . $plugin . '.php'); if (is_wp_error($result)) { $response['errorCode'] = $result->get_error_code(); $response['errorMessage'] = $result->get_error_message(); } } } else { wp_enqueue_style('plugin-install'); wp_enqueue_script('plugin-install'); include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $api = plugins_api('plugin_information', ['slug' => $plugin, 'fields' => ['sections' => false]]); $upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin()); $result = $upgrader->install($api->download_link); if ($result && current_user_can('activate_plugin')) { $result = activate_plugin($plugin . '/' . $plugin . '.php'); if (is_wp_error($result)) { $response['errorCode'] = $result->get_error_code(); $response['errorMessage'] = $result->get_error_message(); } } } } wp_send_json($response); } } new Blogarc_Welcome_Notice();