<?php
/**
 * Customizer active callbacks
 *
 * @package Theme Palace
 * @subpackage  Charity Give
 * @since  Charity Give 1.0.0
 */

if ( ! function_exists( 'charity_give_is_loader_enable' ) ) :
	/**
	 * Check if loader is enabled.
	 *
	 * @since  Charity Give 1.0.0
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function charity_give_is_loader_enable( $control ) {
		return $control->manager->get_setting( 'charity_give_theme_options[loader_enable]' )->value();
	}
endif;

if ( ! function_exists( 'charity_give_is_static_homepage_enable' ) ) :
	/**
	 * Check if static homepage is enabled.
	 *
	 * @since Charity Give 1.0.0
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function charity_give_is_static_homepage_enable( $control ) {
		return ( 'page' == $control->manager->get_setting( 'show_on_front' )->value() );
	}
endif;

if ( ! function_exists( 'charity_give_is_breadcrumb_enable' ) ) :
	/**
	 * Check if breadcrumb is enabled.
	 *
	 * @since  Charity Give 1.0.0
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function charity_give_is_breadcrumb_enable( $control ) {
		return $control->manager->get_setting( 'charity_give_theme_options[breadcrumb_enable]' )->value();
	}
endif;

if ( ! function_exists( 'charity_give_is_pagination_enable' ) ) :
	/**
	 * Check if pagination is enabled.
	 *
	 * @since  Charity Give 1.0.0
	 * @param WP_Customize_Control $control WP_Customize_Control instance.
	 * @return bool Whether the control is active to the current preview.
	 */
	function charity_give_is_pagination_enable( $control ) {
		return $control->manager->get_setting( 'charity_give_theme_options[pagination_enable]' )->value();
	}
endif;

/**
 * Check if section is enabled in third design.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_third_design_enable( $control ) {
	$home_layout = $control->manager->get_setting( 'charity_give_theme_options[home_layout]' )->value();
	return (  $home_layout == 'third-design' ||  $home_layout == 'default-design' );
}


function charity_give_is_default_layout( $control ) {
	$design = $control->manager->get_setting( 'charity_give_theme_options[home_layout]' )->value();
	return ( 'default-design' == $design );
}
function charity_give_is_pro_layout( $control ) {
	$design = $control->manager->get_setting( 'charity_give_theme_options[home_layout]' )->value();
	return ( 'pro-design' == $design );
}

function charity_give_is_second_layout( $control ) {
	$design = $control->manager->get_setting( 'charity_give_theme_options[home_layout]' )->value();
	return ( 'second-design' == $design );
}

function charity_give_is_third_layout( $control ) {
	$design = $control->manager->get_setting( 'charity_give_theme_options[home_layout]' )->value();
	return ( 'third-design' == $design );
}

function charity_give_is_fourth_layout( $control ) {
	$design = $control->manager->get_setting( 'charity_give_theme_options[home_layout]' )->value();
	return ( 'fourth-design' == $design );
}

if ( ! function_exists( 'charity_give_is_nav_btn_enable' ) ) :
	
	function charity_give_is_nav_btn_enable( $control ) {
	return ( $control->manager->get_setting( 'charity_give_theme_options[nav_btn]' )->value() );
}
endif;

/*=========================hero banner=====================*/

/**
 * Check if hero_banner section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_hero_banner_section_enable( $control ) {
	return ( $control->manager->get_setting( 'charity_give_theme_options[hero_banner_section_enable]' )->value() );
}

/**
 * Check if hero_banner section content type is post.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_hero_banner_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[hero_banner_content_type]' )->value();
	return charity_give_is_hero_banner_section_enable( $control ) && ( 'post' == $content_type );
}

/**
 * Check if hero_banner section content type is page.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_hero_banner_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[hero_banner_content_type]' )->value();
	return charity_give_is_hero_banner_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if hero_banner section content type is category.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_hero_banner_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[hero_banner_content_type]' )->value();
	return charity_give_is_hero_banner_section_enable( $control ) && ( 'category' == $content_type );
}

/*========================featured slider====================*/

