<?php
/**
 * Tea Cafe: Customizer
 *
 * @subpackage Tea Cafe
 * @since 1.0
 */

use WPTRT\Customize\Section\Tea_Cafe_Button;

add_action( 'customize_register', function( $manager ) {

	$manager->register_section_type( Tea_Cafe_Button::class );

	$manager->add_section(
		new Tea_Cafe_Button( $manager, 'tea_cafe_pro', [
			'title' => __( 'Tea Cafe Pro', 'tea-cafe' ),
			'priority' => 0,
			'button_text' => __( 'Go Pro', 'tea-cafe' ),
			'button_url'  => esc_url( 'https://www.luzuk.com/products/tea-shop-wordpress-theme', 'tea-cafe')
		] )
	);

} );

// Load the JS and CSS.
add_action( 'customize_controls_enqueue_scripts', function() {

	$version = wp_get_theme()->get( 'Version' );

	wp_enqueue_script(
		'tea-cafe-customize-section-button',
		get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/js/customize-controls.js' ),
		[ 'customize-controls' ],
		$version,
		true
	);

	wp_enqueue_style(
		'tea-cafe-customize-section-button',
		get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/css/customize-controls.css' ),
		[ 'customize-controls' ],
 		$version
	);

} );

function tea_cafe_customize_register( $wp_customize ) {

	$wp_customize->add_setting('tea_cafe_logo_size',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_logo_size',array(
		'type' => 'range',
		'description' => __('Logo Size (0-100%)','tea-cafe'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('tea_cafe_logo_padding',array(
		'sanitize_callback'	=> 'esc_html'
	));
	$wp_customize->add_control('tea_cafe_logo_padding',array(
		'label' => __('Logo Margin','tea-cafe'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('tea_cafe_logo_top_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_logo_top_padding',array(
		'type' => 'number',
		'description' => __('Top','tea-cafe'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('tea_cafe_logo_bottom_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_logo_bottom_padding',array(
		'type' => 'number',
		'description' => __('Bottom','tea-cafe'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('tea_cafe_logo_left_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_logo_left_padding',array(
		'type' => 'number',
		'description' => __('Left','tea-cafe'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('tea_cafe_logo_right_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
 	));
 	$wp_customize->add_control('tea_cafe_logo_right_padding',array(
		'type' => 'number',
		'description' => __('Right','tea-cafe'),
		'section' => 'title_tagline',
    ));

	$wp_customize->add_setting('tea_cafe_show_site_title',array(
		'default' => true,
		'sanitize_callback'	=> 'tea_cafe_sanitize_checkbox'
	));
	$wp_customize->add_control('tea_cafe_show_site_title',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Title','tea-cafe'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting( 'tea_cafe_site_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_site_title_color', array(
		'label' => 'Title Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_setting('tea_cafe_show_tagline',array(
		'default' => true,
		'sanitize_callback'	=> 'tea_cafe_sanitize_checkbox'
	));
	$wp_customize->add_control('tea_cafe_show_tagline',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Tagline','tea-cafe'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting( 'tea_cafe_site_tagline_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_site_tagline_color', array(
		'label' => 'Tagline Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_panel( 'tea_cafe_panel_id', array(
		'priority' => 10,
		'capability' => 'edit_theme_options',
		'theme_supports' => '',
		'title' => __( 'Theme Settings', 'tea-cafe' ),
		'description' => __( 'Description of what this panel does.', 'tea-cafe' ),
	) );

	$wp_customize->add_section( 'tea_cafe_theme_options_section', array(
    	'title'      => __( 'General Settings', 'tea-cafe' ),
		'priority'   => 30,
		'panel' => 'tea_cafe_panel_id'
	) );

	$wp_customize->add_setting('tea_cafe_theme_options',array(
		'default' => 'One Column',
		'sanitize_callback' => 'tea_cafe_sanitize_choices'
	));
	$wp_customize->add_control('tea_cafe_theme_options',array(
		'type' => 'select',
		'label' => __('Blog Page Sidebar Layout','tea-cafe'),
		'section' => 'tea_cafe_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','tea-cafe'),
		   'Right Sidebar' => __('Right Sidebar','tea-cafe'),
		   'One Column' => __('One Column','tea-cafe'),
		   'Grid Layout' => __('Grid Layout','tea-cafe')
		),
	));

	$wp_customize->add_setting('tea_cafe_single_post_sidebar',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'tea_cafe_sanitize_choices'
	));
	$wp_customize->add_control('tea_cafe_single_post_sidebar',array(
        'type' => 'select',
        'label' => __('Single Post Sidebar Layout','tea-cafe'),
        'section' => 'tea_cafe_theme_options_section',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','tea-cafe'),
            'Right Sidebar' => __('Right Sidebar','tea-cafe'),
            'One Column' => __('One Column','tea-cafe')
        ),
	));

	$wp_customize->add_setting('tea_cafe_page_sidebar',array(
		'default' => 'One Column',
		'sanitize_callback' => 'tea_cafe_sanitize_choices'
	));
	$wp_customize->add_control('tea_cafe_page_sidebar',array(
        'type' => 'select',
        'label' => __('Page Sidebar Layout','tea-cafe'),
        'section' => 'tea_cafe_theme_options_section',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','tea-cafe'),
            'Right Sidebar' => __('Right Sidebar','tea-cafe'),
            'One Column' => __('One Column','tea-cafe')
        ),
	));

	$wp_customize->add_setting('tea_cafe_archive_page_sidebar',array(
		'default' => 'One Column',
		'sanitize_callback' => 'tea_cafe_sanitize_choices'
	));
	$wp_customize->add_control('tea_cafe_archive_page_sidebar',array(
        'type' => 'select',
        'label' => __('Archive & Search Page Sidebar Layout','tea-cafe'),
        'section' => 'tea_cafe_theme_options_section',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','tea-cafe'),
            'Right Sidebar' => __('Right Sidebar','tea-cafe'),
            'One Column' => __('One Column','tea-cafe'),
            'Grid Layout' => __('Grid Layout','tea-cafe')
        ),
	));

	$wp_customize->add_setting( 'tea_cafe_boxfull_width', array(
		'default'           => '',
		'sanitize_callback' => 'tea_cafe_sanitize_choices'
	));
	
	$wp_customize->add_control( 'tea_cafe_boxfull_width', array(
		'label'    => __( 'Section Width', 'tea-cafe' ),
		'section'  => 'tea_cafe_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'container'  => __('Box Width', 'tea-cafe'),
			'container-fluid' => __('Full Width', 'tea-cafe'),
			'none' => __('None', 'tea-cafe')
		),
	));

	$wp_customize->add_setting( 'tea_cafe_dropdown_anim', array(
		'default'           => 'None',
		'sanitize_callback' => 'tea_cafe_sanitize_choices'
	));
	$wp_customize->add_control( 'tea_cafe_dropdown_anim', array(
		'label'    => __( 'Menu Dropdown Animations', 'tea-cafe' ),
		'section'  => 'tea_cafe_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInUp'  => __('bounceInUp', 'tea-cafe'),
			'fadeInUp' => __('fadeInUp', 'tea-cafe'),
			'zoomIn'    => __('zoomIn', 'tea-cafe'),
			'None'    => __('None', 'tea-cafe')
		),
	));

	//Header
	$wp_customize->add_section( 'tea_cafe_header' , array(
    	'title'    => __( 'Header Section', 'tea-cafe' ),
		'priority' => null,
		'panel' => 'tea_cafe_panel_id'
	) );

	//home page slider
	$wp_customize->add_section( 'tea_cafe_slider_section' , array(
    	'title'    => __( 'Slider Settings', 'tea-cafe' ),
		'priority' => null,
		'panel' => 'tea_cafe_panel_id'
	) );

	$wp_customize->add_setting('tea_cafe_slider_hide_show',array(
    	'default' => false,
    	'sanitize_callback'	=> 'tea_cafe_sanitize_checkbox'
	));
	$wp_customize->add_control('tea_cafe_slider_hide_show',array(
	   	'type' => 'checkbox',
	   	'label' => __('Show / Hide Slider','tea-cafe'),
	   	'section' => 'tea_cafe_slider_section',
	));

	$wp_customize->add_setting( 'tea_cafe_slider_effect', array(
		'default'           => '',
		'sanitize_callback' => 'tea_cafe_sanitize_choices'
	));
	$wp_customize->add_control( 'tea_cafe_slider_effect', array(
		'label'    => __( 'Onload Transactions Effects', 'tea-cafe' ),
		'section'  => 'tea_cafe_slider_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInLeft'  => __('bounceInLeft', 'tea-cafe'),
			'bounceInRight' => __('bounceInRight', 'tea-cafe'),
			'bounceInUp'    => __('bounceInUp', 'tea-cafe'),
			'bounceInDown'    => __('bounceInDown', 'tea-cafe'),
			'zoomIn'  => __('zoomIn', 'tea-cafe'),
			'zoomOut' => __('zoomOut', 'tea-cafe'),
			'fadeInDown'    => __('fadeInDown', 'tea-cafe'),
			'fadeInUp'    => __('fadeInUp', 'tea-cafe'),
			'fadeInLeft'  => __('fadeInLeft', 'tea-cafe'),
			'fadeInRight' => __('fadeInRight', 'tea-cafe'),
			'flip-up'    => __('flip-up', 'tea-cafe'),
			'none'    => __('none', 'tea-cafe')
		),
	));

	for ( $count = 1; $count <= 4; $count++ ) {
		$wp_customize->add_setting( 'tea_cafe_slider' . $count, array(
			'default'           => '',
			'sanitize_callback' => 'tea_cafe_sanitize_dropdown_pages'
		));
		$wp_customize->add_control( 'tea_cafe_slider' . $count, array(
			'label' => __('Select Slider Image Page', 'tea-cafe' ),
			'section' => 'tea_cafe_slider_section',
			'type' => 'dropdown-pages'
		));
	}

	$wp_customize->add_setting('tea_cafe_slider_excerpt_length',array(
		'default' => '15',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_slider_excerpt_length',array(
		'type' => 'number',
		'label' => __('Description Excerpt Length','tea-cafe'),
		'section' => 'tea_cafe_slider_section',
	));

	$wp_customize->add_setting('tea_cafe_slider_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_slider_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','tea-cafe'),
		'section' => 'tea_cafe_slider_section',
	));

	$wp_customize->add_setting('tea_cafe_slider_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_slider_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Font Size','tea-cafe'),
		'section' => 'tea_cafe_slider_section',
	));

	$wp_customize->add_setting( 'tea_cafe_slider_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_slider_title_color', array(
		'label' => 'Slider Title Color',
		'section' => 'tea_cafe_slider_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_slider_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_slider_text_color', array(
		'label' => 'Slider Text Color',
		'section' => 'tea_cafe_slider_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_slider_btn_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_slider_btn_color', array(
		'label' => 'Slider Button Text Color',
		'section' => 'tea_cafe_slider_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_slider_btnbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_slider_btnbg_color', array(
		'label' => 'Slider Button Bg Color',
		'section' => 'tea_cafe_slider_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_slider_np_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_slider_np_color', array(
		'label' => 'Prev/Next Arror Color',
		'section' => 'tea_cafe_slider_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_slider_npbdr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_slider_npbdr_color', array(
		'label' => 'Prev/Next Arror Border Color',
		'section' => 'tea_cafe_slider_section',
	)));

	//Service Section
	$wp_customize->add_section('tea_cafe_service_section',array(
		'title'	=> __('Service Section','tea-cafe'),
		'description'=> __('<b>Note :</b> This section will appear below the slider.','tea-cafe'),
		'panel' => 'tea_cafe_panel_id',
	));


	$wp_customize->add_setting('tea_cafe_serviceheading',array(
    	'default' => '',
    	'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('tea_cafe_serviceheading',array(
	   	'type' => 'text',
	   	'label' => __('Heading','tea-cafe'),
	   	'section' => 'tea_cafe_service_section',
	));

	$wp_customize->add_setting('tea_cafe_serviceheading_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_serviceheading_font_size',array(
		'type' => 'number',
		'label' => __('Font Size','tea-cafe'),
		'section' => 'tea_cafe_service_section',
	));

	$categories = get_categories();
	$cats = array();
	$i = 0;
	$cat_pst[]= 'select';
	foreach($categories as $category){
		if($i==0){
			$default = $category->slug;
			$i++;
		}
		$cat_pst[$category->slug] = $category->name;
	}

	$wp_customize->add_setting('tea_cafe_service_category_setting',array(
		'default' => 'select',
		'sanitize_callback' => 'tea_cafe_sanitize_choices',
	));
	$wp_customize->add_control('tea_cafe_service_category_setting',array(
		'type' => 'select',
		'choices' => $cat_pst,
		'label' => __('Select Category To Display Post','tea-cafe'),
		'section' => 'tea_cafe_service_section',
	));

	$wp_customize->add_setting('tea_cafe_service_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_service_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','tea-cafe'),
		'section' => 'tea_cafe_service_section',
	));

	$wp_customize->add_setting('tea_cafe_service_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'tea_cafe_sanitize_float'
	));
	$wp_customize->add_control('tea_cafe_service_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Font Size','tea-cafe'),
		'section' => 'tea_cafe_service_section',
	));

	$wp_customize->add_setting( 'tea_cafe_service_heading_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_service_heading_color', array(
		'label' => 'Heading Color',
		'section' => 'tea_cafe_service_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_service_headingbdr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_service_headingbdr_color', array(
		'label' => 'Heading Border Color',
		'section' => 'tea_cafe_service_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_service_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_service_title_color', array(
		'label' => 'Title Color',
		'section' => 'tea_cafe_service_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_service_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_service_text_color', array(
		'label' => 'Text Color',
		'section' => 'tea_cafe_service_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_service_btn_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_service_btn_color', array(
		'label' => 'Button Text Color',
		'section' => 'tea_cafe_service_section',
	)));

	$wp_customize->add_setting( 'tea_cafe_service_btnbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tea_cafe_service_btnbg_color', array(
		'label' => 'Button Bg Color',
		'section' => 'tea_cafe_service_section',
	)));

	//Feature Section
	$wp_customize->add_section('tea_cafe_feature_section',array(
		'title'	=> __('Feature Section','tea-cafe'),
		'description'=> __('<b>Note :</b> This section will appear below the Service Section.','tea-cafe'),
		'panel' => 'tea_cafe_panel_id',
	));


	$wp_customize->add_setting('tea_cafe_featureheading',array(
    	'default' => '',
    	'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('tea_cafe_featureheading',array(
	   	'type' => 'text',
	   	'label' => __('Heading','tea-cafe'),
	   	'section' => 'tea_cafe_feature_section',
	));


	$categories = get_categories();
	$cats = array();
	$i = 0;
	$cat_pst[]= 'select';
	foreach($categories as $category){
		if($i==0){
			$default = $category->slug;
			$i++;
		}
		$cat_pst[$category->slug] = $category->name;
	}

	$wp_customize->add_setting('tea_cafe_feature_category_setting',array(
		'default' => 'select',
		'sanitize_callback' => 'tea_cafe_sanitize_choices',
	));
	$wp_customize->add_control('tea_cafe_feature_category_setting',array(
		'type' => 'select',
		'choices' => $cat_pst,
		'label' => __('Select Category To Display Post','tea-cafe'),
		'section' => 'tea_cafe_feature_section',
	));

	$wp_customize->add_setting('tea_cafe_feature_number',array(
		'default'	=> '3',
		'sanitize_callback'	=> 'sanitize_text_field',
	));
	$wp_customize->add_control('tea_cafe_feature_number',array(
		'label'	=> __('Number Of Posts To Show In A Category','tea-cafe'),
		'section' => 'tea_cafe_feature_section',
		'type'	  => 'number'
	));

	$tea_cafe_feature_number = get_theme_mod('tea_cafe_feature_number', 3);
	for ($i=1; $i <= $tea_cafe_feature_number; $i++) { 
	   	$wp_customize->add_setting('tea_cafe_feature_icon' . $i, array(
	      	'default' => 'fa fa-coffee',
	      	'sanitize_callback' => 'sanitize_text_field'
	   	));
	   	$wp_customize->add_control(new Tea_Cafe_Fontawesome_Icon_Chooser($wp_customize, 'tea_cafe_feature_icon' . $i, array(
	      	'section' => 'tea_cafe_feature_section',
	      	'type' => 'icon',
	      	'label' => esc_html__('Feature Icon ', 'tea-cafe') . $i
	  	)));
	}


	//Footer
    $wp_customize->add_section( 'tea_cafe_footer', array(
    	'title'  => __( 'Footer Settings', 'tea-cafe' ),
		'priority' => null,
		'panel' => 'tea_cafe_panel_id'
	) );

	$wp_customize->add_setting('tea_cafe_show_back_totop',array(
       'default' => true,
       'sanitize_callback'	=> 'tea_cafe_sanitize_checkbox'
    ));
    $wp_customize->add_control('tea_cafe_show_back_totop',array(
       'type' => 'checkbox',
       'label' => __('Show / Hide Back to Top','tea-cafe'),
       'section' => 'tea_cafe_footer'
    ));

    $wp_customize->add_setting('tea_cafe_footer_copy',array(
		'default' => '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('tea_cafe_footer_copy',array(
		'label'	=> __('Copyright Text','tea-cafe'),
		'section' => 'tea_cafe_footer',
		'setting' => 'tea_cafe_footer_copy',
		'type' => 'text'
	));

	

	$wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport  = 'postMessage';

	$wp_customize->selective_refresh->add_partial( 'blogname', array(
		'selector' => '.site-title a',
		'render_callback' => 'tea_cafe_customize_partial_blogname',
	) );
	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'render_callback' => 'tea_cafe_customize_partial_blogdescription',
	) );
}
add_action( 'customize_register', 'tea_cafe_customize_register' );

