<?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 $handyman_agency_config	Our config parameters
	*/
	public function __construct( $handyman_agency_config ) {
		$this->set_vars( $handyman_agency_config );
		$this->init();
	}

	/**
	 * Set some settings
	 * @since 1.0.0
	 * @param $handyman_agency_config	Our config parameters
	*/
	public function set_vars( $handyman_agency_config ) {
		if( isset( $handyman_agency_config['page_slug'] ) ) {
			$this->page_slug = esc_attr( $handyman_agency_config['page_slug'] );
		}
		if( isset( $handyman_agency_config['page_title'] ) ) {
			$this->page_title = esc_attr( $handyman_agency_config['page_title'] );
		}
		if( isset( $handyman_agency_config['steps'] ) ) {
			$this->config_steps = $handyman_agency_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',
			'handyman_agency_whizzie_params',
			array(
				'ajaxurl' 		=> admin_url( 'admin-ajax.php' ),
				'wpnonce' 		=> wp_create_nonce( 'whizzie_nonce' ),
				'verify_text'	=> esc_html( 'verifying', 'handyman-agency' )
			)
		);
		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, 'handyman_agency_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() {
		$dev_steps = $this->config_steps;
		$steps = array(
			'widgets' => array(
				'id'			=> 'widgets',
				'title'			=> __( 'Customizer', 'handyman-agency' ),
				'icon'			=> 'welcome-widgets-menus',
				'view'			=> 'get_step_widgets',
				'callback'		=> 'install_widgets',
				'button_text_one'	=> __( 'Import Demo', 'handyman-agency' ),
				'can_skip'		=> true,
				'icon_text'      => 'Import Demo'
			),
			'done' => array(
				'id'			=> 'done',
				'title'			=> __( 'All Done', 'handyman-agency' ),
				'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 Handyman Agency 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.','handyman-agency'); ?>
			</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.','handyman-agency'); ?>
			</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=handyman-agency-getstart-page' ) ); ?>" class="wz-btn-customizer" target="_blank"><?php esc_html_e('About Handyman Agency','handyman-agency') ?></a>
				<a href="<?php echo esc_url(admin_url('/customize.php')); ?>" class="wz-btn-customizer" target="_blank"><?php esc_html_e('Customize Your Demo','handyman-agency') ?></a>
				<a href="" class="wz-btn-builder" target="_blank"><?php esc_html_e('Customize Your Demo','handyman-agency'); ?></a>
				<a href="<?php echo esc_url(home_url()); ?>" class="wz-btn-visit-site" target="_blank"><?php esc_html_e('Visit Your Site','handyman-agency'); ?></a>
			</div>
			<div class="finish-buttons">
				<a href="<?php echo esc_url(admin_url()); ?>" class="button button-primary"><?php esc_html_e('Finish','handyman-agency'); ?></a>
			</div>
		</div>

	<?php }

	//................................................. MENUS .................................................//
		
	public function handyman_agency_customizer_nav_menu() {
		// ------- Create Primary Menu --------
		$handyman_agency_themename = 'Handyman Agency'; // Ensure the theme name is set
		$handyman_agency_menuname = $handyman_agency_themename . ' Primary Menu';
		$handyman_agency_menulocation = 'menu-1';
		$handyman_agency_menu_exists = wp_get_nav_menu_object($handyman_agency_menuname);

		if (!$handyman_agency_menu_exists) {
			$handyman_agency_menu_id = wp_create_nav_menu($handyman_agency_menuname);

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

			// About
			$handyman_agency_page_about = get_page_by_path('about');
			if($handyman_agency_page_about){
				wp_update_nav_menu_item($handyman_agency_menu_id, 0, array(
					'menu-item-title' => __('About', 'handyman-agency'),
					'menu-item-classes' => 'about',
					'menu-item-url' => get_permalink($handyman_agency_page_about),
					'menu-item-status' => 'publish'
				));
			}

			// Services
			$handyman_agency_page_services = get_page_by_path('services');
			if($handyman_agency_page_services){
				wp_update_nav_menu_item($handyman_agency_menu_id, 0, array(
					'menu-item-title' => __('Services', 'handyman-agency'),
					'menu-item-classes' => 'services',
					'menu-item-url' => get_permalink($handyman_agency_page_services),
					'menu-item-status' => 'publish'
				));
			}

			wp_update_nav_menu_item( $handyman_agency_menu_id, 0, array(
				'menu-item-title'  => __( 'Projects', 'handyman-agency' ),
				'menu-item-url'    => '#',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $handyman_agency_menu_id, 0, array(
				'menu-item-title'  => __( 'Pages', 'handyman-agency' ),
				'menu-item-url'    => '#',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $handyman_agency_menu_id, 0, array(
				'menu-item-title'  => __( 'Team', 'handyman-agency' ),
				'menu-item-url'    => '#',
				'menu-item-status' => 'publish',
			) );

			// Blog
			$handyman_agency_page_blog = get_page_by_path('blog');
			if($handyman_agency_page_blog){
				wp_update_nav_menu_item($handyman_agency_menu_id, 0, array(
					'menu-item-title' => __('Blog', 'handyman-agency'),
					'menu-item-classes' => 'blog',
					'menu-item-url' => get_permalink($handyman_agency_page_blog),
					'menu-item-status' => 'publish'
				));
			}

			// Contact Us
			$handyman_agency_page_contact = get_page_by_path('contact');
			if($handyman_agency_page_contact){
				wp_update_nav_menu_item($handyman_agency_menu_id, 0, array(
					'menu-item-title' => __('Contact Us', 'handyman-agency'),
					'menu-item-classes' => 'contact',
					'menu-item-url' => get_permalink($handyman_agency_page_contact),
					'menu-item-status' => 'publish'
				));
			}

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

	public function handyman_agency_customizer_nav_social_menu() {

		// ------- Create Social Menu --------
		$handyman_agency_menuname = $handyman_agency_themename . 'Social Menu';
		$handyman_agency_menulocation = 'social-menu';
		$handyman_agency_menu_exists = wp_get_nav_menu_object( $handyman_agency_menuname );

		if( !$handyman_agency_menu_exists){
			$handyman_agency_menu_id = wp_create_nav_menu($handyman_agency_menuname);

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

			wp_update_nav_menu_item( $handyman_agency_menu_id, 0, array(
				'menu-item-title'  => __( 'Pinterest', 'handyman-agency' ),
				'menu-item-url'    => 'https://www.pinterest.com',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $handyman_agency_menu_id, 0, array(
				'menu-item-title'  => __( 'Twitter', 'handyman-agency' ),
				'menu-item-url'    => 'https://www.twitter.com',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $handyman_agency_menu_id, 0, array(
				'menu-item-title'  => __( 'Youtube', 'handyman-agency' ),
				'menu-item-url'    => 'https://www.youtube.com',
				'menu-item-status' => 'publish',
			) );

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

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

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

		//................................................. MENU PAGES .................................................//
		
			$handyman_agency_home_id='';
			$handyman_agency_home_content = '';

			$handyman_agency_home_title = 'Home';
			$handyman_agency_home = array(
					'post_type' => 'page',
					'post_title' => $handyman_agency_home_title,
					'post_content'  => $handyman_agency_home_content,
					'post_status' => 'publish',
					'post_author' => 1,
					'post_slug' => 'home'
			);
			$handyman_agency_home_id = wp_insert_post($handyman_agency_home);

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

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


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

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

			// Create a Contact Us page and assign the template
			$handyman_agency_contact_title = 'Contact Us';
			$handyman_agency_contact_check = get_page_by_path('contact');
			if (!$handyman_agency_contact_check) {
				$handyman_agency_contact = array(
					'post_type'    => 'page',
					'post_title'   => $handyman_agency_contact_title,
					'post_content'   => '"More About The Free Handyman WordPress Theme"
										The Free Handyman WordPress Theme is an excellent choice for service-based businesses looking to establish an online presence without spending a lot of money. It provides all the essential tools for creating a functional website, such as a responsive layout, customizable sections, and SEO-friendly features. The free version includes all the necessary components for an effective website, making it perfect for smaller businesses just starting out. You can showcase your services, connect with potential clients, and even take inquiries directly through integrated forms. In addition to its visual appeal and essential functionality, the Free Handyman WordPress Theme is mobile-friendly and responsive. This ensures that clients can easily access your website from any device. With features like customizable service sections, galleries, and testimonials, you can create a personalized website to showcase your handyman services.

										The Free Handyman WordPress Theme is designed to be SEO-friendly, helping your website rank well in search engines and attract more local clients. Its translation readiness ensures that your site can reach a broader audience, making it easier to connect with customers in different regions. Social media integration also allows you to promote your business and engage with potential clients across various platforms, building a stronger online presence. WooCommerce compatibility is another great feature of the Free Handyman WordPress Theme, enabling businesses to manage bookings or sales directly on their website. You can easily add a payment system for clients to pay for services or purchase related products, making the theme more versatile for businesses with e-commerce needs. The theme also offers various customization options, allowing you to personalize your website by modifying colors, fonts, and layout elements to match your business branding.

										Additionally, the Free Handyman WordPress Theme allows you to maintain a clean, professional website with ease. Its user-friendly interface ensures that you can update your content and make adjustments without needing advanced technical knowledge. The theme’s secure and clean code ensures that your website is safe from security threats, while its mobile-friendly design ensures that your clients can access your site from anywhere, at any time. With translation readiness and WooCommerce compatibility, this theme provides a comprehensive solution for businesses of all sizes. The Free Handyman WordPress Theme is compatible with all major browsers, including Google Chrome, Firefox, Safari, and Edge. This ensures that your website will display correctly across different devices and browsers, providing a consistent user experience for all visitors. Whether your clients are browsing on their mobile phones, tablets, or desktops, your website will function seamlessly.',
					'post_status'  => 'publish',
					'post_author'  => 1,
					'post_name'    => 'contact' // Unique slug for the Contact Us page
				);
				wp_insert_post($handyman_agency_contact);
			}

			// Create a About page and assign the template
			$handyman_agency_about_title = 'About';
			$handyman_agency_about_check = get_page_by_path('about');
			if (!$handyman_agency_about_check) {
				$handyman_agency_about = array(
					'post_type'    => 'page',
					'post_title'   => $handyman_agency_about_title,
					'post_content'   => '"More About The Free Handyman WordPress Theme"
										The Free Handyman WordPress Theme is an excellent choice for service-based businesses looking to establish an online presence without spending a lot of money. It provides all the essential tools for creating a functional website, such as a responsive layout, customizable sections, and SEO-friendly features. The free version includes all the necessary components for an effective website, making it perfect for smaller businesses just starting out. You can showcase your services, connect with potential clients, and even take inquiries directly through integrated forms. In addition to its visual appeal and essential functionality, the Free Handyman WordPress Theme is mobile-friendly and responsive. This ensures that clients can easily access your website from any device. With features like customizable service sections, galleries, and testimonials, you can create a personalized website to showcase your handyman services.

										The Free Handyman WordPress Theme is designed to be SEO-friendly, helping your website rank well in search engines and attract more local clients. Its translation readiness ensures that your site can reach a broader audience, making it easier to connect with customers in different regions. Social media integration also allows you to promote your business and engage with potential clients across various platforms, building a stronger online presence. WooCommerce compatibility is another great feature of the Free Handyman WordPress Theme, enabling businesses to manage bookings or sales directly on their website. You can easily add a payment system for clients to pay for services or purchase related products, making the theme more versatile for businesses with e-commerce needs. The theme also offers various customization options, allowing you to personalize your website by modifying colors, fonts, and layout elements to match your business branding.

										Additionally, the Free Handyman WordPress Theme allows you to maintain a clean, professional website with ease. Its user-friendly interface ensures that you can update your content and make adjustments without needing advanced technical knowledge. The theme’s secure and clean code ensures that your website is safe from security threats, while its mobile-friendly design ensures that your clients can access your site from anywhere, at any time. With translation readiness and WooCommerce compatibility, this theme provides a comprehensive solution for businesses of all sizes. The Free Handyman WordPress Theme is compatible with all major browsers, including Google Chrome, Firefox, Safari, and Edge. This ensures that your website will display correctly across different devices and browsers, providing a consistent user experience for all visitors. Whether your clients are browsing on their mobile phones, tablets, or desktops, your website will function seamlessly.',
					'post_status'  => 'publish',
					'post_author'  => 1,
					'post_name'    => 'about' // Unique slug for the About page
				);
				wp_insert_post($handyman_agency_about);
			}

			// Create a Services page and assign the template
			$handyman_agency_services_title = 'Services';
			$handyman_agency_services_check = get_page_by_path('services');
			if (!$handyman_agency_services_check) {
				$handyman_agency_services = array(
					'post_type'    => 'page',
					'post_title'   => $handyman_agency_services_title,
					'post_content'   => '"More About The Free Handyman WordPress Theme"
										The Free Handyman WordPress Theme is an excellent choice for service-based businesses looking to establish an online presence without spending a lot of money. It provides all the essential tools for creating a functional website, such as a responsive layout, customizable sections, and SEO-friendly features. The free version includes all the necessary components for an effective website, making it perfect for smaller businesses just starting out. You can showcase your services, connect with potential clients, and even take inquiries directly through integrated forms. In addition to its visual appeal and essential functionality, the Free Handyman WordPress Theme is mobile-friendly and responsive. This ensures that clients can easily access your website from any device. With features like customizable service sections, galleries, and testimonials, you can create a personalized website to showcase your handyman services.

										The Free Handyman WordPress Theme is designed to be SEO-friendly, helping your website rank well in search engines and attract more local clients. Its translation readiness ensures that your site can reach a broader audience, making it easier to connect with customers in different regions. Social media integration also allows you to promote your business and engage with potential clients across various platforms, building a stronger online presence. WooCommerce compatibility is another great feature of the Free Handyman WordPress Theme, enabling businesses to manage bookings or sales directly on their website. You can easily add a payment system for clients to pay for services or purchase related products, making the theme more versatile for businesses with e-commerce needs. The theme also offers various customization options, allowing you to personalize your website by modifying colors, fonts, and layout elements to match your business branding.

										Additionally, the Free Handyman WordPress Theme allows you to maintain a clean, professional website with ease. Its user-friendly interface ensures that you can update your content and make adjustments without needing advanced technical knowledge. The theme’s secure and clean code ensures that your website is safe from security threats, while its mobile-friendly design ensures that your clients can access your site from anywhere, at any time. With translation readiness and WooCommerce compatibility, this theme provides a comprehensive solution for businesses of all sizes. The Free Handyman WordPress Theme is compatible with all major browsers, including Google Chrome, Firefox, Safari, and Edge. This ensures that your website will display correctly across different devices and browsers, providing a consistent user experience for all visitors. Whether your clients are browsing on their mobile phones, tablets, or desktops, your website will function seamlessly.',
					'post_status'  => 'publish',
					'post_author'  => 1,
					'post_name'    => 'services' // Unique slug for the Services page
				);
				wp_insert_post($handyman_agency_services);
			}


		// ------------------------------------------ Header -------------------------------------- //

			set_theme_mod('handyman_agency_call_text','Toll Free');
			set_theme_mod('handyman_agency_about_call','123 456 7890');

			set_theme_mod('handyman_agency_facebook_link_option','#');
			set_theme_mod('handyman_agency_twitter_link_option','#');
			set_theme_mod('handyman_agency_instagram_link_option','#');
			set_theme_mod('handyman_agency_youtube_link_option','#');
			set_theme_mod('handyman_agency_linked_link_option','#');

			set_theme_mod('handyman_agency_enable_slider',1);
			set_theme_mod('handyman_agency_service_show_hide',1);
			set_theme_mod('handyman_agency_header_search',true);


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

			for($handyman_agency_i=1;$handyman_agency_i<=3;$handyman_agency_i++){
				set_theme_mod( 'handyman_agency_slider_image'.$handyman_agency_i,get_template_directory_uri().'/revolution/assets/images/slider'.$handyman_agency_i.'.png' );
				set_theme_mod( 'handyman_agency_slider_top_text'.$handyman_agency_i, 'We Provide Best Quality Service' );
				set_theme_mod( 'handyman_agency_slider_heading'.$handyman_agency_i, 'BEAT HANDYMAN SERVICES FOR YOUR HOME' );
				set_theme_mod( 'handyman_agency_slider_text'.$handyman_agency_i, 'Lorem Ipsum is simply dummy text of the printing and type setting industry lorem Ipsum has been the industrys standard.' );
				set_theme_mod( 'handyman_agency_slider_button1_text'.$handyman_agency_i, 'READ MORE' );
				set_theme_mod( 'handyman_agency_slider_button1_link'.$handyman_agency_i, '#' );
				set_theme_mod( 'handyman_agency_slider_button2_text'.$handyman_agency_i, 'GET IN APPOINTMENT' );
				set_theme_mod( 'handyman_agency_slider_button2_link'.$handyman_agency_i, '#' );
			}


		// ------------------------------------------ About Section -------------------------------------- //

			set_theme_mod('handyman_agency_section_title','OUR EXPERT TEAM');

			$handyman_agency_team_role = array('Cheaf Handyman', 'Mechanic', 'Plumber','Cleaner');

			for($handyman_agency_i=1;$handyman_agency_i<=4;$handyman_agency_i++){
				set_theme_mod('handyman_agency_team_role' . $handyman_agency_i, $handyman_agency_team_role[$handyman_agency_i - 1]);
				set_theme_mod( 'handyman_agency_serv_facebook_url'.$handyman_agency_i, '#' );
				set_theme_mod( 'handyman_agency_serv_twitter_url'.$handyman_agency_i, '#' );
				set_theme_mod( 'handyman_agency_serv_linked_url'.$handyman_agency_i, '#' );
				set_theme_mod( 'handyman_agency_serv_insta_url'.$handyman_agency_i, '#' );
				set_theme_mod( 'handyman_agency_serv_youtube_url'.$handyman_agency_i, '#' );
			}

			wp_delete_post(1);
			$blog_title=array('Team Cock','Alex Edward','Harly Rayan','Mary Jane');
			for($handyman_agency_i=1;$handyman_agency_i<=4;$handyman_agency_i++){
				$title =$blog_title[$handyman_agency_i-1];
				$content = 'Lorem Ipsum is simply dummy text';

				// 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/teams'.$handyman_agency_i.'.png';

				$image_name= 'teams'.$handyman_agency_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->handyman_agency_customizer_nav_menu();
		$this->handyman_agency_customizer_nav_social_menu();
	}

	public function handyman_agency_guide() {
		$display_string = '';
		$return = add_query_arg( array()) ;
		$theme = wp_get_theme( 'handyman-agency' );
		?>
		<div class="wrapper-info get-stared-page-wrap">
			<div class="wrapper-info-content">
				<div class="buynow__">
					<h2><?php esc_html_e( 'Welcome to Handyman Agency', 'handyman-agency' ); ?> <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.', 'handyman-agency'); ?></p>
				</div>
				<div class="buynow_">
					<a target="_blank" class="buynow_themepage" href="<?php echo esc_url('https://www.revolutionwp.com/products/handyman-agency-wordpress-theme'); ?>"><?php echo esc_html__('Go Premium Now', 'handyman-agency'); ?></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 }
}