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

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

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

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

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

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


function pushpa_is_default_layout( $control ) {
	$design = $control->manager->get_setting( 'pushpa_theme_options[home_layout]' )->value();
	return ( 'default-design' == $design );
}
function pushpa_is_pro_layout( $control ) {
	$design = $control->manager->get_setting( 'pushpa_theme_options[home_layout]' )->value();
	return ( 'pro-design' == $design );
}

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

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

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

/*==================hero_content===============*/

/**
 * Check if hero_content section is enabled.
 *
 * @since Pushpa 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function pushpa_is_hero_content_section_enable( $control ) {
	return ( $control->manager->get_setting( 'pushpa_theme_options[hero_content_section_enable]' )->value() );
}

/**
 * Check if hero_content section seperator.
 *
 * @since Pushpa 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function pushpa_is_hero_content_section_content_seperator_enable( $control ) {
	$content_type = $control->manager->get_setting( 'pushpa_theme_options[hero_content_content_type]' )->value();
	return pushpa_is_hero_content_section_enable( $control ) && ( 'category' !== $content_type );
}

/**
 * Check if hero_content section content type is post.
 *
 * @since Pushpa 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function pushpa_is_hero_content_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'pushpa_theme_options[hero_content_content_type]' )->value();
	return pushpa_is_hero_content_section_enable( $control ) && ( 'post' == $content_type );
}

/**
 * Check if hero_content section content type is page.
 *
 * @since Pushpa 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function pushpa_is_hero_content_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'pushpa_theme_options[hero_content_content_type]' )->value();
	return pushpa_is_hero_content_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if hero_content section content type is category.
 *
 * @since Pushpa 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function pushpa_is_hero_content_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'pushpa_theme_options[hero_content_content_type]' )->value();
	return pushpa_is_hero_content_section_enable( $control ) && ( 'category' == $content_type );
}

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

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

/*=========================featured posts=====================*/

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


/**
 * Check if Call To Action section is enabled.
 *
 * @since Pushpa 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function pushpa_is_cta_section_enable( $control ) {
	return ( $control->manager->get_setting( 'pushpa_theme_options[cta_section_enable]' )->value() );
}

/*=========================popular posts=====================*/

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

/*=========================most recent posts=====================*/

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


/**
 * Check if latest_posts section content type is category.
 *
 * @since Pushpa 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function pushpa_is_latest_posts_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'pushpa_theme_options[latest_posts_content_type]' )->value();
	return pushpa_is_latest_posts_section_enable( $control ) && ( 'category' == $content_type );
}

function pushpa_is_topbar_section_enable( $control ) {
	return ( $control->manager->get_setting( 'pushpa_theme_options[topbar_section_enable]' )->value() );
}

function pushpa_is_header_advertisement_section_enable( $control ) {
	return ( $control->manager->get_setting( 'pushpa_theme_options[header_advertisement_section_enable]' )->value() );
}
