<?php
/**
 * @package Demo Import
 * @since 1.0.0
 */

class ThemeWhizzie {

	protected $version = '1.1.0';

	/** @var string Current theme name, used as namespace in actions. */
	protected $theme_name = '';
	protected $theme_title = '';

	/** @var string Demo Import page slug and title. */
	protected $page_slug = '';
	protected $page_title = '';

	/** @var array Demo Import steps set by user. */
	protected $config_steps = array();
	public $parent_slug;
	/**
	 * Constructor
	 *
	 * @param $surgical_hospital_config	Our config parameters
	*/
	public function __construct( $surgical_hospital_config ) {
		$this->set_vars( $surgical_hospital_config );
		$this->init();
	}

	/**
	 * Set some settings
	 * @since 1.0.0
	 * @param $surgical_hospital_config	Our config parameters
	*/
	public function set_vars( $surgical_hospital_config ) {
		if( isset( $surgical_hospital_config['page_slug'] ) ) {
			$this->page_slug = esc_attr( $surgical_hospital_config['page_slug'] );
		}
		if( isset( $surgical_hospital_config['page_title'] ) ) {
			$this->page_title = esc_attr( $surgical_hospital_config['page_title'] );
		}
		if( isset( $surgical_hospital_config['steps'] ) ) {
			$this->config_steps = $surgical_hospital_config['steps'];
		}

		$current_theme = wp_get_theme();
		$this->theme_title = $current_theme->get( 'Name' );
		$this->theme_name = strtolower( preg_replace( '#[^a-zA-Z]#', '', $current_theme->get( 'Name' ) ) );
		$this->page_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_page_slug', $this->theme_name . '-demoimport' );
		$this->parent_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_parent_slug', '' );
	}

	/**
	 * Hooks and filters
	 * @since 1.0.0
	*/
	public function init() {
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
		add_action( 'admin_menu', array( $this, 'menu_page' ) );
		add_action( 'wp_ajax_setup_widgets', array( $this, 'setup_widgets' ) );
	}
	
	public function enqueue_scripts() {
		wp_enqueue_style( 'demo-import-style', get_template_directory_uri() . '/demo-import/assets/css/demo-import-style.css');
		wp_register_script( 'demo-import-script', get_template_directory_uri() . '/demo-import/assets/js/demo-import-script.js', array( 'jquery' ), time() );
		wp_localize_script(
			'demo-import-script',
			'surgical_hospital_whizzie_params',
			array(
				'ajaxurl' 		=> admin_url( 'admin-ajax.php' ),
				'wpnonce' 		=> wp_create_nonce( 'whizzie_nonce' ),
				'verify_text'	=> esc_html( 'verifying', 'surgical-hospital' )
			)
		);
		wp_enqueue_script( 'demo-import-script' );
	}

	/**  Make a modal screen for the wizard **/
	public function menu_page() {
		add_menu_page( esc_html( $this->page_title ), esc_html( $this->page_title ), 'manage_options', $this->page_slug, array( $this, 'surgical_hospital_guide' ) ,'',40);
	}

	/** Make an interface for the wizard **/
	public function wizard_page() {
		/* If we arrive here, we have the filesystem */ ?>
		<div class="wrap">
			<?php echo '<div class="whizzie-wrap">';
				// The wizard is a list with only one item visible at a time
				$steps = $this->get_steps();
				echo '<ul class="whizzie-nav wizard-icon-nav">';?>
				<?php
					$stepI=1;
					foreach( $steps as $step ) {
						$stepAct=($stepI ==1)? 1 : 0;
						if( isset( $step['icon_text'] ) && $step['icon_text'] ) {
							echo '<li class="commom-cls nav-step-' . esc_attr( $step['id'] ) . '" wizard-steps="step-'.esc_attr( $step['id'] ).'" data-enable="'.$stepAct.'">
							<p>'.esc_attr( $step['icon_text'] ).'</p>
							</li>';
						}
					$stepI++;}
			 	echo '</ul>';
				echo '<ul class="whizzie-menu wizard-menu-page">';
				foreach( $steps as $step ) {
					$class = 'step step-' . esc_attr( $step['id'] );
					echo '<li data-step="' . esc_attr( $step['id'] ) . '" class="' . esc_attr( $class ) . '" >';
						$content = call_user_func( array( $this, $step['view'] ) );
						printf('<div class="wizard-button-wrapper">');
							if( isset( $step['button_text_one'] )) {
								printf(
									'<div class="button-wrap button-wrap-one">
										<a href="#" class="button button-primary do-it" data-callback="install_widgets" data-step="widgets"><p class="demo-type-text">%s</p></a>
									</div>',
									esc_html( $step['button_text_one'] )
								);
							}
						printf('</div>');
					echo '</li>';
				}
				echo '</ul>';
				?>
				<div class="step-loading"><span class="spinner">
					<img src="<?php echo esc_url(get_template_directory_uri().'/demo-import/assets/images/Spinner-Animaion.gif'); ?>">
				</span></div>
			<?php echo '</div>';?>
		</div>
	<?php }

