<?php

add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
add_filter( 'pt-ocdi/regenerate_thumbnails_in_content_import', '__return_false' );

if ( ! function_exists( 'kktfwp_import_files' ) ) :

	function kktfwp_import_files() {
		return array(
			array(
				'import_file_name'             => 'Pioniq Demo',
				'import_file_url'              => 'http://easysite.by/temp/toppic/Pioniq.xml',
				'import_widget_file_url' 	   => 'http://easysite.by/temp/toppic/toppic-demo-widgets.wie',
				'import_preview_image_url'     => 'http://themes.easysite.by/toppic-overview/img/demo6.jpg',
				'import_notice'                => __( 'Please waiting for a few minutes, do not close the window or refresh the page until the data is imported.', 'toppic' ),
			),
			array(
				'import_file_name'             => 'Cremona Demo',
				'import_file_url'              => 'http://easysite.by/temp/toppic/Cremona.xml',
				'import_widget_file_url' 	   => 'http://easysite.by/temp/toppic/toppic-demo-widgets.wie',
				'import_preview_image_url'     => 'http://themes.easysite.by/toppic-overview/img/demo4.jpg',
				'import_notice'                => __( 'Please waiting for a few minutes, do not close the window or refresh the page until the data is imported.', 'toppic' ),
			),
	 
		   array(
				'import_file_name'             => 'Florrie Demo',
				'import_file_url'              => 'http://easysite.by/temp/toppic/Florrie.xml',
				'import_widget_file_url' 	   => 'http://easysite.by/temp/toppic/toppic-demo-widgets.wie',
				'import_preview_image_url'     => 'http://themes.easysite.by/toppic-overview/img/demo1.jpg',
				'import_notice'                => __( 'Please waiting for a few minutes, do not close the window or refresh the page until the data is imported.', 'toppic' ),
			),
			
			array(
				'import_file_name'             => 'Swory Demo',
				'import_file_url'              => 'http://easysite.by/temp/toppic/Swory.xml',
				'import_widget_file_url' 	   => 'http://easysite.by/temp/toppic/toppic-demo-widgets.wie',
				'import_preview_image_url'     => 'http://themes.easysite.by/toppic-overview/img/demo2.jpg',
				'import_notice'                => __( 'Please waiting for a few minutes, do not close the window or refresh the page until the data is imported.', 'toppic' ),
			),
			
			array(
				'import_file_name'             => 'Frezo Demo',
				'import_file_url'              => 'http://easysite.by/temp/toppic/Frezo.xml',
				'import_widget_file_url' 	   => 'http://easysite.by/temp/toppic/toppic-demo-widgets.wie',
				'import_preview_image_url'     => 'http://themes.easysite.by/toppic-overview/img/demo3.jpg',
				'import_notice'                => __( 'Please waiting for a few minutes, do not close the window or refresh the page until the data is imported.', 'toppic' ),
			),
			
			array(
				'import_file_name'             => 'Aminio Demo',
				'import_file_url'              => 'http://easysite.by/temp/toppic/Aminio.xml',
				'import_widget_file_url' 	   => 'http://easysite.by/temp/toppic/toppic-demo-widgets.wie',
				'import_preview_image_url'     => 'http://themes.easysite.by/toppic-overview/img/demo5.jpg',
				'import_notice'                => __( 'Please waiting for a few minutes, do not close the window or refresh the page until the data is imported.', 'toppic' ),
			),
		);
	}
	add_filter( 'pt-ocdi/import_files', 'kktfwp_import_files' );
	
endif;

