<?php
/**
 * Merlin Settings Configuration
 */
$wizard = new Merlin(

	$config = array(
		'directory'            => 'inc/merlin', // Location / directory where Merlin WP is placed in your theme.
		'merlin_url'           => 'tx-dashboard', // The wp-admin page slug where Merlin WP loads.
		'parent_slug'          => 'tx-dashboard', // The wp-admin parent page slug for the admin menu item.
		'capability'           => 'manage_options', // The capability required for this menu to be displayed to the user.
		'child_action_btn_url' => '', // URL for the 'child-action-link'.
		'dev_mode'             => true, // Enable development mode for testing.
		'license_step'         => false, // EDD license activation step.
		'license_required'     => false, // Require the license activation step.
		'license_help_url'     => '', // URL for the 'license-tooltip'.
		'edd_remote_api_url'   => '', // EDD_Theme_Updater_Admin remote_api_url.
		'edd_item_name'        => '', // EDD_Theme_Updater_Admin item_name.
		'edd_theme_slug'       => '', // EDD_Theme_Updater_Admin item_slug.
		'ready_big_button_url' => home_url('/'), // Link for the big button on the ready step.
	),
	$strings = array(
		'admin-menu'               => esc_html__( 'Theme Setup', 'edumodo' ),

		/* translators: 1: Title Tag 2: Theme Name 3: Closing Title Tag */
		'title%s%s%s%s'            => esc_html__( '%1$s%2$s Themes &lsaquo; Theme Setup: %3$s%4$s', 'edumodo' ),
		'return-to-dashboard'      => esc_html__( 'Return to the dashboard', 'edumodo' ),
		'ignore'                   => esc_html__( 'Disable this wizard', 'edumodo' ),

		'btn-skip'                 => esc_html__( 'Skip', 'edumodo' ),
		'btn-next'                 => esc_html__( 'Next', 'edumodo' ),
		'btn-start'                => esc_html__( 'Start', 'edumodo' ),
		'btn-no'                   => esc_html__( 'Cancel', 'edumodo' ),
		'btn-plugins-install'      => esc_html__( 'Install', 'edumodo' ),
		'btn-child-install'        => esc_html__( 'Install', 'edumodo' ),
		'btn-content-install'      => esc_html__( 'Install', 'edumodo' ),
		'btn-import'               => esc_html__( 'Import', 'edumodo' ),
		'btn-license-activate'     => esc_html__( 'Activate', 'edumodo' ),
		'btn-license-skip'         => esc_html__( 'Later', 'edumodo' ),

		/* translators: Theme Name */
		'license-header%s'         => esc_html__( 'Activate %s', 'edumodo' ),
		/* translators: Theme Name */
		'license-header-success%s' => esc_html__( '%s is Activated', 'edumodo' ),
		/* translators: Theme Name */
		'license%s'                => esc_html__( 'Enter your license key to enable remote updates and theme support.', 'edumodo' ),
		'license-label'            => esc_html__( 'License key', 'edumodo' ),
		'license-success%s'        => esc_html__( 'The theme is already registered, so you can go to the next step!', 'edumodo' ),
		'license-json-success%s'   => esc_html__( 'Your theme is activated! Remote updates and theme support are enabled.', 'edumodo' ),
		'license-tooltip'          => esc_html__( 'Need help?', 'edumodo' ),

		/* translators: Theme Name */
		'welcome-header%s'         => esc_html__( 'Welcome to %s', 'edumodo' ),
		'welcome-header-success%s' => esc_html__( 'Hi. Welcome back', 'edumodo' ),
		'welcome%s'                => esc_html__( 'This wizard will set up your theme, install plugins, and import content. It is optional & should take only a few minutes.', 'edumodo' ),
		'welcome-success%s'        => esc_html__( 'You may have already run this theme setup wizard. If you would like to proceed anyway, click on the "Start" button below.', 'edumodo' ),

		'child-header'             => esc_html__( 'Install Child Theme', 'edumodo' ),
		'child-header-success'     => esc_html__( 'You\'re good to go!', 'edumodo' ),
		'child'                    => esc_html__( 'Let\'s build & activate a child theme so you may easily make theme changes.', 'edumodo' ),
		'child-success%s'          => esc_html__( 'Your child theme has already been installed and is now activated, if it wasn\'t already.', 'edumodo' ),
		'child-action-link'        => esc_html__( 'Learn about child themes', 'edumodo' ),
		'child-json-success%s'     => esc_html__( 'Awesome. Your child theme has already been installed and is now activated.', 'edumodo' ),
		'child-json-already%s'     => esc_html__( 'Awesome. Your child theme has been created and is now activated.', 'edumodo' ),

		'plugins-header'           => esc_html__( 'Install Plugins', 'edumodo' ),
		'plugins-header-success'   => esc_html__( 'You\'re up to speed!', 'edumodo' ),
		'plugins'                  => esc_html__( 'Let\'s install some essential WordPress plugins to get your site up to speed.', 'edumodo' ),
		'plugins-success%s'        => esc_html__( 'The required WordPress plugins are all installed and up to date. Press "Next" to continue the setup wizard.', 'edumodo' ),
		'plugins-action-link'      => esc_html__( 'Advanced', 'edumodo' ),

		'import-header'            => esc_html__( 'Import Content', 'edumodo' ),
		'import'                   => esc_html__( 'Let\'s import content to your website, to help you get familiar with the theme.', 'edumodo' ),
		'import-action-link'       => esc_html__( 'Advanced', 'edumodo' ),

		'ready-header'             => esc_html__( 'All done. Have fun!', 'edumodo' ),

		/* translators: Theme Author */
		'ready%s'                  => esc_html__( 'Your theme has been all set up. Enjoy your new theme by %s.', 'edumodo' ),
		'ready-action-link'        => esc_html__( 'Extras', 'edumodo' ),
		'ready-big-button'         => esc_html__( 'View your website', 'edumodo' ),
		'ready-link-1'             => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/', esc_html__( 'Explore WordPress', 'edumodo' ) ),
		'ready-link-2'             => sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://themebeans.com/contact/', esc_html__( 'Get Theme Support', 'edumodo' ) ),
		'ready-link-3'             => sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'customize.php' ), esc_html__( 'Start Customizing', 'edumodo' ) ),
	)
);