	/**
	 * Set options for the steps
	 * @return Array
	*/
	public function get_steps() {

		if ( get_option('surgical_hospital_demo_imported') ) {
			return array(
				'done' => array(
					'id'        => 'done',
					'title'     => __( 'All Done', 'surgical-hospital' ),
					'icon'      => 'yes',
					'view'      => 'get_step_done',
					'callback'  => '',
					'icon_text' => 'View Site'
				)
			);
		}

		$dev_steps = $this->config_steps;
		$steps = array(
			'widgets' => array(
				'id'			=> 'widgets',
				'title'			=> __( 'Customizer', 'surgical-hospital' ),
				'icon'			=> 'welcome-widgets-menus',
				'view'			=> 'get_step_widgets',
				'callback'		=> 'install_widgets',
				'button_text_one'	=> __( 'Import Demo', 'surgical-hospital' ),
				'can_skip'		=> true,
				'icon_text'      => 'Import Demo'
			),
			'done' => array(
				'id'			=> 'done',
				'title'			=> __( 'All Done', 'surgical-hospital' ),
				'icon'			=> 'yes',
				'view'			=> 'get_step_done',
				'callback'		=> '',
				'icon_text'      => 'Done'
			)
		);
		// Iterate through each step and replace with dev config values
		if( $dev_steps ) {
			// Configurable elements - these are the only ones the dev can update from config.php
			$can_config = array( 'title', 'icon', 'button_text', 'can_skip' );
			foreach( $dev_steps as $dev_step ) {
				// We can only proceed if an ID exists and matches one of our IDs
				if( isset( $dev_step['id'] ) ) {
					$id = $dev_step['id'];
					if( isset( $steps[$id] ) ) {
						foreach( $can_config as $element ) {
							if( isset( $dev_step[$element] ) ) {
								$steps[$id][$element] = $dev_step[$element];
							}
						}
					}
				}
			}
		}
		return $steps;
	}

