<?php
/**
 * Feminine Lifestyle Blog Theme Customizer
 *
 * @package Feminine_Lifestyle_Blog
 */

/**
 * Requiring customizer panels & sections
*/
$feminine_lifestyle_blog_panels       = array( 'layout', 'homepage', 'general' );
$feminine_lifestyle_blog_sections     = array( 'site', 'info', 'footer', 'title', 'color' );
$feminine_lifestyle_blog_sub_sections = array(
    'layout'     => [ 'general', 'pagination' ],
    'general'    => [ 'social', 'seo', 'post', 'pages', 'header', 'fonts'],
    'homepage'   => [ 'slider', 'about', 'newsletter', 'instagram', 'cta' ]
);

foreach( $feminine_lifestyle_blog_sections as $s ){
    require get_template_directory() . '/inc/customizer-helpers/customizer/sections/' . $s . '.php';
}

foreach( $feminine_lifestyle_blog_panels as $p ){
   require get_template_directory() . '/inc/customizer-helpers/customizer/panels/' . $p . '.php';
}

foreach( $feminine_lifestyle_blog_sub_sections as $k => $v ){
    foreach( $v as $w ){        
        require get_template_directory() . '/inc/customizer-helpers/customizer/panels/' . $k . '/' . $w . '.php';
    }
}

/**
 * Sanitization Functions
*/
require get_template_directory() . '/inc/customizer-helpers/customizer/sanitization-functions.php';

/**
 * Active Callbacks
*/
require get_template_directory() . '/inc/customizer-helpers/customizer/active-callback.php';

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function feminine_lifestyle_blog_customize_preview_js() {
	wp_enqueue_script( 'feminine-lifestyle-blog-customizer', get_template_directory_uri() . '/inc/admin/js/customizer.js', array( 'customize-preview' ), FEMININE_LIFESTYLE_BLOG_THEME_VERSION, true );
}
add_action( 'customize_preview_init', 'feminine_lifestyle_blog_customize_preview_js' );


if ( ! function_exists( 'feminine_lifestyle_blog_customize_script' ) ) :
    /**
     * Add misc inline scripts to our controls.
     *
     * We don't want to add these to the controls themselves, as they will be repeated
     * each time the control is initialized.
     */
    function feminine_lifestyle_blog_customize_script() {
        wp_enqueue_style( 'feminine-lifestyle-blog-customize', get_template_directory_uri() . '/inc/admin/css/customize.css', array(), FEMININE_LIFESTYLE_BLOG_THEME_VERSION );
        wp_enqueue_script('feminine-lifestyle-blog-customize', get_template_directory_uri() . '/inc/admin/js/customize.js', array('jquery', 'customize-controls'), FEMININE_LIFESTYLE_BLOG_THEME_VERSION, true);
        
        wp_localize_script( 'feminine-lifestyle-blog-repeater', 'feminine_lifestyle_blog_customize',
            array(
                'nonce' => wp_create_nonce( 'feminine_lifestyle_blog_customize_nonce' )
            )
        );
    }
endif;
add_action( 'customize_controls_enqueue_scripts', 'feminine_lifestyle_blog_customize_script', 100 );

/*
 * Notifications in customizer
 */
require get_template_directory() . '/inc/customizer-helpers/customizer-plugin-recommend/plugin-install/class-plugin-install-helper.php';

require get_template_directory() . '/inc/customizer-helpers/customizer-plugin-recommend/plugin-install/class-plugin-recommend.php';