<?php
if (isset($_GET['import-demo']) && $_GET['import-demo'] == true) {
    class GymWorkoutDemoImporter {

        public function gym_workout_customizer_primary_menu() {
            // Create Primary Menu
            $gym_workout_themename = 'Gym Workout'; // Define the theme name
            $gym_workout_menuname = $gym_workout_themename . ' Primary Menu';
            $gym_workout_bpmenulocation = 'primary_menu';
            $gym_workout_menu_exists = wp_get_nav_menu_object($gym_workout_menuname);

            if (!$gym_workout_menu_exists) {
                $gym_workout_menu_id = wp_create_nav_menu($gym_workout_menuname);

                wp_update_nav_menu_item($gym_workout_menu_id, 0, array(
                    'menu-item-title' => __('HOME', 'gym-workout'),
                    'menu-item-classes' => 'home',
                    'menu-item-url' => home_url('/'),
                    'menu-item-status' => 'publish',
                ));

                wp_update_nav_menu_item($gym_workout_menu_id, 0, array(
                    'menu-item-title' => __('ABOUT US', 'gym-workout'),
                    'menu-item-classes' => 'about-us',
                    'menu-item-url' => get_permalink(get_page_id_by_title('About')),
                    'menu-item-status' => 'publish',
                ));

                wp_update_nav_menu_item($gym_workout_menu_id, 0, array(
                    'menu-item-title' => __('SERVICES', 'gym-workout'),
                    'menu-item-classes' => 'services',
                    'menu-item-url' => get_permalink(get_page_id_by_title('services')),
                    'menu-item-status' => 'publish',
                ));

                wp_update_nav_menu_item($gym_workout_menu_id, 0, array(
                    'menu-item-title' => __('GALLERY', 'gym-workout'),
                    'menu-item-classes' => 'gallery',
                    'menu-item-url' => get_permalink(get_page_id_by_title('gallery')),
                    'menu-item-status' => 'publish',
                ));

                wp_update_nav_menu_item($gym_workout_menu_id, 0, array(
                    'menu-item-title' => __('BLOG', 'gym-workout'),
                    'menu-item-classes' => 'blog',
                    'menu-item-url' => get_permalink(get_page_id_by_title('blog')),
                    'menu-item-status' => 'publish',
                ));

                wp_update_nav_menu_item($gym_workout_menu_id, 0, array(
                    'menu-item-title' => __('SHOP', 'gym-workout'),
                    'menu-item-classes' => 'shop',
                    'menu-item-url' => get_permalink(get_page_id_by_title('shop')),
                    'menu-item-status' => 'publish',
                ));

                wp_update_nav_menu_item($gym_workout_menu_id, 0, array(
                    'menu-item-title' => __('CONTACT', 'gym-workout'),
                    'menu-item-classes' => 'contact',
                    'menu-item-url' => get_permalink(get_page_id_by_title('contact')),
                    'menu-item-status' => 'publish',
                ));

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

        public function setup_widgets() {

        $gym_workout_home_id='';
        $gym_workout_home_content = '';
        $gym_workout_home_title = 'Home';
        $gym_workout_home = array(
            'post_type' => 'page',
            'post_title' => $gym_workout_home_title,
            'post_content' => $gym_workout_home_content,
            'post_status' => 'publish',
            'post_author' => 1,
            'post_slug' => 'home'
        );
        $gym_workout_home_id = wp_insert_post($gym_workout_home);
        
        add_post_meta( $gym_workout_home_id, '_wp_page_template', 'templates/template-homepage.php' );

        update_option( 'page_on_front', $gym_workout_home_id );
        update_option( 'show_on_front', 'page' );

                        // Create a Posts Page
            $gym_workout_blog_title = 'About Us';
            $gym_workout_blog_check = get_page_id_by_title($gym_workout_blog_title);

            if ($gym_workout_blog_check == 1) {
                $gym_workout_blog = array(
                    'post_type' => 'page',
                    'post_title' => $gym_workout_blog_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_name' => 'about-us',
                    'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."',
                );
                $gym_workout_blog_id = wp_insert_post($gym_workout_blog);

                if (!is_wp_error($gym_workout_blog_id)) {
                    // update_option('page_for_posts', $gym_workout_blog_id);
                }
            }

                        // Create a Posts Page
            $gym_workout_blog_title = 'SERVICES';
            $gym_workout_blog_check = get_page_id_by_title($gym_workout_blog_title);

            if ($gym_workout_blog_check  == 1) {
                $gym_workout_blog = array(
                    'post_type' => 'page',
                    'post_title' => $gym_workout_blog_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_name' => 'services',
                    'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."',
                );
                $gym_workout_blog_id = wp_insert_post($gym_workout_blog);

                if (!is_wp_error($gym_workout_blog_id)) {
                    // update_option('page_for_posts', $gym_workout_blog_id);
                }
            }

                         // Create a Posts Page
            $gym_workout_blog_title = 'GALLERY';
            $gym_workout_blog_check = get_page_id_by_title($gym_workout_blog_title);

            if ($gym_workout_blog_check  == 1) {
                $gym_workout_blog = array(
                    'post_type' => 'page',
                    'post_title' => $gym_workout_blog_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_name' => 'gallery',
                    'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."',
                );
                $gym_workout_blog_id = wp_insert_post($gym_workout_blog);

                if (!is_wp_error($gym_workout_blog_id)) {
                    // update_option('page_for_posts', $gym_workout_blog_id);
                }
            }

                         // Create a Posts Page
            $gym_workout_blog_title = 'BLOG';
            $gym_workout_blog_check = get_page_id_by_title($gym_workout_blog_title);

            if ($gym_workout_blog_check  == 1) {
                $gym_workout_blog = array(
                    'post_type' => 'page',
                    'post_title' => $gym_workout_blog_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_name' => 'blog',
                    'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."',
                );
                $gym_workout_blog_id = wp_insert_post($gym_workout_blog);

                if (!is_wp_error($gym_workout_blog_id)) {
                    // update_option('page_for_posts', $gym_workout_blog_id);
                }
            }

                                     // Create a Posts Page
            $gym_workout_blog_title = 'SHOP';
            $gym_workout_blog_check = get_page_id_by_title($gym_workout_blog_title);

            if ($gym_workout_blog_check  == 1) {
                $gym_workout_blog = array(
                    'post_type' => 'page',
                    'post_title' => $gym_workout_blog_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_name' => 'shop',
                    'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."',
                );
                $gym_workout_blog_id = wp_insert_post($gym_workout_blog);

                if (!is_wp_error($gym_workout_blog_id)) {
                    // update_option('page_for_posts', $gym_workout_blog_id);
                }
            }

                                     // Create a Posts Page
            $gym_workout_blog_title = 'CONTACT';
            $gym_workout_blog_check = get_page_id_by_title($gym_workout_blog_title);

            if ($gym_workout_blog_check  == 1) {
                $gym_workout_blog = array(
                    'post_type' => 'page',
                    'post_title' => $gym_workout_blog_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_name' => 'contact',
                    'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."',
                );
                $gym_workout_blog_id = wp_insert_post($gym_workout_blog);

                if (!is_wp_error($gym_workout_blog_id)) {
                    // update_option('page_for_posts', $gym_workout_blog_id);
                }
            }

		//---Header--//

		set_theme_mod('gym_workout_header_phone_number_feild', '+1234567890');
		set_theme_mod('gym_workout_header_email_address_feild', 'info@example.com');

		set_theme_mod('gym_workout_header_social_icon_2_feild', 'twitter');
		set_theme_mod('gym_workout_header_social_icon_1_feild', 'facebook-alt');
		set_theme_mod('gym_workout_header_social_icon_4_feild', 'linkedin');
		set_theme_mod('gym_workout_header_social_icon_5_feild', 'whatsapp');
		set_theme_mod('gym_workout_header_social_icon_3_feild', 'instagram');
		set_theme_mod('gym_workout_header_social_link_1_feild', '#');
		set_theme_mod('gym_workout_header_social_link_2_feild', '#');
		set_theme_mod('gym_workout_header_social_link_3_feild', '#');
		set_theme_mod('gym_workout_header_social_link_4_feild', '#');
		set_theme_mod('gym_workout_header_social_link_5_feild', '#');

		set_theme_mod('gym_workout_header_myaccount_feild', '#');

		//-----Slider-----//

		set_theme_mod( 'gym_workout_slide_on_off', 'on' );

		set_theme_mod('gym_workout_slide_count','2');

		$gym_workout_slider_title=array('Your Health Advisor', 'Consultation Will Be Best');

		for ($i=1; $i <= 2; $i++) {
			set_theme_mod( 'gym_workout_slider_image'.$i, get_template_directory_uri().'/images/demo-import-images/slides/slide_'.$i.'.png' );
			
			set_theme_mod('gym_workout_slider_short_heading'.$i,'ITS YOUR TURN');
			set_theme_mod('gym_workout_slider_heading'.$i, $gym_workout_slider_title[$i - 1]);
			set_theme_mod('gym_workout_slider_text'.$i,'Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley Lorem Ipsum has been the industrys standard dummy.');
			set_theme_mod('gym_workout_slider_button_link'.$i, '#');
			set_theme_mod('gym_workout_slider_button_text'.$i, 'CONTACT WITH US');
		}

		//-----Teams-----//

		set_theme_mod( 'gym_workout_team_on_off', 'on' );

		set_theme_mod('gym_workout_team_extra_heading', 'EXPERT COACH');
		set_theme_mod('gym_workout_team_main_heading', 'CHOOSE YOUR COACH');

		set_theme_mod('gym_workout_team_count','3');

		$gym_workout_features_title=array('HAMS DORAN', 'MACS DONALD', 'STEVEN GEORGE');

		$gym_workout_features_date=array('HEALTH COACH', 'CARDIOLOST', 'DIETICIAN');

		for ($i=1; $i <= 3; $i++) {
			set_theme_mod( 'gym_workout_team_image'.$i, get_template_directory_uri().'/images/demo-import-images/team/team_'.$i.'.png' );
			set_theme_mod('gym_workout_team_member_name'.$i, $gym_workout_features_title[$i - 1]);
			set_theme_mod('gym_workout_team_designation'.$i, $gym_workout_features_date[$i - 1]);
			set_theme_mod('gym_workout_team_member_link'.$i, '#');
			set_theme_mod('gym_workout_team_social_icon_2_feild'.$i, 'twitter');
			set_theme_mod('gym_workout_team_social_icon_1_feild'.$i, 'facebook-alt');
			set_theme_mod('gym_workout_team_social_icon_4_feild'.$i, 'linkedin');
			set_theme_mod('gym_workout_team_social_icon_5_feild'.$i, 'whatsapp');
			set_theme_mod('gym_workout_team_social_icon_3_feild'.$i, 'instagram');
			set_theme_mod('gym_workout_team_social_link_1_feild'.$i, '#');
			set_theme_mod('gym_workout_team_social_link_2_feild'.$i, '#');
			set_theme_mod('gym_workout_team_social_link_3_feild'.$i, '#');
			set_theme_mod('gym_workout_team_social_link_4_feild'.$i, '#');
			set_theme_mod('gym_workout_team_social_link_5_feild'.$i, '#');
		}
	        }
    }

    // Instantiate the class and call its methods
    $demo_importer = new GymWorkoutDemoImporter();
    $demo_importer->setup_widgets();
    $demo_importer->gym_workout_customizer_primary_menu();
}
?>