/**
 * Custom content for the generated child theme's functions.php file.
 */
function edumodo_generate_child_functions_php( $output, $slug ) {

	$slug_no_hyphens = strtolower( preg_replace( '#[^a-zA-Z]#', '', $slug ) );

	$output = "
		<?php
		/**
		 * Theme functions and definitions.
		 */
		function {$slug_no_hyphens}_child_enqueue_styles() {
			
			wp_enqueue_style( '{$slug}-style' , get_template_directory_uri() . '/style.css' );
		    
		    wp_enqueue_style( '{$slug}-child-style',
		        get_stylesheet_directory_uri() . '/style.css',
		        array( '{$slug}-style' ),
		        wp_get_theme()->get('Version')
		    );
		}
		add_action(  'wp_enqueue_scripts', '{$slug_no_hyphens}_child_enqueue_styles' );\n
	";

	// Let's remove the tabs so that it displays nicely.
	$output = trim( preg_replace( '/\t+/', '', $output ) );

	// Filterable return.
	return $output;
}
add_filter( 'merlin_generate_child_functions_php', 'edumodo_generate_child_functions_php', 10, 2 );

/**
 * demo import files
 */
function edumodo_local_import_files() {
	return array(
		array(
			'import_file_name'             => esc_html__('LearnPress V1','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v1/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v1/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v1/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('LearnPress V2','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v2/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v2/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v2/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('LearnPress V3','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v3/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v3/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/learnpress-v3/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('LearnDash V1','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/learndash-v1/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/learndash-v1/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/learndash-v1/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('Sensei V1','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/sensei-v1/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/sensei-v1/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/sensei-v1/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('Tutor University','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/tutor-university/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/tutor-university/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/tutor-university/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('Tutor V1','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/tutor-v1/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/tutor-v1/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/tutor-v1/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('University V1','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v1/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v1/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v1/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('University V2','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v2/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v2/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v2/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('University V3','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v3/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v3/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/university-v3/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('Language School','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/language-school/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/language-school/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/language-school/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('fitness-trainer','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/fitness-trainer/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/fitness-trainer/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/fitness-trainer/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('RTL','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/rtl/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/rtl/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/rtl/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		array(
			'import_file_name'             => esc_html__('Kids','edumodo'),
			'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/data/demos/kids/content.xml',
			'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/data/demos/kids/widget_data.json',
			'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'inc/data/demos/kids/customizer.dat',
			'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'edumodo' ),
        ),
		
	);
}
add_filter( 'merlin_import_files', 'edumodo_local_import_files' );

/**
 * Execute custom code after the whole import has finished.
 */
function edumodo_after_import_setup() {
	// Assign menus to their locations.
	$main_menu = get_term_by( 'name', 'Primary', 'nav_menu' );

	set_theme_mod(
		'nav_menu_locations', array(
			'primary' => $main_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 );

}
add_action( 'merlin_after_all_import', 'edumodo_after_import_setup' );

/**
 * Disable woocomemrce setup wizard
 */
add_filter('woocommerce_enable_setup_wizard','__return_false');

/**
 * Admin Menu Page For merlinwp Wizard
 */
add_action( 'admin_menu', 'edumodo_merlin_menu_page' );
function edumodo_merlin_menu_page()  {
	add_menu_page( 
        __( 'Theme Setup', 'textdomain' ),
        'Theme Setup',
        'manage_options',
        'tx-dashboard',
        'edumodo_merlin_custom_menu_page',
        get_parent_theme_file_uri( 'dist/images/fav.png' ),
        2
    );
}

function edumodo_merlin_custom_menu_page() {}

/**
 * Disable elementor and wpforms redirection
 */
function edumodo_remove_splash() { 
	delete_transient('elementor_activation_redirect');
	delete_transient('wpforms_activation_redirect');
	delete_transient('sensei_activation_redirect');
	delete_transient('_tribe_events_activation_redirect');
}
add_action( 'init', 'edumodo_remove_splash' );