if ( ! function_exists( 'kktfwp_after_import' ) ) :

	function kktfwp_after_import( $selected_import ) {
	 
		$demo = $selected_import['import_file_name'];
		
		switch ($demo) {
			case 'Frezo Demo':
				//Set Menu
				$top_menu = get_term_by( 'name', 'Main menu', 'nav_menu' );
				set_theme_mod( 'nav_menu_locations' , array( 
					  'main-menu' => $top_menu->term_id
					 ) 
				);			
				// Assign front page and posts page (blog page).
				$front_page_id = get_page_by_title( 'Home' );
				$blog_page_id  = get_page_by_title( 'Blog' );

				update_option( 'show_on_front', 'page' );
				update_option( 'page_on_front', $front_page_id->ID );
				update_option( 'page_for_posts', $blog_page_id->ID );
				
				// Set theme settings
				update_option( 'toppic_theme_menu_style', 'kk-menu-left-boxed' );
				update_option( 'toppic_theme_menu_opacity', '0.85' );
				update_option( 'toppic_theme_fullscreen_stream', 'ken_b' );
				update_option( 'toppic_theme_custom_css', '.content.kk-is-homecaption .content-inner-wrapper {vertical-align: bottom;}' );
				
				break;
				
			case 'Pioniq Demo':
				//Set Menu
				$top_menu = get_term_by( 'name', 'Main menu', 'nav_menu' );
				$footer_menu = get_term_by( 'name', 'Footer menu', 'nav_menu' );
				set_theme_mod( 'nav_menu_locations' , array( 
					  'main-menu' => $top_menu->term_id,
					  'footer-menu' => $footer_menu->term_id 
					 ) 
				);			
				// Assign front page and posts page (blog page).
				$front_page_id = get_page_by_title( 'Home' );
				$blog_page_id  = get_page_by_title( 'Blog' );

				update_option( 'show_on_front', 'page' );
				update_option( 'page_on_front', $front_page_id->ID );
				update_option( 'page_for_posts', $blog_page_id->ID );
				
				// Set theme settings
				update_option( 'toppic_theme_menu_style', 'kk-menu-classic' );
				update_option( 'toppic_theme_content_style', 'kk-full' );
				update_option( 'toppic_theme_kk_page_anim', 'true' );
				update_option( 'toppic_theme_smooth_scroll', 'false' );
				update_option( 'toppic_theme_search_button', 'false' );
				update_option( 'toppic_theme_fullscreen_stream', 'kk_royal' );

				
				break;
				
			case 'Cremona Demo':
				//Set Menu
				$top_menu = get_term_by( 'name', 'Main menu', 'nav_menu' );
				$footer_menu = get_term_by( 'name', 'Footer menu', 'nav_menu' );
				set_theme_mod( 'nav_menu_locations' , array( 
					  'main-menu' => $top_menu->term_id,
					  'footer-menu' => $footer_menu->term_id 
					 ) 
				);			
				// Assign front page and posts page (blog page).
				$front_page_id = get_page_by_title( 'Home' );
				$blog_page_id  = get_page_by_title( 'Blog' );

				update_option( 'show_on_front', 'page' );
				update_option( 'page_on_front', $front_page_id->ID );
				update_option( 'page_for_posts', $blog_page_id->ID );
				
				// Set theme settings
				update_option( 'toppic_theme_menu_style', 'kk-menu-slide-right' );
				update_option( 'toppic_theme_content_style', 'kk-full' );
				update_option( 'toppic_theme_kk_page_anim', 'false' );
				update_option( 'toppic_theme_fullscreen_stream', 'kk_royal' );
				update_option( 'toppic_theme_custom_css', '.kk_menu_slide_right.kk-content-fullwidth .content.kk-is-homecaption {text-align: center;}' );
				
				break;
				
			case 'Florrie Demo':
				//Set Menu
				$top_menu = get_term_by( 'name', 'Main menu', 'nav_menu' );
				$footer_menu = get_term_by( 'name', 'Footer menu', 'nav_menu' );
				set_theme_mod( 'nav_menu_locations' , array( 
					  'main-menu' => $top_menu->term_id,
					  'footer-menu' => $footer_menu->term_id 
					 ) 
				);			
				// Assign front page and posts page (blog page).
				$front_page_id = get_page_by_title( 'Home' );
				$blog_page_id  = get_page_by_title( 'Blog' );

				update_option( 'show_on_front', 'page' );
				update_option( 'page_on_front', $front_page_id->ID );
				update_option( 'page_for_posts', $blog_page_id->ID );
				
				// Set theme settings
				update_option( 'toppic_theme_content_style', 'kk-full' );
				update_option( 'toppic_theme_fullscreen_stream', 'kk_royal' );
				
				break;
				
			case 'Swory Demo':
				//Set Menu
				$top_menu = get_term_by( 'name', 'Main menu', 'nav_menu' );
				$footer_menu = get_term_by( 'name', 'Footer menu', 'nav_menu' );
				set_theme_mod( 'nav_menu_locations' , array( 
					  'main-menu' => $top_menu->term_id,
					  'footer-menu' => $footer_menu->term_id 
					 ) 
				);			
				// Assign front page and posts page (blog page).
				$front_page_id = get_page_by_title( 'Home' );
				$blog_page_id  = get_page_by_title( 'Blog' );

				update_option( 'show_on_front', 'page' );
				update_option( 'page_on_front', $front_page_id->ID );
				update_option( 'page_for_posts', $blog_page_id->ID );
				
				// Set theme settings
				update_option( 'toppic_theme_menu_style', 'kk-menu-default-hidden' );
				update_option( 'toppic_theme_content_style', 'kk-full' );
				
				break;
				
			case 'Aminio Demo':
				//Set Menu
				$top_menu = get_term_by( 'name', 'Main menu', 'nav_menu' );
				set_theme_mod( 'nav_menu_locations' , array( 
					  'main-menu' => $top_menu->term_id,
					 ) 
				);			
				// Assign front page and posts page (blog page).
				$front_page_id = get_page_by_title( 'Home' );
				$blog_page_id  = get_page_by_title( 'Blog' );

				update_option( 'show_on_front', 'page' );
				update_option( 'page_on_front', $front_page_id->ID );
				update_option( 'page_for_posts', $blog_page_id->ID );
				
				// Set theme settings
				update_option( 'toppic_theme_menu_style', 'kk-menu-fullscreen' );
				update_option( 'toppic_theme_content_style', 'kk-boxed' );
				
				break;
		}
		
	}

	add_action( 'pt-ocdi/after_import', 'kktfwp_after_import' );

endif;