<?php
/**
 * vw-book-store-pro Theme Customizer
 *
 * @package vw-book-store-pro
 */
/**
 * Loads custom control for layout settings
 */
function vw_book_store_pro_custom_controls() {
    require_once get_template_directory() . '/inc/customize/controls/admin/customize-texteditor-control.php';
     require_once get_template_directory() . '/inc/customize/controls/custom-controls.php';
     require_once get_template_directory() . '/inc/customize/controls/button-controls.php';

     // Inlcude the Alpha Color Picker control file.
    require_once get_template_directory() . '/inc/customize/controls/alpha-color-picker.php';
     get_stylesheet_directory_uri() . '/assets/js/alpha-color-picker.js';
     get_stylesheet_directory_uri() . '/assets/css/alpha-color-picker.css';

}
add_action( 'customize_register', 'vw_book_store_pro_custom_controls' );
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function vw_book_store_pro_customize_register( $wp_customize ) {
    $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
    $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';

    $wp_customize->selective_refresh->add_partial( 'blogname', array(
        'selector' => '.logo a',
        'render_callback' => 'twentyfifteen_customize_partial_blogname',
    ) );
    $wp_customize->selective_refresh->add_partial( 'blogdescription', array(
        'selector' => '.site-description',
        'render_callback' => 'twentyfifteen_customize_partial_blogdescription',
    ) );

    $wp_customize->add_setting('vw_book_store_pro_display_title',array(
        'default' => 'false',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('vw_book_store_pro_display_title',array(
        'type' => 'checkbox',
        'label' => __('Show Title','vw-book-store-pro'),
        'section' => 'title_tagline',
    ));
    $wp_customize->add_setting('vw_book_store_pro_display_tagline',array(
        'default' => 'false',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('vw_book_store_pro_display_tagline',array(
        'type' => 'checkbox',
        'label' => __('Show Tagline','vw-book-store-pro'),
        'section' => 'title_tagline',
    ));
    //add home page setting pannel
    $wp_customize->add_panel( 'vw_book_store_pro_panel_id', array(
        'priority' => 10,
        'capability' => 'edit_theme_options',
        'theme_supports' => '',
        'title' => __( 'Theme Settings', 'vw-book-store-pro' ),
        'description' => __( 'Description of what this panel does.', 'vw-book-store-pro' ),
    ) );
    $font_array = array(
        '' => __( 'No Fonts', 'vw-book-store-pro' ),
        'Abril Fatface' => __( 'Abril Fatface', 'vw-book-store-pro' ),
        'Acme' => __( 'Acme', 'vw-book-store-pro' ),
        'Anton' => __( 'Anton', 'vw-book-store-pro' ),
        'Architects Daughter' => __( 'Architects Daughter', 'vw-book-store-pro' ),
        'Arimo' => __( 'Arimo', 'vw-book-store-pro' ),
        'Arsenal' => __( 'Arsenal', 'vw-book-store-pro' ),
        'Arvo' => __( 'Arvo', 'vw-book-store-pro' ),
        'Alegreya' => __( 'Alegreya', 'vw-book-store-pro' ),
        'Alfa Slab One' => __( 'Alfa Slab One', 'vw-book-store-pro' ),
        'Averia Serif Libre' => __( 'Averia Serif Libre', 'vw-book-store-pro' ),
        'Bangers' => __( 'Bangers', 'vw-book-store-pro' ),
        'Boogaloo' => __( 'Boogaloo', 'vw-book-store-pro' ),
        'Bad Script' => __( 'Bad Script', 'vw-book-store-pro' ),
        'Bitter' => __( 'Bitter', 'vw-book-store-pro' ),
        'Bree Serif' => __( 'Bree Serif', 'vw-book-store-pro' ),
        'BenchNine' => __( 'BenchNine', 'vw-book-store-pro' ),
        'Cabin' => __( 'Cabin', 'vw-book-store-pro' ),
        'Cardo' => __( 'Cardo', 'vw-book-store-pro' ),
        'Courgette' => __( 'Courgette', 'vw-book-store-pro' ),
        'Cherry Swash' => __( 'Cherry Swash', 'vw-book-store-pro' ),
        'Cormorant Garamond' => __( 'Cormorant Garamond', 'vw-book-store-pro' ),
        'Crimson Text' => __( 'Crimson Text', 'vw-book-store-pro' ),
        'Cuprum' => __( 'Cuprum', 'vw-book-store-pro' ),
        'Cookie' => __( 'Cookie', 'vw-book-store-pro' ),
        'Chewy' => __( 'Chewy', 'vw-book-store-pro' ),
        'Days One' => __( 'Days One', 'vw-book-store-pro' ),
        'Dosis' => __( 'Dosis', 'vw-book-store-pro' ),
        'Economica' => __( 'Economica', 'vw-book-store-pro' ),
        'Fredoka One' => __( 'Fredoka One', 'vw-book-store-pro' ),
        'Fjalla One' => __( 'Fjalla One', 'vw-book-store-pro' ),
        'Francois One' => __( 'Francois One', 'vw-book-store-pro' ),
        'Frank Ruhl Libre' => __( 'Frank Ruhl Libre', 'vw-book-store-pro' ),
        'Gloria Hallelujah' => __( 'Gloria Hallelujah', 'vw-book-store-pro' ),
        'Great Vibes' => __( 'Great Vibes', 'vw-book-store-pro' ),
        'Handlee' => __( 'Handlee', 'vw-book-store-pro' ),
        'Hammersmith One' => __( 'Hammersmith One', 'vw-book-store-pro' ),
        'Inconsolata' => __( 'Inconsolata', 'vw-book-store-pro' ),
        'Indie Flower' => __( 'Indie Flower', 'vw-book-store-pro' ),
        'IM Fell English SC' => __( 'IM Fell English SC', 'vw-book-store-pro' ),
        'Julius Sans One' => __( 'Julius Sans One', 'vw-book-store-pro' ),
        'Josefin Slab' => __( 'Josefin Slab', 'vw-book-store-pro' ),
        'Josefin Sans' => __( 'Josefin Sans', 'vw-book-store-pro' ),
        'Kanit' => __( 'Kanit', 'vw-book-store-pro' ),
        'Lobster' => __( 'Lobster', 'vw-book-store-pro' ),
        'Lato' => __( 'Lato', 'vw-book-store-pro' ),
        'Lora' => __( 'Lora', 'vw-book-store-pro' ),
        'Libre Baskerville' => __( 'Libre Baskerville', 'vw-book-store-pro' ),
        'Lobster Two' => __( 'Lobster Two', 'vw-book-store-pro' ),
        'Merriweather' => __( 'Merriweather', 'vw-book-store-pro' ),
        'Monda' => __( 'Monda', 'vw-book-store-pro' ),
        'Montserrat' => __( 'Montserrat', 'vw-book-store-pro' ),
        'Muli' => __( 'Muli', 'vw-book-store-pro' ),
        'Marck Script' => __( 'Marck Script', 'vw-book-store-pro' ),
        'Noto Serif' => __( 'Noto Serif', 'vw-book-store-pro' ),
        'Open Sans' => __( 'Open Sans', 'vw-book-store-pro' ),
        'Overpass' => __( 'Overpass', 'vw-book-store-pro' ),
        'Overpass Mono' => __( 'Overpass Mono', 'vw-book-store-pro' ),
        'Oxygen' => __( 'Oxygen', 'vw-book-store-pro' ),
        'Orbitron' => __( 'Orbitron', 'vw-book-store-pro' ),
        'Patua One' => __( 'Patua One', 'vw-book-store-pro' ),
        'Pacifico' => __( 'Pacifico', 'vw-book-store-pro' ),
        'Padauk' => __( 'Padauk', 'vw-book-store-pro' ),
        'Playball' => __( 'Playball', 'vw-book-store-pro' ),
        'Playfair Display' => __( 'Playfair Display', 'vw-book-store-pro' ),
        'PT Sans' => __( 'PT Sans', 'vw-book-store-pro' ),
        'Philosopher' => __( 'Philosopher', 'vw-book-store-pro' ),
        'Permanent Marker' => __( 'Permanent Marker', 'vw-book-store-pro' ),
        'Poiret One' => __( 'Poiret One', 'vw-book-store-pro' ),
        'Quicksand' => __( 'Quicksand', 'vw-book-store-pro' ),
        'Quattrocento Sans' => __( 'Quattrocento Sans', 'vw-book-store-pro' ),
        'Raleway' => __( 'Raleway', 'vw-book-store-pro' ),
        'Rubik' => __( 'Rubik', 'vw-book-store-pro' ),
        'Rokkitt' => __( 'Rokkitt', 'vw-book-store-pro' ),
        'Russo One' => __( 'Russo One', 'vw-book-store-pro' ),
        'Righteous' => __( 'Righteous', 'vw-book-store-pro' ),
        'Slabo' => __( 'Slabo', 'vw-book-store-pro' ),
        'Source Sans Pro' => __( 'Source Sans Pro', 'vw-book-store-pro' ),
        'Shadows Into Light Two' => __( 'Shadows Into Light Two', 'vw-book-store-pro'),
        'Shadows Into Light' => __( 'Shadows Into Light', 'vw-book-store-pro' ),
        'Sacramento' => __( 'Sacramento', 'vw-book-store-pro' ),
        'Shrikhand' => __( 'Shrikhand', 'vw-book-store-pro' ),
        'Tangerine' => __( 'Tangerine', 'vw-book-store-pro' ),
        'Ubuntu' => __( 'Ubuntu', 'vw-book-store-pro' ),
        'VT323' => __( 'VT323', 'vw-book-store-pro' ),
        'Varela Round' => __( 'Varela Round', 'vw-book-store-pro' ),
        'Vampiro One' => __( 'Vampiro One', 'vw-book-store-pro' ),
        'Vollkorn' => __( 'Vollkorn', 'vw-book-store-pro' ),
        'Volkhov' => __( 'Volkhov', 'vw-book-store-pro' ),
        'Yanone Kaffeesatz' => __( 'Yanone Kaffeesatz', 'vw-book-store-pro' )
    );
    require_once get_template_directory() . '/inc/customize/controls/slider-line-control/slider-line-control.php';
    require_once get_template_directory() . '/inc/customize/controls/social-icons/social-icon-picker.php';    
     
    require_once get_template_directory() . '/inc/customize/controls/customizer-text-radio-button/class/customizer-text-radio-button.php';
    require_once get_template_directory() . '/inc/customize/controls/customizer-seperator/class/customizer-seperator.php';
     require_once get_template_directory() . '/inc/customize/controls/customizer-notice/class/customizer-notice.php';
    
    require_once get_template_directory() . '/inc/customize/controls/customize-repeater/customize-repeater.php';

   if ( (ThemeWhizzie::get_the_validation_status() === 'true') && (ThemeWhizzie::get_the_suspension_status() == 'false') ) {
    require_once get_template_directory() . '/inc/customize/sections/customizer-custom-variables.php';
    require_once get_template_directory() . '/inc/customize/sections/customizer-part-social-icons.php';
    require_once get_template_directory() . '/inc/customize/sections/customizer-part-header.php';
    require_once get_template_directory() . '/inc/customize/sections/customizer-part-slide.php';
    require_once get_template_directory() . '/inc/customize/sections/customizer-part-home.php';
    require_once get_template_directory() . '/inc/customize/sections/customizer-part-footer.php';

  }
}
add_action( 'customize_register', 'vw_book_store_pro_customize_register' );
//Integer
function vw_book_store_pro_sanitize_integer( $input ) {
    if( is_numeric( $input ) ) {
        return intval( $input );
    }
}

/* Logo Resizer */
load_template( trailingslashit( get_template_directory() ) . '/inc/logo/logo-resizer.php' );

/**
 * Singleton class for handling the theme's customizer integration.
 *
 * @since  1.0.0
 * @access public
 */
final class vw_book_store_pro_customize {
    /**
     * Returns the instance.
     *
     * @since  1.0.0
     * @access public
     * @return object
     */
    public static function get_instance() {
        static $instance = null;
        if ( is_null( $instance ) ) {
            $instance = new self;
            $instance->setup_actions();
        }
        return $instance;
    }
    /**
     * Constructor method.
     *
     * @since  1.0.0
     * @access private
     * @return void
     */
    private function __construct() {}
    /**
     * Sets up initial actions.
     *
     * @since  1.0.0
     * @access private
     * @return void
     */
    private function setup_actions() {
        // Register panels, sections, settings, controls, and partials.
        add_action( 'customize_register', array( $this, 'sections' ) );
         add_action( 'customize_register', array( $this, 'bundle' ) );
        // Register scripts and styles for the controls.
        add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 );
    }
    /**
     * Sets up the customizer sections.
     *
     * @since  1.0.0
     * @access public
     * @param  object  $manager
     * @return void
     */
    public function sections( $manager ) {
        // Load custom sections.
        load_template( trailingslashit( get_template_directory() ) . '/inc/review-section.php' );
        // Register custom section types.
        $manager->register_section_type( 'vw_book_store_pro_customize_reviews_and_testimonials' );
        // Register sections.
        $manager->add_section(
            new vw_book_store_pro_customize_reviews_and_testimonials(
                $manager,
                'example_1',
                array(
                    'title'    => esc_html__( 'Review & Testimonial', 'vw-book-store-pro' ),
                    'reviews_and_testimonials_text' => esc_html__( 'Rate Us', 'vw-book-store-pro' ),
                    'reviews_and_testimonials_url'  => 'https://www.vwthemes.com/topic/reviews-and-testimonials/',
                    'priority' =>1,
                )
            )
        );
    }

     public function bundle( $manager ) {
        // Load custom sections.
        load_template( trailingslashit( get_template_directory() ) . '/inc/review-section.php' );
        // Register custom section types.
        $manager->register_section_type( 'vw_book_store_pro_customize_reviews_and_testimonials' );
        // Register sections.
        $manager->add_section(
            new vw_book_store_pro_customize_reviews_and_testimonials(
                $manager,
                'example_2',
                array(
                    'title'    => esc_html__( 'Theme Bundle', 'vw-book-store-pro' ),
                    'reviews_and_testimonials_text' => esc_html__( 'Buy Now', 'vw-book-store-pro' ),
                    'reviews_and_testimonials_url'  => 'https://www.vwthemes.com/premium/theme-bundle/',
                    'priority' =>2,
                )
            )
        );
    }
    /**
     * Loads theme customizer CSS.
     *
     * @since  1.0.0
     * @access public
     * @return void
     */
    public function enqueue_control_scripts() {
        wp_enqueue_script( 'vw-book-store-pro-customize-controls', trailingslashit( get_template_directory_uri() ) . '/assets/js/customize-controls.js', array( 'customize-controls' ) );
        wp_enqueue_style( 'vw-book-store-pro-customize-controls', trailingslashit( get_template_directory_uri() ) . '/assets/css/customize-controls.css' );
    }
}
// Doing this customizer thang!
vw_book_store_pro_customize::get_instance();