<?php
/**
 *  Faced Top Header Option
 *
 * @since Faced 1.0.0
 *
 */
/*Top Header Options*/
$wp_customize->add_section( 'faced_header_section', array(
   'priority'       => 5,
   'capability'     => 'edit_theme_options',
   'theme_supports' => '',
   'title'          => __( 'Top Header Options', 'faced' ),
   'panel' 		 => 'faced_panel',
) );
/*callback functions header section*/
if ( !function_exists('faced_header_active_callback') ) :
  function faced_header_active_callback(){
      global $faced_theme_options;
      $faced_theme_options = faced_get_options_value();
      $enable_header = absint($faced_theme_options['faced-enable-top-header']);
      if( true == $enable_header ){
          return true;
      }
      else{
          return false;
      }
  }
endif;
/*Enable Top Header Section*/
$wp_customize->add_setting( 'faced_options[faced-enable-top-header]', array(
   'capability'        => 'edit_theme_options',
   'transport' => 'refresh',
   'default'           => $default['faced-enable-top-header'],
   'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-enable-top-header]', array(
   'label'     => __( 'Enable Top Header', 'faced' ),
   'description' => __('Checked to show the top header section like search and social icons', 'faced'),
   'section'   => 'faced_header_section',
   'settings'  => 'faced_options[faced-enable-top-header]',
   'type'      => 'checkbox',
   'priority'  => 5,
) );
/*Enable Social Icons In Header*/
$wp_customize->add_setting( 'faced_options[faced-enable-top-header-social]', array(
   'capability'        => 'edit_theme_options',
   'transport' => 'refresh',
   'default'           => $default['faced-enable-top-header-social'],
   'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-enable-top-header-social]', array(
   'label'     => __( 'Enable Social Icons', 'faced' ),
   'description' => __('You can show the social icons here. Manage social icons from Appearance > Menus. Social Menu will display here.', 'faced'),
   'section'   => 'faced_header_section',
   'settings'  => 'faced_options[faced-enable-top-header-social]',
   'type'      => 'checkbox',
   'priority'  => 5,
   'active_callback'=>'faced_header_active_callback'
) );

/*Enable Menu in top Header*/
$wp_customize->add_setting( 'faced_options[faced-enable-top-header-menu]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-enable-top-header-menu'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-enable-top-header-menu]', array(
    'label'     => __( 'Menu in Header', 'faced' ),
    'description' => __('Top Header Menu will display here. Go to Appearance < Menu.', 'faced'),
    'section'   => 'faced_header_section',
    'settings'  => 'faced_options[faced-enable-top-header-menu]',
    'type'      => 'checkbox',
    'priority'  => 5,
    'active_callback'=>'faced_header_active_callback'
) );

/*Enable Date in top Header*/
$wp_customize->add_setting( 'faced_options[faced-enable-top-header-search]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-enable-top-header-search'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-enable-top-header-search]', array(
    'label'     => __( 'Search in Header', 'faced' ),
    'description' => __('Enable Search icon in Header', 'faced'),
    'section'   => 'faced_header_section',
    'settings'  => 'faced_options[faced-enable-top-header-search]',
    'type'      => 'checkbox',
    'priority'  => 5,
    'active_callback'=>'faced_header_active_callback'
) );

/*callback functions header section*/
if ( !function_exists('faced_ads_header_active_callback') ) :
    function faced_ads_header_active_callback(){
        global $faced_theme_options;
        $faced_theme_options = faced_get_options_value();
        $enable_ads_header = absint($faced_theme_options['faced-enable-ads-header']);
        if( 1 == $enable_ads_header ){
            return true;
        }
        else{
            return false;
        }
    }
  endif;
/*Enable Header Ads Section*/
$wp_customize->add_setting( 'faced_options[faced-enable-ads-header]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-enable-ads-header'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
 ) );
 $wp_customize->add_control( 'faced_options[faced-enable-ads-header]', array(
    'label'     => __( 'Show Header Advertisement', 'faced' ),
    'description' => __('Checked to Enable the header ads. Select either image or google adsense.', 'faced'),
    'section'   => 'faced_header_section',
    'settings'  => 'faced_options[faced-enable-ads-header]',
    'type'      => 'checkbox',
    'priority'  => 5

 ) );

/*Top Header Ad Image Setting*/
$wp_customize->add_setting( 'faced_options[faced-top-header-ad-section-image]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-top-header-ad-section-image'],
    'sanitize_callback' => 'faced_sanitize_image'
) );
$wp_customize->add_control( 
new WP_Customize_Image_Control(
    $wp_customize,
    'faced_options[faced-top-header-ad-section-image]', 
    array(
    'label'     => __( 'Top Header Ad Section Image', 'faced' ),
    'description' => __('Add your own Ad Image in header section.', 'faced'),
    'section'   => 'faced_header_section',
    'settings'  => 'faced_options[faced-top-header-ad-section-image]',
    'type'      => 'image',
    'priority'  => 5,
    'active_callback'=>'faced_ads_header_active_callback',
    'description' => __( 'Recommended image size of 900*60', 'faced' ),

    )
) 
);

/*Ads Image Link*/
$wp_customize->add_setting( 'faced_options[faced-header-ads-image-link]', array(
    'capability'    => 'edit_theme_options',
    'default'     => $default['faced-header-ads-image-link'],
    'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'faced_options[faced-header-ads-image-link]', array(
    'label'   => __( 'Header Ads Image Link', 'faced' ),
    'section'   => 'faced_header_section',
    'settings'  => 'faced_options[faced-header-ads-image-link]',
    'type'      => 'url',
    'priority'  => 5,
    'active_callback'=>'faced_ads_header_active_callback',

) );
