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

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

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

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

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

/**
 * Front Page Active Callbackss
 */

/**
 * Check if video section content type is category.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_heading_tags_enable( $control ) {

	$tags = $control->manager->get_setting( 'ultravel_theme_options[heading_tags]' )->value();
	return ($control->id == 'ultravel_theme_options['.$tags.']');

}

// new 

/**
 * Check if slider section is enabled.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_hero_slider_section_enable( $control ) {
	return ( $control->manager->get_setting( 'ultravel_theme_options[hero_slider_section_enable]' )->value() );
}

/**
 * Check if hero_slider section content type is category.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_hero_slider_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[hero_slider_content_type]' )->value();
	return ultravel_is_hero_slider_section_enable( $control ) && ( 'category' == $content_type );
}

/**
 * Check if hero_slider section content type is page.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_hero_slider_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[hero_slider_content_type]' )->value();
	return ultravel_is_hero_slider_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if hero_slider section content type is post.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_hero_slider_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[hero_slider_content_type]' )->value();
	return ultravel_is_hero_slider_section_enable( $control ) && ( 'post' == $content_type );
}

function ultravel_is_hero_slider_section_content_trip_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[hero_slider_content_type]' )->value();
	return ultravel_is_hero_slider_section_enable( $control ) && ( 'trip' == $content_type );
}

/**
 * Check if about section is enabled.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_about_section_enable( $control ) {
	return ( $control->manager->get_setting( 'ultravel_theme_options[about_section_enable]' )->value() );
}


/**
 * Check if about section wp travel is enabled.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_about_section_content_destination_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[about_content_type]' )->value();
	return ultravel_is_about_section_enable( $control ) && class_exists( 'WP_Travel' );
}

/**
 * Check if activities section is enabled.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_activities_section_enable( $control ) {
	return ( $control->manager->get_setting( 'ultravel_theme_options[activities_section_enable]' )->value() );
}

/**
 * Check if activities section content type is page.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_activities_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[activities_content_type]' )->value();
	return ultravel_is_activities_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if activities section content type is post.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_activities_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[activities_content_type]' )->value();
	return ultravel_is_activities_section_enable( $control ) && ( 'post' == $content_type );
}

/**
 * Check if activities section content type is trip.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_activities_section_content_trip_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[activities_content_type]' )->value();
	return ultravel_is_activities_section_enable( $control ) && ( 'trip' == $content_type );
}

/**
 * Check if activities section content type is category.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_activities_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[activities_content_type]' )->value();
	return ultravel_is_activities_section_enable( $control ) && ( 'category' == $content_type );
}

/**
 * Check if activities section content type is trip types.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_activities_section_content_trip_types_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[activities_content_type]' )->value();
	return ultravel_is_activities_section_enable( $control ) && ( 'trip-types' == $content_type );
}

/**
 * Check if testimonial section is enabled.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_testimonial_section_enable( $control ) {
	return ( $control->manager->get_setting( 'ultravel_theme_options[testimonial_section_enable]' )->value() );
}

/**
 * Check if testimonial section content type is post.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_testimonial_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[testimonial_content_type]' )->value();
	return ultravel_is_testimonial_section_enable( $control ) && ( 'post' == $content_type );
}

/**
 * Check if testimonial section content type is page.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_testimonial_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[testimonial_content_type]' )->value();
	return ultravel_is_testimonial_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if testimonial section content type is category.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_testimonial_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[testimonial_content_type]' )->value();
	return ultravel_is_testimonial_section_enable( $control ) && ( 'category' == $content_type );
}

/**
 * Check if testimonial section content type is custom.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_testimonial_section_content_custom_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[testimonial_content_type]' )->value();
	return ultravel_is_testimonial_section_enable( $control ) && ( 'custom' == $content_type );
}

/**
 * Check if testimonial section content type is author.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_testimonial_section_content_author_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[testimonial_content_type]' )->value();
	return ultravel_is_testimonial_section_enable( $control ) && ( 'category' !== $content_type );
}


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

/**
 * Check if blog section content type is post.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_popular_posts_section_content_post_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[popular_posts_content_type]' )->value();
	return ultravel_is_popular_posts_section_enable( $control ) && ( 'post' == $content_type );
}

/**
 * Check if blog section content type is page.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_popular_posts_section_content_page_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[popular_posts_content_type]' )->value();
	return ultravel_is_popular_posts_section_enable( $control ) && ( 'page' == $content_type );
}

/**
 * Check if blog section content type is category.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_popular_posts_section_content_category_enable( $control ) {
	$content_type = $control->manager->get_setting( 'ultravel_theme_options[popular_posts_content_type]' )->value();
	return ultravel_is_popular_posts_section_enable( $control ) && ( 'category' == $content_type );
}


/**
 * Check if subscribe_now section is enabled.
 *
 * @since Ultravel 1.0.0
 * @param WP_Customize_Control $control WP_Customize_Control instance.
 * @return bool Whether the control is active to the current preview.
 */
function ultravel_is_subscribe_now_section_enable( $control ) {
	return ( $control->manager->get_setting( 'ultravel_theme_options[subscribe_now_section_enable]' )->value() );
}


/*========================Counter====================*/

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

	return $control->manager->get_setting( 'ultravel_theme_options[counter_section_enable]' )->value() ;
}

/*===========================service==================*/

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

	return $control->manager->get_setting( 'ultravel_theme_options[service_section_enable]' )->value() ;
}
