<?php 
function wlsbusiness_genral_settings_fucntion( $wp_customize ){

	/* GENRAL SETTINGS */
	$wp_customize->add_panel( 'general_settings', array(
		'priority'       => 125,
		'capability'     => 'edit_theme_options',
		'title'      => __('General Settings', 'business' ),
	) );
		
		/* Top Header */
		$wp_customize->add_section( 'top_header' , array(
			'title'      => __('Top Header', 'business' ),
			'panel'  => 'general_settings'
		) );
	
			// header left icon1
			$wp_customize->add_setting( 'business_option[header-left-icon1]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-left-icon1]' , array(
			'label' => __('Top Header Icon 1','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// header left text1
			$wp_customize->add_setting( 'business_option[header-left-text1]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-left-text1]' , array(
			'label' => __('Top Header Text 1','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// header left icon2
			$wp_customize->add_setting( 'business_option[header-left-icon2]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-left-icon2]' , array(
			'label' => __('Top Header Icon 2','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// header left text2
			$wp_customize->add_setting( 'business_option[header-left-text2]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-left-text2]' , array(
			'label' => __('Top Header Text 2','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// facebook url
			$wp_customize->add_setting( 'business_option[header-facebook-url]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-facebook-url]' , array(
			'label' => __('Header Facebook URL','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// twitter url
			$wp_customize->add_setting( 'business_option[header-twitter-url]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-twitter-url]' , array(
			'label' => __('Header Twitter URL','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// linkedin url
			$wp_customize->add_setting( 'business_option[header-linkedin-url]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-linkedin-url]' , array(
			'label' => __('Header Linked In URL','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// googleplus url
			$wp_customize->add_setting( 'business_option[header-googleplus-url]' , array(
			'default'    => '',
			'sanitize_callback' => 'sanitize_text_field',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-googleplus-url]' , array(
			'label' => __('Header Google Plus URL','business' ),
			'section' => 'top_header',
			'type'=>'text',
			) );
			
			// open window
			$wp_customize->add_setting( 'business_option[header-social-target]' , array(
			'default'    => false,
			'sanitize_callback' => 'wlsbusiness_sanitize_checkbox',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[header-social-target]' , array(
			'label' => __('Social icons open window in new tab','business' ),
			'section' => 'top_header',
			'type'=>'checkbox',
			) );
			
			// hide top header
			$wp_customize->add_setting( 'business_option[top-header-hide]' , array(
			'default'    => false,
			'sanitize_callback' => 'wlsbusiness_sanitize_checkbox',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[top-header-hide]' , array(
			'label' => __('Top header bar hide','business' ),
			'section' => 'top_header',
			'type'=>'checkbox',
			) );
			
		/* footer settings */
		$wp_customize->add_section( 'footer_settings' , array(
			'title'      => __('Footer Settings', 'business' ),
			'panel'  => 'general_settings'
		) );
		
			// footer copyright
			$wp_customize->add_setting( 'business_option[footer_copyright]' , array(
			'default'    => '',
			'type'=>'option',
			'sanitize_callback' => 'wlsbusiness_sanitize_text',
			));

			$wp_customize->add_control('business_option[footer_copyright]' , array(
			'label' => __('Footer Copyright Text','business' ),
			'section' => 'footer_settings',
			'type'=>'text',
			) );
			
			// footer social icon enable / disable
			$wp_customize->add_setting( 'business_option[footer_socialicon_enable]' , array(
			'default'    => true,
			'sanitize_callback' => 'wlsbusiness_sanitize_checkbox',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[footer_socialicon_enable]' , array(
			'label' => __('Footer Social Icons Enable','business' ),
			'section' => 'footer_settings',
			'type'=>'checkbox',
			) );
			
			// footer social icon title
			$wp_customize->add_setting( 'business_option[footer_socialicon_title]' , array(
			'default'    => '',
			'type'=>'option',
			'sanitize_callback' => 'wlsbusiness_sanitize_text',
			));

			$wp_customize->add_control('business_option[footer_socialicon_title]' , array(
			'label' => __('Footer social icon title','business' ),
			'section' => 'footer_settings',
			'type'=>'text',
			) );
			
			// footer menus
			$wp_customize->add_setting( 'business_option[footer_menu]' , array(
			'default'    => true,
			'sanitize_callback' => 'wlsbusiness_sanitize_checkbox',
			'type'=>'option'
			));

			$wp_customize->add_control('business_option[footer_menu]' , array(
			'label' => __('Footer Menu Enable','business' ),
			'section' => 'footer_settings',
			'type'=>'checkbox',
			) );
}
add_action( 'customize_register', 'wlsbusiness_genral_settings_fucntion' );

/*
 * business sanitize text function
 */
function wlsbusiness_sanitize_text( $input ) {
    return wp_kses_post( force_balance_tags( $input ) );
}

/*
 * business sanitize checkbox function
 */
function wlsbusiness_sanitize_checkbox( $checked ) {
    // Boolean check.
	return ( ( isset( $checked ) && true == $checked ) ? true : false );
}
