<?php
/**
 * Expert Mechanic: Customizer
 *
 * @subpackage Expert Mechanic
 * @since 1.0
 */

use WPTRT\Customize\Section\Expert_Mechanic_Button;

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

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

	$manager->add_section(
		new Expert_Mechanic_Button( $manager, 'expert_mechanic_pro', [
			'title'       => __( 'Expert Mechanic Pro', 'expert-mechanic' ),
			'priority'    => 0,
			'button_text' => __( 'Go Pro', 'expert-mechanic' ),
			'button_url'  => esc_url( 'https://www.luzuk.com/products/mechanic-wordpress-theme/', 'expert-mechanic')
		] )
	);

} );

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

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

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

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

} );

function expert_mechanic_customize_register( $wp_customize ) {

	$wp_customize->add_setting('expert_mechanic_logo_size',array(
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_logo_size',array(
		'type' => 'range',
		'label' => __('Logo Size','expert-mechanic'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('expert_mechanic_logo_padding',array(
		'sanitize_callback'	=> 'esc_html'
	));
	$wp_customize->add_control('expert_mechanic_logo_padding',array(
		'label' => __('Logo Padding','expert-mechanic'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('expert_mechanic_logo_top_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_logo_top_padding',array(
		'type' => 'number',
		'description' => __('Top','expert-mechanic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('expert_mechanic_logo_bottom_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_logo_bottom_padding',array(
		'type' => 'number',
		'description' => __('Bottom','expert-mechanic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('expert_mechanic_logo_left_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_logo_left_padding',array(
		'type' => 'number',
		'description' => __('Left','expert-mechanic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('expert_mechanic_logo_right_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_logo_right_padding',array(
		'type' => 'number',
		'description' => __('Right','expert-mechanic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('expert_mechanic_show_site_title',array(
		'default' => true,
		'sanitize_callback'	=> 'expert_mechanic_sanitize_checkbox'
 	));
 	$wp_customize->add_control('expert_mechanic_show_site_title',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Title','expert-mechanic'),
		'section' => 'title_tagline'
 	));

	$wp_customize->add_setting('expert_mechanic_site_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_site_title_font_size',array(
		'type' => 'number',
		'label' => __('Site Title Font Size','expert-mechanic'),
		'section' => 'title_tagline',
	));

 	$wp_customize->add_setting('expert_mechanic_show_tagline',array(
    	'default' => true,
    	'sanitize_callback'	=> 'expert_mechanic_sanitize_checkbox'
 	));
 	$wp_customize->add_control('expert_mechanic_show_tagline',array(
    	'type' => 'checkbox',
    	'label' => __('Show / Hide Site Tagline','expert-mechanic'),
    	'section' => 'title_tagline'
 	));

	$wp_customize->add_setting('expert_mechanic_site_tagline_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_site_tagline_font_size',array(
		'type' => 'number',
		'label' => __('Site Tagline Font Size','expert-mechanic'),
		'section' => 'title_tagline',
	));

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

	$wp_customize->add_section( 'expert_mechanic_theme_options_section', array(
    	'title'      => __( 'General Settings', 'expert-mechanic' ),
		'priority'   => 30,
		'panel' => 'expert_mechanic_panel_id'
	) );

	$wp_customize->add_setting('expert_mechanic_theme_options',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'expert_mechanic_sanitize_choices'
	));
	$wp_customize->add_control('expert_mechanic_theme_options',array(
		'type' => 'select',
		'label' => __('Product Page Sidebar Layout','expert-mechanic'),
		'section' => 'expert_mechanic_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','expert-mechanic'),
		   'Right Sidebar' => __('Right Sidebar','expert-mechanic'),
		   'One Column' => __('One Column','expert-mechanic')
		),
	));

	$wp_customize->add_setting('expert_mechanic_archive_page_sidebar',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'expert_mechanic_sanitize_choices'
	));
	$wp_customize->add_control('expert_mechanic_archive_page_sidebar',array(
		'type' => 'select',
		'label' => __('Archive & Search Page Sidebar Layout','expert-mechanic'),
		'section' => 'expert_mechanic_theme_options_section',
		'choices' => array(
			'Left Sidebar' => __('Left Sidebar','expert-mechanic'),
			'Right Sidebar' => __('Right Sidebar','expert-mechanic'),
			'One Column' => __('One Column','expert-mechanic'),
		    'Three Columns' => __('Three Columns','expert-mechanic'),
		    'Four Columns' => __('Four Columns','expert-mechanic'),
			'Grid Layout' => __('Grid Layout','expert-mechanic')
		),
	));

	$wp_customize->add_setting('expert_mechanic_single_post_sidebar',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'expert_mechanic_sanitize_choices'
	));
	$wp_customize->add_control('expert_mechanic_single_post_sidebar',array(
		'type' => 'select',
		'label' => __('Single Post Sidebar Layout','expert-mechanic'),
		'section' => 'expert_mechanic_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','expert-mechanic'),
		   'Right Sidebar' => __('Right Sidebar','expert-mechanic'),
		   'One Column' => __('One Column','expert-mechanic')
		),
	));

	$wp_customize->add_setting('expert_mechanic_page_sidebar',array(
		'default' => 'One Column',
		'sanitize_callback' => 'expert_mechanic_sanitize_choices'
	));
	$wp_customize->add_control('expert_mechanic_page_sidebar',array(
		'type' => 'select',
		'label' => __('Page Sidebar Layout','expert-mechanic'),
		'section' => 'expert_mechanic_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','expert-mechanic'),
		   'Right Sidebar' => __('Right Sidebar','expert-mechanic'),
		   'One Column' => __('One Column','expert-mechanic')
		),
	));

	$wp_customize->add_setting( 'expert_mechanic_boxfull_width', array(
		'default'           => '',
		'sanitize_callback' => 'expert_mechanic_sanitize_choices'
	));
	
	$wp_customize->add_control( 'expert_mechanic_boxfull_width', array(
		'label'    => __( 'Section Width', 'expert-mechanic' ),
		'section'  => 'expert_mechanic_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'container'  => __('Box Width', 'expert-mechanic'),
			'container-fluid' => __('Full Width', 'expert-mechanic'),
			'none' => __('None', 'expert-mechanic')
		),
	));

	$wp_customize->add_setting( 'expert_mechanic_dropdown_anim', array(
		'default'           => 'None',
		'sanitize_callback' => 'expert_mechanic_sanitize_choices'
	));
	$wp_customize->add_control( 'expert_mechanic_dropdown_anim', array(
		'label'    => __( 'Menu Dropdown Animations', 'expert-mechanic' ),
		'section'  => 'expert_mechanic_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInUp'  => __('bounceInUp', 'expert-mechanic'),
			'fadeInUp' => __('fadeInUp', 'expert-mechanic'),
			'zoomIn'    => __('zoomIn', 'expert-mechanic'),
			'None'    => __('None', 'expert-mechanic')
		),
	));

	//Topbar section
	$wp_customize->add_section( 'expert_mechanic_topbar_section' , array(
    	'title'    => __( 'Topbar Section', 'expert-mechanic' ),
		'priority' => null,
		'panel' => 'expert_mechanic_panel_id'
	) );

	$wp_customize->add_setting('expert_mechanic_hide_show_topbar',array(
    	'default' => false,
    	'sanitize_callback'	=> 'expert_mechanic_sanitize_checkbox'
	));
	$wp_customize->add_control('expert_mechanic_hide_show_topbar',array(
   	'type' => 'checkbox',
   	'label' => __('Show / Hide Topbar','expert-mechanic'),
   	'section' => 'expert_mechanic_topbar_section',
	));

	$wp_customize->add_setting('expert_mechanic_email',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_email'
	));	
	$wp_customize->add_control('expert_mechanic_email',array(
		'label'	=> __('Email','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('expert_mechanic_call',array(
		'default'	=> '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_phone_number'
	));	
	$wp_customize->add_control('expert_mechanic_call',array(
		'label'	=> __('Phone No.','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('expert_mechanic_facebook',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('expert_mechanic_facebook',array(
		'label'	=> __('Add Facebook Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'url'
	));

	$wp_customize->add_setting('expert_mechanic_twitter',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('expert_mechanic_twitter',array(
		'label'	=> __('Add Twitter Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'url'
	));

	$wp_customize->add_setting('expert_mechanic_pinterest',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('expert_mechanic_pinterest',array(
		'label'	=> __('Add Pinterest Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'url'
	));

	$wp_customize->add_setting('expert_mechanic_instagram',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('expert_mechanic_instagram',array(
		'label'	=> __('Add Instagram Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'url'
	));

	$wp_customize->add_setting('expert_mechanic_youtube',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('expert_mechanic_youtube',array(
		'label'	=> __('Add Youtube Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'url'
	));

	$wp_customize->add_setting('expert_mechanic_linkedin',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('expert_mechanic_linkedin',array(
		'label'	=> __('Add Linkedin Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'url'
	));

	$wp_customize->add_setting( 'expert_mechanic_social_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_social_color', array(
		'label' => 'Social Icons Color',
		'section' => 'expert_mechanic_topbar_section',
	)));

	$wp_customize->add_setting( 'expert_mechanic_socialhover_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_socialhover_color', array(
		'label' => 'Social Icons Hover Color',
		'section' => 'expert_mechanic_topbar_section',
	)));

	$wp_customize->add_setting( 'expert_mechanic_menu_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_menu_color', array(
		'label' => 'Menus Color',
		'section' => 'expert_mechanic_topbar_section',
	)));

	$wp_customize->add_setting('expert_mechanic_button_text',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('expert_mechanic_button_text',array(
		'label'	=> __('Add Button Text','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('expert_mechanic_button_link',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('expert_mechanic_button_link',array(
		'label'	=> __('Add Button Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_topbar_section',
		'type'		=> 'url'
	));

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

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

	$wp_customize->add_setting( 'expert_mechanic_topbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_topbg_color', array(
		'label' => 'Top Bar Background Color',
		'section' => 'expert_mechanic_topbar_section',
	)));

	//home page slider
	$wp_customize->add_section( 'expert_mechanic_slider_section' , array(
    	'title'      => __( 'Slider Settings', 'expert-mechanic' ),
		'priority'   => null,
		'panel' => 'expert_mechanic_panel_id'
	) );

	$wp_customize->add_setting('expert_mechanic_slider_hide_show',array(
    	'default' => false,
    	'sanitize_callback'	=> 'expert_mechanic_sanitize_checkbox'
	));
	$wp_customize->add_control('expert_mechanic_slider_hide_show',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide slider','expert-mechanic'),
		'section' => 'expert_mechanic_slider_section',
	));

	$wp_customize->add_setting( 'expert_mechanic_slider_effect', array(
		'default'           => '',
		'sanitize_callback' => 'expert_mechanic_sanitize_choices'
	));
	$wp_customize->add_control( 'expert_mechanic_slider_effect', array(
		'label'    => __( 'Onload Transactions Effects', 'expert-mechanic' ),
		'section'  => 'expert_mechanic_slider_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInLeft'  => __('bounceInLeft', 'expert-mechanic'),
			'bounceInRight' => __('bounceInRight', 'expert-mechanic'),
			'bounceInUp'    => __('bounceInUp', 'expert-mechanic'),
			'bounceInDown'    => __('bounceInDown', 'expert-mechanic'),
			'zoomIn'  => __('zoomIn', 'expert-mechanic'),
			'zoomOut' => __('zoomOut', 'expert-mechanic'),
			'fadeInDown'    => __('fadeInDown', 'expert-mechanic'),
			'fadeInUp'    => __('fadeInUp', 'expert-mechanic'),
			'fadeInLeft'  => __('fadeInLeft', 'expert-mechanic'),
			'fadeInRight' => __('fadeInRight', 'expert-mechanic'),
			'flip-up'    => __('flip-up', 'expert-mechanic'),
			'none'    => __('none', 'expert-mechanic')
		),
	));

	for ( $count = 1; $count <= 4; $count++ ) {
		$wp_customize->add_setting( 'expert_mechanic_slider' . $count, array(
			'default'           => '',
			'sanitize_callback' => 'expert_mechanic_sanitize_dropdown_pages'
		) );
		$wp_customize->add_control( 'expert_mechanic_slider' . $count, array(
			'label' => __( 'Select Slide Image Page', 'expert-mechanic' ),
			'section' => 'expert_mechanic_slider_section',
			'type' => 'dropdown-pages'
		) );
	}

	$wp_customize->add_setting('expert_mechanic_slider_excerpt_length',array(
		'default' => '15',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_slider_excerpt_length',array(
		'type' => 'number',
		'label' => __('Slider Excerpt Length','expert-mechanic'),
		'section' => 'expert_mechanic_slider_section',
	));

	$wp_customize->add_setting('expert_mechanic_slider_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_slider_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','expert-mechanic'),
		'section' => 'expert_mechanic_slider_section',
	));

	$wp_customize->add_setting('expert_mechanic_slider_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_slider_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Font Size','expert-mechanic'),
		'section' => 'expert_mechanic_slider_section',
	));

	$wp_customize->add_setting('expert_mechanic_slider_opacity',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_slider_opacity',array(
		'type' => 'range',
		'label' => __('Image Opacity','expert-mechanic'),
		'section' => 'expert_mechanic_slider_section',
		'input_attrs' => array(
			'min' => 0,
			'max' => 1,
			'step' => 0.1,
		),
	));

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

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

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

	// Our Expertise 
	$wp_customize->add_section('expert_mechanic_services_section',array(
		'title'	=> __('Our Expertise','expert-mechanic'),
		'description'=> __('<b>Note :</b> This section will appear below the Slider section.','expert-mechanic'),
		'panel' => 'expert_mechanic_panel_id',
	));
	
	$wp_customize->add_setting('expert_mechanic_services_title',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('expert_mechanic_services_title',array(
		'label'	=> __('Section Title','expert-mechanic'),
		'section'	=> 'expert_mechanic_services_section',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('expert_mechanic_service_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_service_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','expert-mechanic'),
		'section' => 'expert_mechanic_services_section',
	));

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

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

	$wp_customize->add_setting('expert_mechanic_services_cat',array(
		'default'	=> 'select',
		'sanitize_callback' => 'expert_mechanic_sanitize_select',
	));
	$wp_customize->add_control('expert_mechanic_services_cat',array(
		'type'    => 'select',
		'choices' => $cat_pst4,
		'label' => __('Select Category To Display Posts','expert-mechanic'),
		'section' => 'expert_mechanic_services_section',
	));
	
	$wp_customize->add_setting('expert_mechanic_service_img_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_service_img_size',array(
		'type' => 'number',
		'label' => __('Image Size','expert-mechanic'),
		'section' => 'expert_mechanic_services_section',
	));

	$wp_customize->add_setting('expert_mechanic_service_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_service_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','expert-mechanic'),
		'section' => 'expert_mechanic_services_section',
	));

	$wp_customize->add_setting('expert_mechanic_service_section_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_service_section_padding',array(
		'type' => 'number',
		'label' => __('Section Top Bottom Padding','expert-mechanic'),
		'section' => 'expert_mechanic_services_section',
	));

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

	$wp_customize->add_setting( 'expert_mechanic_bxtbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_bxtbg_color', array(
		'label' => 'Box Title Bg Color',
		'section' => 'expert_mechanic_services_section',
	)));

	//Footer
   	$wp_customize->add_section( 'expert_mechanic_footer', array(
    	'title'      => __( 'Footer Setting', 'expert-mechanic' ),
		'priority'   => null,
		'panel' => 'expert_mechanic_panel_id'
	) );

	$wp_customize->add_setting('expert_mechanic_show_back_totop',array(
 		'default' => true,
   		'sanitize_callback'	=> 'expert_mechanic_sanitize_checkbox'
	));
	$wp_customize->add_control('expert_mechanic_show_back_totop',array(
	   	'type' => 'checkbox',
	   	'label' => __('Show / Hide Back to Top','expert-mechanic'),
	   	'section' => 'expert_mechanic_footer'
	));

   	$wp_customize->add_setting('expert_mechanic_footer_link',array(
		'default'	=> 'https://www.luzuk.com/products/free-mechanic-wordpress-theme/',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('expert_mechanic_footer_link',array(
		'label'	=> __('Copyright Link','expert-mechanic'),
		'section'	=> 'expert_mechanic_footer',
		'setting'	=> 'expert_mechanic_footer_link',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('expert_mechanic_footer_copy',array(
		'default'	=> 'Expert Mechanic WordPress Theme By Luzuk',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('expert_mechanic_footer_copy',array(
		'label'	=> __('Copyright Text','expert-mechanic'),
		'section'	=> 'expert_mechanic_footer',
		'setting'	=> 'expert_mechanic_footer_copy',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('expert_mechanic_footer_copy_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
	));
	$wp_customize->add_control('expert_mechanic_footer_copy_font_size',array(
		'type' => 'number',
		'label' => __('Font Size','expert-mechanic'),
		'section' => 'expert_mechanic_footer',
	));

	$wp_customize->add_setting('expert_mechanic_copyright_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'expert_mechanic_sanitize_float'
 	));
 	$wp_customize->add_control('expert_mechanic_copyright_padding',array(
		'type' => 'number',
		'label' => __('Copyright Top Bottom Padding','expert-mechanic'),
		'section' => 'expert_mechanic_footer',
	));

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

	$wp_customize->add_setting( 'expert_mechanic_widgets_menu_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_widgets_menu_color', array(
		'label' => 'Widgets Menus Color',
		'section' => 'expert_mechanic_footer',
	)));

	$wp_customize->add_setting( 'expert_mechanic_footerbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_footerbg_color', array(
		'label' => 'Footer Bg Color',
		'section' => 'expert_mechanic_footer',
	)));

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

	$wp_customize->add_setting( 'expert_mechanic_copyrightbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_copyrightbg_color', array(
		'label' => 'Copyright Bg Color',
		'section' => 'expert_mechanic_footer',
	)));

	$wp_customize->add_setting( 'expert_mechanic_footer_ngicon_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'expert_mechanic_footer_ngicon_color', array(
		'label' => 'NG Icon Color',
		'section' => 'expert_mechanic_footer',
	)));

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

	$wp_customize->register_section_type( Expert_Mechanic_Button::class );

	$wp_customize->add_section(
		new Expert_Mechanic_Button( $wp_customize, 'expert_mechanic_pro_;ink', [
			'title'       => __( 'Expert Mechanic Pro', 'expert-mechanic' ),
			'priority'    => 0,
			'button_text' => __( 'Go Pro', 'expert-mechanic' ),
			'button_url'  => esc_url( 'https://www.luzuk.com/products/mechanic-wordpress-theme/', 'expert-mechanic'),
			'panel' => 'expert_mechanic_panel_id'
		] )
	);

	$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' => 'expert_mechanic_customize_partial_blogname',
	) );
	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'render_callback' => 'expert_mechanic_customize_partial_blogdescription',
	) );
}
add_action( 'customize_register', 'expert_mechanic_customize_register' );

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

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

function expert_mechanic_is_static_front_page() {
	return ( is_front_page() && ! is_home() );
}

function expert_mechanic_is_view_with_layout_option() {
	// This option is available on all pages. It's also available on archives when there isn't a sidebar.
	return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) );
}