/**
 * Check if slider section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_featured_slider_section_enable( $control ) {

	return $control->manager->get_setting( 'charity_give_theme_options[featured_slider_section_enable]' )->value() ;
}


/*=======================featured=====================*/
/**
 * Check if featured section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_featured_section_enable( $control ) {
	return ( $control->manager->get_setting( 'charity_give_theme_options[featured_section_enable]' )->value() );
}

/**
 * Check if featured section content type is page.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_featured_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[featured_content_type]' )->value();
	return charity_give_is_featured_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if featured section content type is post.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_featured_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[featured_content_type]' )->value();
	return charity_give_is_featured_section_enable( $control ) && ( 'post' == $content_type );
}

/*========================about====================*/

/**
 * Check if slider section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_about_section_enable( $control ) {

	return $control->manager->get_setting( 'charity_give_theme_options[about_section_enable]' )->value() ;
}


/*==================Promotion===============*/

/**
 * Check if promotion section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_promotion_section_enable( $control ) {
	return ( $control->manager->get_setting( 'charity_give_theme_options[promotion_section_enable]' )->value() );
}

/**
 * Check if promotion section content type is page.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_promotion_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[promotion_content_type]' )->value();
	return charity_give_is_promotion_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if promotion section content type is post.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_promotion_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[promotion_content_type]' )->value();
	return charity_give_is_promotion_section_enable( $control ) && ( 'post' == $content_type );
}

/**
 * Check if promotion section content type is category.
 *
 * @since  Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_promotion_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[promotion_content_type]' )->value();
	return charity_give_is_promotion_section_enable( $control ) && ( 'category' == $content_type );
}

/**
 * Check if promotion section content type is custom.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_promotion_section_content_custom_enable( $control ) {
	$content_type = $control->manager->get_setting( 'charity_give_theme_options[promotion_content_type]' )->value();
	return charity_give_is_promotion_section_enable( $control ) && ( 'custom' == $content_type );
}

/*==================gallery===============*/

/**
 * Check if popular_product section is enabled.
 *
 * @since Medistore Pro 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_gallery_section_enable( $control ) {
    return ( $control->manager->get_setting( 'charity_give_theme_options[gallery_section_enable]' )->value() );
}

/**
 * Check if latest_posts section content type is post.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_gallery_section_content_post_enable( $control ) {
    $content_type = $control->manager->get_setting( 'charity_give_theme_options[gallery_content_type]' )->value();
    return charity_give_is_gallery_section_enable( $control ) && ( 'post' == $content_type );
}

/**
 * Check if gallery section content type is page.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_gallery_section_content_page_enable( $control ) {
    $content_type = $control->manager->get_setting( 'charity_give_theme_options[gallery_content_type]' )->value();
    return charity_give_is_gallery_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if gallery section content type is category.
 *
 * @since Medistore Pro 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_gallery_section_content_category_enable( $control ) {
    $content_type = $control->manager->get_setting( 'charity_give_theme_options[gallery_content_type]' )->value();
    return charity_give_is_gallery_section_enable( $control ) && ( 'category' == $content_type );
}


/**
 * Check if gallery section separator is enabled.
 *
 * @since  Medistore Pro 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_gallery_section_separator_enable( $control ) {
    $content_type = $control->manager->get_setting( 'charity_give_theme_options[gallery_content_type]' )->value();
    return charity_give_is_gallery_section_enable( $control ) && !( 'product-category' == $content_type );
}


/*=======================donation========================*/

/**
 * Check if Help us section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_donation_section_enable( $control ) {
    return ( $control->manager->get_setting( 'charity_give_theme_options[donation_section_enable]' )->value() );
}


/*=========================latest posts=====================*/

/**
 * Check if popular_posts section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_latest_posts_section_enable( $control ) {
    return ( $control->manager->get_setting( 'charity_give_theme_options[latest_posts_section_enable]' )->value() );
}


/*==================sponsor===============*/

/**
 * Check if sponsor section is enabled.
 *
 * @since Charity Give 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function charity_give_is_sponsor_section_enable( $control ) {
    return ( $control->manager->get_setting( 'charity_give_theme_options[sponsor_section_enable]' )->value() );
}
