<?php
new impulsive_theme_customizer();

class impulsive_theme_customizer {
	public function __construct() {
		add_action( 'customize_register', array(&$this, 'impulsive_customize_function' ));
	}

	/**
	 * Customizer manager demo
	 * @param  WP_Customizer_Manager $wp_manager
	 * @return void
	 */
	public function impulsive_customize_function( $wp_manager ) {
		$this->impulsive_fonts_sections( $wp_manager );
	}

	private function impulsive_fonts_sections( $wp_manager ) {
		$wp_manager->add_section( 'impulsive_google_fonts_section', array(
			'title'       => __( 'Google Fonts', 'impulsive' ),
			'priority'       => 24,
		) );

		$font_choices = array(
			'Source Sans Pro' => 'Source Sans Pro',
			'Open Sans' => 'Open Sans',
			'Oswald' => 'Oswald',
			'Playfair Display' => 'Playfair Display',
			'Montserrat' => 'Montserrat',
			'Raleway' => 'Raleway',
			'Droid Sans' => 'Droid Sans',
			'Lato' => 'Lato',
			'Arvo' => 'Arvo',
			'Lora' => 'Lora',
			'Merriweather' => 'Merriweather',
			'Oxygen' => 'Oxygen',
			'PT Serif' => 'PT Serif',
			'PT Sans' => 'PT Sans',
			'PT Sans Narrow' => 'PT Sans Narrow',
			'Cabin' => 'Cabin',
			'Fjalla One',
			'Francois One',
			'Josefin Sans' => 'Josefin Sans',
			'Libre Baskerville' => 'Libre Baskerville',
			'Arimo' => 'Arimo',
			'Ubuntu' => 'Ubuntu',
			'Bitter' => 'Bitter',
			'Droid Serif' => 'Droid Serif',
			'Roboto' => 'Roboto',
			'Open Sans Condensed' => 'Open Sans Condensed',
			'Roboto Condensed' => 'Roboto Condensed',
			'Roboto Slab' => 'Roboto Slab',
			'Yanone Kaffeesatz' => 'Yanone Kaffeesatz',
			'Rokkitt' => 'Rokkitt',
		);

		$wp_manager->add_setting('impulsive_show_Google_Fonts',
	        array(
	            'sanitize_callback' => 'impulsive_sanitize_checkbox_function',
	            'default'           => 0,
	        )
	    );
	    $wp_manager->add_control('impulsive_show_Google_Fonts',
	        array(
	            'type'        => 'checkbox',
	            'label'       => esc_html__('Enable Fonts', 'impulsive'),
	            'section'     => 'impulsive_google_fonts_section',
	            'description' => esc_html__('Check this box to Enable Custom Fonts', 'impulsive'),
	        )
	    );

		$wp_manager->add_setting( 'impulsive_headings_fonts', array(
				'sanitize_callback' => 'impulsive_sanitize_fonts',
			)
		);

		$wp_manager->add_control( 'impulsive_headings_fonts', array(
				'type' => 'select',
				'description' => __('Select your desired font for the headings.', 'impulsive'),
				'section' => 'impulsive_google_fonts_section',
				'choices' => $font_choices
			)
		);

		$wp_manager->add_setting( 'impulsive_body_fonts', array(
				'sanitize_callback' => 'impulsive_sanitize_fonts'
			)
		);

		$wp_manager->add_control( 'impulsive_body_fonts', array(
				'type' => 'select',
				'description' => __( 'Select your desired font for the body.', 'impulsive' ),
				'section' => 'impulsive_google_fonts_section',
				'choices' => $font_choices
			)
		);
	}
}