function tea_cafe_customize_partial_blogname() {
	bloginfo( 'name' );
}

function tea_cafe_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

if (class_exists('WP_Customize_Control')) {

   	class Tea_Cafe_Fontawesome_Icon_Chooser extends WP_Customize_Control {

      	public $type = 'icon';

      	public function render_content() { ?>
	     	<label>
	            <span class="customize-control-title">
	               <?php echo esc_html($this->label); ?>
	            </span>

	            <?php if ($this->description) { ?>
	                <span class="description customize-control-description">
	                   <?php echo wp_kses_post($this->description); ?>
	                </span>
	            <?php } ?>

	            <div class="tea-cafe-selected-icon">
	                <i class="fa <?php echo esc_attr($this->value()); ?>"></i>
	                <span><i class="fa fa-angle-down"></i></span>
	            </div>

	            <ul class="tea-cafe-icon-list clearfix">
	                <?php
	                $tea_cafe_font_awesome_icon_array = tea_cafe_font_awesome_icon_array();
	                foreach ($tea_cafe_font_awesome_icon_array as $tea_cafe_font_awesome_icon) {
	                   $icon_class = $this->value() == $tea_cafe_font_awesome_icon ? 'icon-active' : '';
	                   echo '<li class=' . esc_attr($icon_class) . '><i class="' . esc_attr($tea_cafe_font_awesome_icon) . '"></i></li>';
	                }
	                ?>
	            </ul>
	            <input type="hidden" value="<?php $this->value(); ?>" <?php $this->link(); ?> />
	        </label>
	        <?php
      	}
  	}
}
function tea_cafe_customizer_script() {
   wp_enqueue_style( 'font-awesome-1', esc_url(get_template_directory_uri()).'/assets/css/fontawesome-all.css');
}
add_action( 'customize_controls_enqueue_scripts', 'tea_cafe_customizer_script' );