<?php
/**
 * @package WordPress
 * @subpackage Campoal
 */


function conikal_import_demo_files() {
  $import_notice      = esc_html__( 'Be sure all required and recommend plugins is installed before import demo. After imported demo, all your settings and customization before will be overwritten.', 'campoal' );
  $redux_option_name  = 'campoal_options';
  $import_host        = 'https://cdn.conikal.com/demo/campoal/';

  return array(
    array(
      'import_file_name'            => 'Impact - Gutenberg',
      'categories'                  => array( 'Platform' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'impact/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'impact/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'impact/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'impact/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'impact/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/',
    ),
    array(
      'import_file_name'            => 'Fundraiser - Gutenberg',
      'categories'                  => array( 'Platform' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'fundraiser/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'fundraiser/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'fundraiser/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'fundraiser/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'fundraiser/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/',
    ),
    array(
      'import_file_name'            => 'Peace - WP Bakery',
      'categories'                  => array( 'Platform' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'peace/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'peace/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'peace/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'peace/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'peace/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/',
    ),
    array(
      'import_file_name'            => 'Movement - WP Bakery',
      'categories'                  => array( 'Platform' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'movement/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'movement/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'movement/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'movement/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'movement/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/movement/',
    ),
    array(
      'import_file_name'            => 'Young - WP Bakery',
      'categories'                  => array( 'Platform' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'young/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'young/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'young/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'young/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'young/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/young/',
    ),
    array(
      'import_file_name'            => 'Green - WP Bakery',
      'categories'                  => array( 'Platform' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'green/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'green/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'green/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'green/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'green/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/green/',
    ),
    array(
      'import_file_name'            => 'Simple - WP Bakery',
      'categories'                  => array( 'Platform' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'simple/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'simple/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'simple/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'simple/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'simple/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/simple/',
    ),
    array(
      'import_file_name'            => 'Foundation - WP Bakery',
      'categories'                  => array( 'Fundraising' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'foundation/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'foundation/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'foundation/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'foundation/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'foundation/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/foundation/',
    ),
    array(
      'import_file_name'            => 'Single Campaign - WP Bakery',
      'categories'                  => array( 'One Page' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'single/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'single/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'single/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'single/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'single/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/single/',
    ),
    array(
      'import_file_name'            => 'Infinity - WP Bakery',
      'categories'                  => array( 'One Page' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'infinity/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'infinity/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'infinity/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'infinity/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'infinity/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/single/',
    ),
    array(
      'import_file_name'            => 'RTL - WP Bakery',
      'categories'                  => array( 'Right to Left' ),
      'import_file_url'             => trailingslashit( $import_host ) . 'rtl/content.xml',
      'import_widget_file_url'      => trailingslashit( $import_host ) . 'rtl/widgets.wie',
      'import_customizer_file_url'  => trailingslashit( $import_host ) . 'rtl/customizer.dat',
      'import_redux'                => array(
        array(
          'file_url'               => trailingslashit( $import_host ) . 'rtl/redux.json',
          'option_name'             => $redux_option_name,
        ),
      ),
      'import_preview_image_url'    => trailingslashit( $import_host ) . 'rtl/preview.png',
      'import_notice'               => $import_notice,
      //'preview_url'               => '//campoal.com/rtl/',
    ),
  );
}
// add_filter( 'pt-ocdi/import_files', 'conikal_import_demo_files' );
add_filter( 'merlin_import_files', 'conikal_import_demo_files' );


/**
* Assign menus and front page after imported
*
* @since Campoal 1.0.0
*/
function conikal_after_import_setup() {
    // Assign menus to their locations.
    $top_menu       = get_term_by( 'name', 'Top Menu', 'nav_menu' );
    $primary_menu   = get_term_by( 'name', 'Primary Menu', 'nav_menu' );
    $category_menu  = get_term_by( 'name', 'Category Menu', 'nav_menu' );
    $footer_menu    = get_term_by( 'name', 'Footer Menu', 'nav_menu' );
    $mobile_menu    = get_term_by( 'name', 'Mobile Menu', 'nav_menu' );

    set_theme_mod( 'nav_menu_locations', array(
          'top_menu'  => $top_menu->term_id,
          'primary'   => $primary_menu->term_id,
          'category'  => $category_menu->term_id,
          'footer'    => $footer_menu->term_id,
          'mobile'    => $mobile_menu->term_id,
        )
    );

    // Assign front page and posts page (blog page).
    $front_page_id = get_page_by_title( 'Homepage' );
    $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 );

}
// add_action( 'pt-ocdi/after_import', 'conikal_after_import_setup' );
add_action( 'merlin_after_all_import', 'conikal_after_import_setup' );


/**
* Disable one click demo import brand
*
* @since Campoal 1.2.4
*/
add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
?>
