<div class="theme-info">
	<?php
        // Check if the demo import has been completed
        $mega_construction_demo_import_completed = get_option('mega_construction_demo_import_completed', false);

        // If the demo import is completed, display the "View Site" button
        if ($mega_construction_demo_import_completed) {
        echo '<p class="notice-text">' . esc_html__('Your demo import has been completed successfully.', 'mega-construction') . '</p>';
        echo '<span><a href="' . esc_url(home_url()) . '" class="import-btn site-btn" target="_blank">' . esc_html__('VIEW SITE', 'mega-construction') . '</a></span>';
        echo '<span><a href="' . esc_url( admin_url('customize.php')) . '" class="import-btn site-btn" target="_blank">' . esc_html__('CUSTOMIZE', 'mega-construction') . '</a></span>';
        }
		//POST and update the customizer and other related data of POLITICAL CAMPAIGN
        if (isset($_POST['submit'])) {

            // ------- Create Nav Menu --------
            $mega_construction_menuname = 'Main Menus';
            $mega_construction_bpmenulocation = 'primary';
            $mega_construction_menu_exists = wp_get_nav_menu_object($mega_construction_menuname);

            if (!$mega_construction_menu_exists) {
                $mega_construction_menu_id = wp_create_nav_menu($mega_construction_menuname);

                // Create Home Page
                $mega_construction_home_title = 'Home';
                $mega_construction_home = array(
                    'post_type' => 'page',
                    'post_title' => $mega_construction_home_title,
                    'post_content' => '',
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'home'
                );
                $mega_construction_home_id = wp_insert_post($mega_construction_home);
                // Assign Home Page Template
                add_post_meta($mega_construction_home_id, '_wp_page_template', 'page-template/custom-front-page.php');
                // Update options to set Home Page as the front page
                update_option('page_on_front', $mega_construction_home_id);
                update_option('show_on_front', 'page');
                // Add Home Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title' => __('Home', 'mega-construction'),
                    'menu-item-classes' => 'home',
                    'menu-item-url' => home_url('/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $mega_construction_home_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create Pages Page with Dummy Content
                $mega_construction_pages_title = 'Pages';
                $mega_construction_pages_content = '
                <p>Explore all the pages we have on our website. Find information about our services, company, and more.</p>

                 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br> 

                  All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.';
                $mega_construction_pages = array(
                    'post_type' => 'page',
                    'post_title' => $mega_construction_pages_title,
                    'post_content' => $mega_construction_pages_content,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'pages'
                );
                $mega_construction_pages_id = wp_insert_post($mega_construction_pages);
                // Add Pages Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title' => __('Pages', 'mega-construction'),
                    'menu-item-classes' => 'pages',
                    'menu-item-url' => home_url('/pages/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $mega_construction_pages_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create About Us Page with Dummy Content
                $mega_construction_about_title = 'About';
                $mega_construction_about_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...<br>

                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br> 

                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text.<br> 

                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.';
                $mega_construction_about = array(
                    'post_type' => 'page',
                    'post_title' => $mega_construction_about_title,
                    'post_content' => $mega_construction_about_content,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'about'
                );
                $mega_construction_about_id = wp_insert_post($mega_construction_about);
                // Add About Us Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title' => __('About', 'mega-construction'),
                    'menu-item-classes' => 'about',
                    'menu-item-url' => home_url('/about/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $mega_construction_about_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));
                // Create Blog Page only if it doesn't exist already
                $mega_construction_existing_blog_page = get_page_by_path('blog');
                if (!$mega_construction_existing_blog_page) {
                    $mega_construction_blog_id = wp_insert_post(array(
                    'post_type'    => 'page',
                    'post_title'   => __('Blog', 'mega-construction'),
                    'post_content' => '',
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_name'    => 'blog'
                ));
                } else {
                    $mega_construction_blog_id = $mega_construction_existing_blog_page->ID;
                }
                // Assign as Posts Page
                update_option('page_for_posts', $mega_construction_blog_id);
                update_option('show_on_front', 'page');
                //Add to Menu (only if not already added)
                $mega_construction_menu_items = wp_get_nav_menu_items($mega_construction_menu_id);
                $mega_construction_blog_in_menu = false;
                if ($mega_construction_menu_items) {
                    foreach ($mega_construction_menu_items as $mega_construction_item) {
                        if ((int) $mega_construction_item->object_id === (int) $mega_construction_blog_id) {
                            $mega_construction_blog_in_menu = true;
                            break;
                        }
                    }
                }
                if (!$mega_construction_blog_in_menu) {
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title'       => __('Blog', 'mega-construction'),
                    'menu-item-url'         => home_url('/blog/'),
                    'menu-item-status'      => 'publish',
                    'menu-item-object-id'   => $mega_construction_blog_id,
                    'menu-item-object'      => 'page',
                    'menu-item-type'        => 'post_type',
                    'menu-item-classes'     => 'mega-construction-blog-link'
                ));
                }
                // Create Staff Page with Dummy Content
                $mega_construction_staff_title = 'Staff';
                $mega_construction_staff_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...<br>

                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br>

                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable.<br>

                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.';

                $mega_construction_staff = array(
                    'post_type'    => 'page',
                    'post_title'   => $mega_construction_staff_title,
                    'post_content' => $mega_construction_staff_content,
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_slug'    => 'staff'
                );

                $mega_construction_staff_id = wp_insert_post($mega_construction_staff);

                // Add Staff Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title'     => __('Staff', 'mega-construction'),
                    'menu-item-classes'   => 'staff',
                    'menu-item-url'       => home_url('/staff/'),
                    'menu-item-status'    => 'publish',
                    'menu-item-object-id' => $mega_construction_staff_id,
                    'menu-item-object'    => 'page',
                    'menu-item-type'      => 'post_type'
                ));
               // Portfolio /
                $mega_construction_portfolio_title = 'Portfolio';
                $mega_construction_portfolio_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...<br>

                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br>

                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable.<br>

                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.';

                $mega_construction_portfolio = array(
                    'post_type'    => 'page',
                    'post_title'   => $mega_construction_portfolio_title,
                    'post_content' => $mega_construction_portfolio_content,
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_slug'    => 'portfolio'
                );

                $mega_construction_portfolio_id = wp_insert_post($mega_construction_portfolio);

                // Add Portfolio Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title'     => __('Portfolio', 'mega-construction'),
                    'menu-item-classes'   => 'portfolio',
                    'menu-item-url'       => home_url('/portfolio/'),
                    'menu-item-status'    => 'publish',
                    'menu-item-object-id' => $mega_construction_portfolio_id,
                    'menu-item-object'    => 'page',
                    'menu-item-type'      => 'post_type'
                ));

                //  Service Page 
                $mega_construction_service_title = 'Service';
                $mega_construction_service_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...<br>

                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br>

                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable.<br>

                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.';

                $mega_construction_service = array(
                    'post_type'    => 'page',
                    'post_title'   => $mega_construction_service_title,
                    'post_content' => $mega_construction_service_content,
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_slug'    => 'service'
                );

                $mega_construction_service_id = wp_insert_post($mega_construction_service);

                // Add Service Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title'     => __('Service', 'mega-construction'),
                    'menu-item-classes'   => 'service',
                    'menu-item-url'       => home_url('/service/'),
                    'menu-item-status'    => 'publish',
                    'menu-item-object-id' => $mega_construction_service_id,
                    'menu-item-object'    => 'page',
                    'menu-item-type'      => 'post_type'
                ));
                
               //  Portfolios Page 
                    $mega_construction_portfolios_title = 'Portfolios';
                    $mega_construction_portfolios_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...<br>

                    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br>

                    There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable.<br>

                    All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.';

                    $mega_construction_portfolios = array(
                        'post_type'    => 'page',
                        'post_title'   => $mega_construction_portfolios_title,
                        'post_content' => $mega_construction_portfolios_content,
                        'post_status'  => 'publish',
                        'post_author'  => 1,
                        'post_slug'    => 'portfolios'
                    );

                    $mega_construction_portfolios_id = wp_insert_post($mega_construction_portfolios);

                    // Add Portfolios Page to Menu
                    wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                        'menu-item-title'     => __('Portfolios', 'mega-construction'),
                        'menu-item-classes'   => 'portfolios',
                        'menu-item-url'       => home_url('/portfolios/'),
                        'menu-item-status'    => 'publish',
                        'menu-item-object-id' => $mega_construction_portfolios_id,
                        'menu-item-object'    => 'page',
                        'menu-item-type'      => 'post_type'
                    ));
               //  News Page 
                $mega_construction_news_title = 'News';
                $mega_construction_news_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...<br>

                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br>

                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable.<br>

                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.';

                $mega_construction_news = array(
                    'post_type'    => 'page',
                    'post_title'   => $mega_construction_news_title,
                    'post_content' => $mega_construction_news_content,
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_slug'    => 'news'
                );

                $mega_construction_news_id = wp_insert_post($mega_construction_news);

                // Add News Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title'     => __('News', 'mega-construction'),
                    'menu-item-classes'   => 'news',
                    'menu-item-url'       => home_url('/news/'),
                    'menu-item-status'    => 'publish',
                    'menu-item-object-id' => $mega_construction_news_id,
                    'menu-item-object'    => 'page',
                    'menu-item-type'      => 'post_type'
                ));
                
                //  Contact Us Page 
                $mega_construction_contact_title = 'Contact Us';
                $mega_construction_contact_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...<br>

                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br>

                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable.<br>

                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.';

                $mega_construction_contact = array(
                    'post_type'    => 'page',
                    'post_title'   => $mega_construction_contact_title,
                    'post_content' => $mega_construction_contact_content,
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_slug'    => 'contact-us'
                );

                $mega_construction_contact_id = wp_insert_post($mega_construction_contact);

                // Add Contact Us Page to Menu
                wp_update_nav_menu_item($mega_construction_menu_id, 0, array(
                    'menu-item-title'     => __('Contact Us', 'mega-construction'),
                    'menu-item-classes'   => 'contact-us',
                    'menu-item-url'       => home_url('/contact-us/'),
                    'menu-item-status'    => 'publish',
                    'menu-item-object-id' => $mega_construction_contact_id,
                    'menu-item-object'    => 'page',
                    'menu-item-type'      => 'post_type'
                ));

                // Set the menu location if it's not already set
                if (!has_nav_menu($mega_construction_bpmenulocation)) {
                    $mega_construction_locations = get_theme_mod('nav_menu_locations'); // Use 'nav_menu_locations' to get locations array
                    if (empty($mega_construction_locations)) {
                        $mega_construction_locations = array();
                    }
                    $mega_construction_locations[$mega_construction_bpmenulocation] = $mega_construction_menu_id;
                    set_theme_mod('nav_menu_locations', $mega_construction_locations);
                }
             }   
                // Set the demo import completion flag
                update_option('mega_construction_demo_import_completed', true);
                // Display success message and "View Site" button
                echo '<p class="notice-text">' . esc_html__('Your demo import has been completed successfully.', 'mega-construction') . '</p>';
                echo '<span><a href="' . esc_url(home_url()) . '" class="import-btn site-btn" target="_blank">' . esc_html__('VISIT SITE', 'mega-construction') . '</a></span>';
                echo '<span><a href="' . esc_url( admin_url('customize.php')) . '" class="import-btn site-btn" target="_blank">' . esc_html__('CUSTOMIZE', 'mega-construction') . '</a></span>';
                //end 

                //Topbar
                set_theme_mod( 'mega_construction_address', '71 Piligrim Avenue' );
                set_theme_mod( 'mega_construction_address1', 'Chevy Chase, MD 20815' );
                set_theme_mod( 'mega_construction_button_text', 'SPECIAL OFFERS' );
                set_theme_mod( 'mega_construction_button_link', '#' );
                
                //Contact
                set_theme_mod( 'mega_construction_phone', '+(10)123 456 7966' );
                set_theme_mod( 'mega_construction_phone1', '+(10)123 456 7977' );
                set_theme_mod( 'mega_construction_email', 'Exp1@example.com' );
                set_theme_mod( 'mega_construction_email1', 'Exp2@example.com' );
            
                    //Slider Section
                set_theme_mod( 'mega_construction_slider_hide', true );
                set_theme_mod( 'mega_construction_slider_button_label', 'BOOK LESSON' );
                set_theme_mod( 'mega_construction_slider_button_link', '#' );

                
                $mega_construction_slider_titles = [
                    'BUILDING DREAMS WITH STRENGTH & PRECISION',
                    'RELIABLE CONSTRUCTION FOR A BETTER TOMORROW',
                    'YOUR VISION, OUR CONSTRUCTION EXCELLENCE',
                    'CRAFTING STRONG FOUNDATIONS FOR A BETTER FUTURE',
                ];     

                $mega_construction_slider_contents = [
                    'Delivering top-quality construction services with unmatched expertise',
                    'We create safe, sustainable, and innovative infrastructure',
                    'From planning to execution, we turn every project into reality.',
                    'Quality construction solutions built with integrity and innovation.'
                ];  

                for($mega_construction_i=1;$mega_construction_i<=4;$mega_construction_i++){
                    $mega_construction_slider_title = $mega_construction_slider_titles[$mega_construction_i - 1];
                    $mega_construction_slider_content = $mega_construction_slider_contents[$mega_construction_i - 1];
                    // Create post object
                    $mega_construction_my_post = array(
                    'post_title'    => wp_strip_all_tags( $mega_construction_slider_title ),
                    'post_content'  => $mega_construction_slider_content,
                    'post_status'   => 'publish',
                    'post_type'     => 'page',
                    );

                    // Insert the post into the database
                    $mega_construction_post_id = wp_insert_post( $mega_construction_my_post );

                    if ($mega_construction_post_id) {
                        // Set the theme mod for the slider page
                        set_theme_mod('mega_construction_slidersettings_page' . $mega_construction_i, $mega_construction_post_id);

                        $mega_construction_image_url = get_template_directory_uri().'/images/slider'.$mega_construction_i.'.png';

                        $mega_construction_image_id = media_sideload_image($mega_construction_image_url, $mega_construction_post_id, null, 'id');

                            if (!is_wp_error($mega_construction_image_id)) {
                                // Set the downloaded image as the post's featured image
                                set_post_thumbnail($mega_construction_post_id, $mega_construction_image_id);
                            }
                        }
                    } 
                    // About Us
                    set_theme_mod( 'mega_construction_about1', true );
                    set_theme_mod( 'mega_construction_sec1_title', 'About Us' );
                    // About Post
                    $mega_construction_about_title   = "New Construction Project Management Service";
                    $mega_construction_about_content = "Amazon has introduced a new construction project management service in select cities, providing tools and resources to streamline building projects. This service aims to make planning, procurement, and site management faster and more efficient for construction professionals.";
                    $mega_construction_about_image_url = get_template_directory_uri() . '/images/about.png';

                    $mega_construction_about_post_data = array(
                        'post_title'   => wp_strip_all_tags( $mega_construction_about_title ),
                        'post_content' => wp_kses_post( $mega_construction_about_content ),
                        'post_status'  => 'publish',
                        'post_type'    => 'post',
                    );

                    $mega_construction_about_post_id = wp_insert_post( $mega_construction_about_post_data );

                    if ( ! is_wp_error( $mega_construction_about_post_id ) ) {

                        $mega_construction_about_image_id = media_sideload_image(
                            esc_url( $mega_construction_about_image_url ),
                            $mega_construction_about_post_id,
                            null,
                            'id'
                        );

                        if ( ! is_wp_error( $mega_construction_about_image_id ) && $mega_construction_about_image_id ) {
                            set_post_thumbnail( $mega_construction_about_post_id, $mega_construction_about_image_id );
                        }

                        set_theme_mod( 'mega_construction_about_setting_default', $mega_construction_about_post_id );
                        set_theme_mod( 'mega_construction_about_setting', $mega_construction_about_post_id );
                    }


                    // Logo Upload
                    $mega_construction_logo_url  = get_template_directory_uri() . '/images/logo.png';
                    $mega_construction_logo_name = 'logo.png';

                    $mega_construction_upload_dir = wp_upload_dir();
                    $mega_construction_logo_data  = file_get_contents( esc_url( $mega_construction_logo_url ) );

                    $mega_construction_unique_file_name = wp_unique_filename( $mega_construction_upload_dir['path'], $mega_construction_logo_name );
                    $mega_construction_filename         = basename( $mega_construction_unique_file_name );

                    // Folder location
                    if ( wp_mkdir_p( $mega_construction_upload_dir['path'] ) ) {
                        $mega_construction_file = $mega_construction_upload_dir['path'] . '/' . $mega_construction_filename;
                    } else {
                        $mega_construction_file = $mega_construction_upload_dir['basedir'] . '/' . $mega_construction_filename;
                    }

                    if ( ! function_exists( 'WP_Filesystem' ) ) {
                        require_once( ABSPATH . 'wp-admin/includes/file.php' );
                    }

                    WP_Filesystem();
                    global $wp_filesystem;

                    if ( ! $wp_filesystem->put_contents( $mega_construction_file, $mega_construction_logo_data, FS_CHMOD_FILE ) ) {
                        wp_die( 'Error saving file!' );
                    }

                    $mega_construction_filetype = wp_check_filetype( $mega_construction_filename, null );

                    $mega_construction_attachment = array(
                        'post_mime_type' => $mega_construction_filetype['type'],
                        'post_title'     => sanitize_file_name( $mega_construction_filename ),
                        'post_status'    => 'inherit',
                    );

                    $mega_construction_attach_id = wp_insert_attachment( $mega_construction_attachment, $mega_construction_file );

                    set_theme_mod( 'custom_logo', $mega_construction_attach_id );
                    }
                   // logo end

                    //Copyright Text
                    set_theme_mod( 'mega_construction_footer_text', 'By Themesglance' );
                ?>
                
                <form action="<?php echo esc_url(home_url()); ?>/wp-admin/themes.php?page=mega_construction_guide" method="POST" onsubmit="return validate(this);">
                <?php if (!get_option('mega_construction_demo_import_completed')) : ?>
                    <div class="demo-btn">
                        <p><?php esc_html_e( 'Click the below run importer button to import demo content', 'mega-construction' ); ?></p>
                        <button id="import-button" type="submit" name="submit" class="import-btn run-import button-large">
                            <?php esc_html_e('Demo Importer', 'mega-construction'); ?>
                                <span id="spinner" style="display: none;">
                                    <img src="<?php echo esc_url(get_template_directory_uri()); ?>/images/spinner.gif" alt="Loading..." style="width:34px; height:34px; margin-left:10px;vertical-align: middle;" />
                                </span>
                        </button>
                    </div>
                <?php endif; ?>
                </form>
                <script type="text/javascript">
                    function validate(valid) {
                        if(confirm("Do you really want to import the Demo Theme Content?")){
                            document.getElementById('spinner').style.display = 'inline-block';
                        }
                        else {
                            return false;
                        }
                    }
        </script>
</div>
