theme_name = esc_html( 'Article Lite' ); $this->version = '2.0.0'; $this->demofile = include get_template_directory() . '/inc/admin/assets/demos.php'; //Add the theme page add_action( 'admin_menu', array( $this, 'add_theme_info_menu' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'theme_info_scripts' ) ); add_action( 'wp_ajax_article_lite_importer_plugin_action', array( $this, 'article_lite_importer_plugin_action' ) ); } /** * Enqueue scripts * */ function theme_info_scripts($hook) { if( $hook != "appearance_page_article-lite-info" ) { return; } wp_enqueue_style( 'article-lite-info', get_template_directory_uri() . '/inc/admin/assets/info-page.css', array(), '2.0.0', 'all' ); wp_enqueue_script( 'article-lite-info', get_template_directory_uri() . '/inc/admin/assets/info-page.js', array( 'jquery' ), '2.0.0', true ); wp_localize_script( 'article-lite-info', 'articleThememInfoObject', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), '_wpnonce' => wp_create_nonce( 'article-lite-theme-info-nonce' ) )); } /** * Register admin menu for theme info * */ function add_theme_info_menu() { $theme_info = add_theme_page( esc_html__( 'Article Lite Info', 'article-lite' ), esc_html__( 'Article Lite Info','article-lite' ), 'manage_options', 'article-lite-info.php', array( $this, 'info_page_callback' ) ); } /** * Theme info page callback * * renders the theme info structure */ function info_page_callback() { ?>

theme_name ). ' - ' . esc_attr( $this->version ); ?>

importer_status = $this->plugin_active_status('blazethemes-demo-importer/blazethemes-demo-importer.php'); switch( $this->importer_status ) { case 'inactive' : printf( esc_html__( 'Activate Blazethemes Demo Importer Now and Import any available demo in One Click', 'article-lite') . ' %s', '' ); break; case 'install' : printf( esc_html__( 'Install BlazeThemes Demo Importer and Import any available demo in One Click', 'article-lite') . ' %s', '' ); break; default: esc_html_e( 'All Ready for demo import!! Setup your site exactly like demo', 'article-lite' ); } ?>
theme_display_demos(); ?>
demofile) && !is_null($this->demofile) && !empty($this->demofile)) { $tags = array(); foreach ($this->demofile as $demo_slug => $demo_pack) { if (isset($demo_pack['tags']) && is_array($demo_pack['tags'])) { foreach ($demo_pack['tags'] as $key => $tag) { $tags[$key] = $tag; } } } asort($tags); if ( !empty( $tags ) ) { ?>
demofile as $demo_slug => $demo_pack) { $tags = $class = ''; if (isset($demo_pack['tags'])) { $tags = implode(' ', array_keys($demo_pack['tags'])); } $classes = $tags; $type = isset($demo_pack['type']) ? $demo_pack['type'] : 'free'; ?>

importer_status === 'active' ) { ?>
demofile) && !is_null($this->demofile)) { foreach ($this->demofile as $demo_slug => $demo_pack) { ?>
ajax_response['status'] = true; $this->ajax_response['message'] = esc_html__( 'Demo importer plugin activated', 'article-lite' ); $this->send_ajax_response(); } else if( $_plugin_action === 'install' ) { $download_link = esc_url( 'demo.blazethemes.com/blazethemes-demo-importer/blazethemes-demo-importer.zip' ); // Include required libs for installation require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php'; require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php'; $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Plugin_Upgrader($skin); $upgrader->install( $download_link ); activate_plugin( $file_path, '', false, true ); $this->ajax_response['status'] = true; $this->ajax_response['message'] = esc_html__( 'Demo importer plugin installed and activated', 'article-lite' ); $this->send_ajax_response(); } $this->ajax_response['status'] = false; $this->ajax_response['message'] = esc_html__( 'Error while trying to install or active the plugin.', 'article-lite' ); $this->send_ajax_response(); } public function send_ajax_response() { $json = wp_json_encode( $this->ajax_response ); echo $json; die(); } } Article_Lite_Theme_Info::instance(); endif;