	/**    Print the content for the intro step     **/
		public function get_step_importer() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('Thank you for choosing this Surgical Hospital Theme. Using this quick setup wizard, you will be able to configure your new website and get it running in just a few minutes. Just follow these simple steps mentioned in the wizard and get started with your website.','surgical-hospital'); ?>
			</p>
		</div>
	<?php }

	/**   Print the content for the widgets step   **/
	public function get_step_widgets() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('This theme allows you to import demo content and add widgets. Install them using the button below. You can also update or deactivate them using the Customizer.','surgical-hospital'); ?>
			</p>
		</div>
	<?php }

	/** Print the content for the final step **/
	public function get_step_done() { ?>

		<div class="setup-finish">
			<p>
				<?php echo esc_html('Your demo content has been imported successfully. Click the finish button for more information.'); ?>
			</p>
			<div class="finish-buttons">
				<a href="<?php echo esc_url( admin_url( 'themes.php?page=surgical-hospital-getstart-page' ) ); ?>" class="wz-btn-customizer" target="_blank"><?php esc_html_e('About Surgical Hospital','surgical-hospital') ?></a>
				<a href="<?php echo esc_url(admin_url('/customize.php')); ?>" class="wz-btn-customizer" target="_blank"><?php esc_html_e('Customize Your Demo','surgical-hospital') ?></a>
				<a href="<?php echo esc_url(home_url()); ?>" class="wz-btn-visit-site" target="_blank"><?php esc_html_e('Visit Your Site','surgical-hospital'); ?></a>
			</div>
			<div class="finish-buttons">
				<a href="<?php echo esc_url(admin_url()); ?>" class="button button-primary"><?php esc_html_e('Finish','surgical-hospital'); ?></a>
			</div>
		</div>

	<?php }


	public function surgical_hospital_customizer_nav_menu() {
		// ------- Create Primary Menu --------
		$surgical_hospital_themename = 'Surgical Hospital'; // Ensure the theme name is set
		$surgical_hospital_menuname = $surgical_hospital_themename . ' Primary Menu';
		$surgical_hospital_menulocation = 'menu-1';
		$surgical_hospital_menu_exists = wp_get_nav_menu_object($surgical_hospital_menuname);

		if (!$surgical_hospital_menu_exists) {
			$surgical_hospital_menu_id = wp_create_nav_menu($surgical_hospital_menuname);

			// Home
			wp_update_nav_menu_item($surgical_hospital_menu_id, 0, array(
				'menu-item-title' => __('Home', 'surgical-hospital'),
				'menu-item-classes' => 'home',
				'menu-item-url' => home_url('/'),
				'menu-item-status' => 'publish'
			));

			// About
			$surgical_hospital_page_about = get_page_by_path('about');
			if($surgical_hospital_page_about){
				wp_update_nav_menu_item($surgical_hospital_menu_id, 0, array(
					'menu-item-title' => __('About', 'surgical-hospital'),
					'menu-item-classes' => 'about',
					'menu-item-url' => get_permalink($surgical_hospital_page_about),
					'menu-item-status' => 'publish'
				));
			}

			// Services
			$surgical_hospital_page_services = get_page_by_path('services');
			if($surgical_hospital_page_services){
				wp_update_nav_menu_item($surgical_hospital_menu_id, 0, array(
					'menu-item-title' => __('Services', 'surgical-hospital'),
					'menu-item-classes' => 'services',
					'menu-item-url' => get_permalink($surgical_hospital_page_services),
					'menu-item-status' => 'publish'
				));
			}

			// Blog
			$surgical_hospital_page_blog = get_page_by_path('blog');
			if($surgical_hospital_page_blog){
				wp_update_nav_menu_item($surgical_hospital_menu_id, 0, array(
					'menu-item-title' => __('Blog', 'surgical-hospital'),
					'menu-item-classes' => 'blog',
					'menu-item-url' => get_permalink($surgical_hospital_page_blog),
					'menu-item-status' => 'publish'
				));
			}

			// Contact Us
			$surgical_hospital_page_contact = get_page_by_path('contact');
			if($surgical_hospital_page_contact){
				wp_update_nav_menu_item($surgical_hospital_menu_id, 0, array(
					'menu-item-title' => __('Contact Us', 'surgical-hospital'),
					'menu-item-classes' => 'contact',
					'menu-item-url' => get_permalink($surgical_hospital_page_contact),
					'menu-item-status' => 'publish'
				));
			}

			// Assign menu to location if not set
			if (!has_nav_menu($surgical_hospital_menulocation)) {
				$surgical_hospital_locations = get_theme_mod('nav_menu_locations');
				$surgical_hospital_locations[$surgical_hospital_menulocation] = $surgical_hospital_menu_id; // Use $surgical_hospital_menu_id here
				set_theme_mod('nav_menu_locations', $surgical_hospital_locations);
			}
		}
	}

	public function surgical_hospital_social_menu() {

		// ------- Create Social Menu --------
		$surgical_hospital_menuname = $surgical_hospital_themename . 'Social Menu';
		$surgical_hospital_menulocation = 'social-menu';
		$surgical_hospital_menu_exists = wp_get_nav_menu_object( $surgical_hospital_menuname );

		if( !$surgical_hospital_menu_exists){
			$surgical_hospital_menu_id = wp_create_nav_menu($surgical_hospital_menuname);

			wp_update_nav_menu_item( $surgical_hospital_menu_id, 0, array(
				'menu-item-title'  => __( 'Facebook', 'surgical-hospital' ),
				'menu-item-url'    => 'https://www.facebook.com',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $surgical_hospital_menu_id, 0, array(
				'menu-item-title'  => __( 'Pinterest', 'surgical-hospital' ),
				'menu-item-url'    => 'https://www.pinterest.com',
				'menu-item-status' => 'publish',
			) );
	
			wp_update_nav_menu_item( $surgical_hospital_menu_id, 0, array(
				'menu-item-title'  => __( 'Twitter', 'surgical-hospital' ),
				'menu-item-url'    => 'https://www.twitter.com',
				'menu-item-status' => 'publish',
			) );
	
			wp_update_nav_menu_item( $surgical_hospital_menu_id, 0, array(
				'menu-item-title'  => __( 'Youtube', 'surgical-hospital' ),
				'menu-item-url'    => 'https://www.youtube.com',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $surgical_hospital_menu_id, 0, array(
				'menu-item-title'  => __( 'Instagram', 'surgical-hospital' ),
				'menu-item-url'    => 'https://www.instagram.com',
				'menu-item-status' => 'publish',
			) );

			if( !has_nav_menu( $surgical_hospital_menulocation ) ){
					$locations = get_theme_mod('nav_menu_locations');
					$locations[$surgical_hospital_menulocation] = $surgical_hospital_menu_id;
					set_theme_mod( 'nav_menu_locations', $locations );
			}
		}
	}

	/**
	* Imports the Demo Content
	* @since 1.1.0
	*/
	public function setup_widgets() {

		//................................................. MENU PAGES .................................................//
		
		$surgical_hospital_home_id='';
		$surgical_hospital_home_content = '';

		$surgical_hospital_home_title = 'Home';
		$surgical_hospital_home = array(
				'post_type' => 'page',
				'post_title' => $surgical_hospital_home_title,
				'post_content'  => $surgical_hospital_home_content,
				'post_status' => 'publish',
				'post_author' => 1,
				'post_slug' => 'home'
		);
		$surgical_hospital_home_id = wp_insert_post($surgical_hospital_home);

		//Set the home page template
		add_post_meta( $surgical_hospital_home_id, '_wp_page_template', 'revolution-home.php' );

		//Set the static front page
		$surgical_hospital_home = get_page_by_title( 'Home' );
		update_option( 'page_on_front', $surgical_hospital_home->ID );
		update_option( 'show_on_front', 'page' );


		// Create a posts page and assign the template
		$surgical_hospital_blog_title = 'Blog';
		$surgical_hospital_blog_check = get_page_by_path('blog');
		if (!$surgical_hospital_blog_check) {
			$surgical_hospital_blog = array(
				'post_type'    => 'page',
				'post_title'   => $surgical_hospital_blog_title,
				'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'blog' // Unique slug for the blog page
			);
			$surgical_hospital_blog_id = wp_insert_post($surgical_hospital_blog);

			// Set the posts page
			if (!is_wp_error($surgical_hospital_blog_id)) {
				update_option('page_for_posts', $surgical_hospital_blog_id);
			}
		}

		// Create a Contact Us page and assign the template
		$surgical_hospital_contact_title = 'Contact Us';
		$surgical_hospital_contact_check = get_page_by_path('contact');
		if (!$surgical_hospital_contact_check) {
			$surgical_hospital_contact = array(
				'post_type'    => 'page',
				'post_title'   => $surgical_hospital_contact_title,
				'post_content'   => '"More About The Free Surgical Hospital Theme"
										The Free Surgical Hospital WordPress Theme is an ideal solution for a diverse range of healthcare institutions such as emergency hospitals, maternity hospitals, rehabilitation hospitals, and specialty centers. Designed with a digital-first approach in mind, it offers a clean, user-friendly interface that helps hospitals streamline online communication and showcase their services effectively. With built-in sections for hospital departments, outpatient services, appointment forms, and emergency contacts, it enhances the overall patient experience. Additionally, the theme supports showcasing key accreditations like NABH or ISO, boosting credibility and trust among prospective patients. Whether you\'re a multi-specialty hospital or a private clinic aiming to expand your online reach, the Free Surgical Hospital WordPress Theme delivers a responsive, professional, and modern design to position you as a top-rated hospital in your city.

										Whether it\'s a public hospital, a private medical center, an advanced heart hospital, or a specialized neurological or cancer hospital, the Free Surgical Hospital WordPress Theme can be customized to meet diverse needs. The layout includes flexible sections dedicated to different hospital departments, allowing you to highlight services like ICU, NICU, emergency rooms, diagnostic labs, maternity care, or rehabilitation programs. For facilities offering both inpatient and outpatient services, it supports hospital booking systems, patient admission forms, discharge details, and emergency contact information. Hospitals can also use it to publish surgery schedules, display consultation availability, promote health packages, and outline hospital charges in a clear, user-friendly way. This results in a digital experience that builds trust, improves hospital visibility, and creates a seamless, patient-focused online presence.

										The visual aesthetics of the Free Surgical Hospital WordPress Theme are crafted to reflect the cleanliness, trust, and professionalism that patients expect from a medical institution’s website. The design incorporates soft, calming color tones combined with modern hospital design elements, clean typography, and sophisticated iconography that give the site a polished yet welcoming appearance. The theme also supports eco-conscious hospitals by offering space to highlight green certifications, sustainability initiatives, and include sections for hospital fundraising and charity drives. Whether you represent a public hospital or a specialized medical center, this theme enhances your reputation through strong design and structured content. Built-in SEO optimization, mobile responsiveness, and fast-loading pages ensure that your digital presence is accessible, visible, and user-friendly on every device—creating a seamless, modern experience for patients and visitors alike.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'contact' // Unique slug for the Contact Us page
			);
			wp_insert_post($surgical_hospital_contact);
		}

		// Create a About page and assign the template
		$surgical_hospital_about_title = 'About';
		$surgical_hospital_about_check = get_page_by_path('about');
		if (!$surgical_hospital_about_check) {
			$surgical_hospital_about = array(
				'post_type'    => 'page',
				'post_title'   => $surgical_hospital_about_title,
				'post_content'   => '"More About The Free Surgical Hospital Theme"
										The Free Surgical Hospital WordPress Theme is an ideal solution for a diverse range of healthcare institutions such as emergency hospitals, maternity hospitals, rehabilitation hospitals, and specialty centers. Designed with a digital-first approach in mind, it offers a clean, user-friendly interface that helps hospitals streamline online communication and showcase their services effectively. With built-in sections for hospital departments, outpatient services, appointment forms, and emergency contacts, it enhances the overall patient experience. Additionally, the theme supports showcasing key accreditations like NABH or ISO, boosting credibility and trust among prospective patients. Whether you\'re a multi-specialty hospital or a private clinic aiming to expand your online reach, the Free Surgical Hospital WordPress Theme delivers a responsive, professional, and modern design to position you as a top-rated hospital in your city.

										Whether it\'s a public hospital, a private medical center, an advanced heart hospital, or a specialized neurological or cancer hospital, the Free Surgical Hospital WordPress Theme can be customized to meet diverse needs. The layout includes flexible sections dedicated to different hospital departments, allowing you to highlight services like ICU, NICU, emergency rooms, diagnostic labs, maternity care, or rehabilitation programs. For facilities offering both inpatient and outpatient services, it supports hospital booking systems, patient admission forms, discharge details, and emergency contact information. Hospitals can also use it to publish surgery schedules, display consultation availability, promote health packages, and outline hospital charges in a clear, user-friendly way. This results in a digital experience that builds trust, improves hospital visibility, and creates a seamless, patient-focused online presence.

										The visual aesthetics of the Free Surgical Hospital WordPress Theme are crafted to reflect the cleanliness, trust, and professionalism that patients expect from a medical institution’s website. The design incorporates soft, calming color tones combined with modern hospital design elements, clean typography, and sophisticated iconography that give the site a polished yet welcoming appearance. The theme also supports eco-conscious hospitals by offering space to highlight green certifications, sustainability initiatives, and include sections for hospital fundraising and charity drives. Whether you represent a public hospital or a specialized medical center, this theme enhances your reputation through strong design and structured content. Built-in SEO optimization, mobile responsiveness, and fast-loading pages ensure that your digital presence is accessible, visible, and user-friendly on every device—creating a seamless, modern experience for patients and visitors alike.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'about' // Unique slug for the About page
			);
			wp_insert_post($surgical_hospital_about);
		}

		// Create a Services page and assign the template
		$surgical_hospital_services_title = 'Services';
		$surgical_hospital_services_check = get_page_by_path('services');
		if (!$surgical_hospital_services_check) {
			$surgical_hospital_services = array(
				'post_type'    => 'page',
				'post_title'   => $surgical_hospital_services_title,
				'post_content'   => '"More About The Free Surgical Hospital Theme"
										The Free Surgical Hospital WordPress Theme is an ideal solution for a diverse range of healthcare institutions such as emergency hospitals, maternity hospitals, rehabilitation hospitals, and specialty centers. Designed with a digital-first approach in mind, it offers a clean, user-friendly interface that helps hospitals streamline online communication and showcase their services effectively. With built-in sections for hospital departments, outpatient services, appointment forms, and emergency contacts, it enhances the overall patient experience. Additionally, the theme supports showcasing key accreditations like NABH or ISO, boosting credibility and trust among prospective patients. Whether you\'re a multi-specialty hospital or a private clinic aiming to expand your online reach, the Free Surgical Hospital WordPress Theme delivers a responsive, professional, and modern design to position you as a top-rated hospital in your city.

										Whether it\'s a public hospital, a private medical center, an advanced heart hospital, or a specialized neurological or cancer hospital, the Free Surgical Hospital WordPress Theme can be customized to meet diverse needs. The layout includes flexible sections dedicated to different hospital departments, allowing you to highlight services like ICU, NICU, emergency rooms, diagnostic labs, maternity care, or rehabilitation programs. For facilities offering both inpatient and outpatient services, it supports hospital booking systems, patient admission forms, discharge details, and emergency contact information. Hospitals can also use it to publish surgery schedules, display consultation availability, promote health packages, and outline hospital charges in a clear, user-friendly way. This results in a digital experience that builds trust, improves hospital visibility, and creates a seamless, patient-focused online presence.

										The visual aesthetics of the Free Surgical Hospital WordPress Theme are crafted to reflect the cleanliness, trust, and professionalism that patients expect from a medical institution’s website. The design incorporates soft, calming color tones combined with modern hospital design elements, clean typography, and sophisticated iconography that give the site a polished yet welcoming appearance. The theme also supports eco-conscious hospitals by offering space to highlight green certifications, sustainability initiatives, and include sections for hospital fundraising and charity drives. Whether you represent a public hospital or a specialized medical center, this theme enhances your reputation through strong design and structured content. Built-in SEO optimization, mobile responsiveness, and fast-loading pages ensure that your digital presence is accessible, visible, and user-friendly on every device—creating a seamless, modern experience for patients and visitors alike.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'services' // Unique slug for the Services page
			);
			wp_insert_post($surgical_hospital_services);
		}


		// ------------------------------------------ Sections -------------------------------------- //

			set_theme_mod('surgical_hospital_projetcs_sec_show',1);
			set_theme_mod('surgical_hospital_enable_slider',1);
			set_theme_mod('surgical_hospital_enable_slider',true);
			

		// ------------------------------------------ Slider Section -------------------------------------- //

			for($surgical_hospital_i=1;$surgical_hospital_i<=3;$surgical_hospital_i++){
				set_theme_mod( 'surgical_hospital_slider_image'.$surgical_hospital_i,get_template_directory_uri().'/revolution/assets/images/slider'.$surgical_hospital_i.'.png' );
				set_theme_mod( 'surgical_hospital_slider_heading'.$surgical_hospital_i, 'The Hospital You Trust To Care For Those You Love' );
				set_theme_mod( 'surgical_hospital_slider_text'.$surgical_hospital_i, 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.' );
				set_theme_mod( 'surgical_hospital_slider_button1_text'.$surgical_hospital_i, 'CONTACT US' );
				set_theme_mod( 'surgical_hospital_slider_button2_text'.$surgical_hospital_i, 'OUR SERVICES' );
				set_theme_mod( 'surgical_hospital_slider_button1_link'.$surgical_hospital_i, '#' );
				set_theme_mod( 'surgical_hospital_slider_button2_link'.$surgical_hospital_i, '#' );
			}

		// ------------------------------------------ Hospital Section -------------------------------------- //

			set_theme_mod('surgical_hospital_projetcs_main_text','Feature\'s Gallery');
			set_theme_mod('surgical_hospital_projetcs_main_heading','Latest Case Studies');

			$tab_title=array('All Cases','Surgery','Neurology','Cardiology','Dermatology','Orthopedic');
			for($i=1;$i<=6;$i++) {
				set_theme_mod( 'surgical_hospital_projetcs_text'.$i, $tab_title[$i-1] );
			}

			wp_delete_post(1);
			$blog_title = array(
				'Complete Surgery 1',
				'Complete Surgery 2',
				'Complete Surgery 3',
				'Complete Surgery 4',
				'Complete Surgery 5',
				'Complete Surgery 6',
			);
			for($i=1;$i<=6;$i++){
				$title =$blog_title[$i-1];
				$content = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.';

				// Create post object
				$my_post = array(
					'post_title'    => wp_strip_all_tags( $title ),
					'post_content'  => $content,
					'post_status'   => 'publish',
					'post_type'     => 'post',
				);

				// Insert the post into the database
				$post_id = wp_insert_post( $my_post );

				$image_url = get_template_directory_uri().'/revolution/assets/images/blogs'.$i.'.png';

				$image_name= 'blogs'.$i.'.png';
				$upload_dir       = wp_upload_dir();
				// Set upload folder
				$image_data       = file_get_contents($image_url);
				// Get image data
				$unique_file_name = wp_unique_filename( $upload_dir['path'], $image_name );
				// Generate unique name
				$filename= basename( $unique_file_name );
				// Create image file name
				// Check folder permission and define file location
				if( wp_mkdir_p( $upload_dir['path'] ) ) {
					$file = $upload_dir['path'] . '/' . $filename;
				} else {
					$file = $upload_dir['basedir'] . '/' . $filename;
				}
				// Create the image  file on the server
				if ( ! function_exists( 'WP_Filesystem' ) ) {
					require_once( ABSPATH . 'wp-admin/includes/file.php' );
				}

				WP_Filesystem();
				global $wp_filesystem;

				if ( ! $wp_filesystem->put_contents( $file, $image_data, FS_CHMOD_FILE ) ) {
					wp_die( 'Error saving file!' );
				}
				// Check image file type
				$wp_filetype = wp_check_filetype( $filename, null );
				// Set attachment data
				$attachment = array(
				'post_mime_type' => $wp_filetype['type'],
				'post_title'     => sanitize_file_name( $filename ),
				'post_content'   => '',
				'post_type'     => 'post',
				'post_status'    => 'inherit'
				);
				// Create the attachment
				$attach_id = wp_insert_attachment( $attachment, $file, $post_id );
				// Include image.php
				require_once(ABSPATH . 'wp-admin/includes/image.php');
				// Define attachment metadata
				$attach_data = wp_generate_attachment_metadata( $attach_id, $file );
				// Assign metadata to attachment
				wp_update_attachment_metadata( $attach_id, $attach_data );
				// And finally assign featured image to post
				set_post_thumbnail( $post_id, $attach_id );
			}


  	 	$this->surgical_hospital_customizer_nav_menu();
  	 	$this->surgical_hospital_social_menu();
		update_option('surgical_hospital_demo_imported', true);
	}

	public function surgical_hospital_guide() {
		$display_string = '';
		$return = add_query_arg( array()) ;
		$theme = wp_get_theme( 'surgical-hospital' );
		?>
		<div class="wrapper-info get-stared-page-wrap">
			<div class="wrapper-info-content">
				<div class="buynow__">
					<h2><?php esc_html_e( 'Welcome to Surgical Hospital', 'surgical-hospital' ); ?> <span class="version">Version: <?php echo esc_html($theme['Version']);?></span></h2>
					<p><?php esc_html_e('The quick setup wizard will assist you in configuring your new website. This wizard will import the demo content.', 'surgical-hospital'); ?></p>
				</div>
				<div class="buynow_">
					<a target="_blank" class="buynow_themepage" href="<?php echo esc_url('https://www.revolutionwp.com/products/hospital-wordpress-theme'); ?>"><?php echo esc_html__('Go Premium Now', 'surgical-hospital'); ?></a>
				</div>
			</div>
			<div class="tab-sec theme-option-tab">
				<div id="demo_offer" class="tabcontent open">
					<?php $this->wizard_page(); ?>
				</div>
			</div>
		</div>
	<?php }
}