<?php
/**
 * Collection of active callback functions.
 *
 * @package Masonry_Blog
 */

if ( ! function_exists( 'masonry_blog_is_active_banner' ) ) {
	/**
	 * Checks if banner is enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_is_active_banner( $control ) {

		return $control->manager->get_setting( 'masonry_blog_display_banner' )->value();
	}
}


/**
 * Active callback function for when top header is active.
 */
if ( ! function_exists( 'masonry_blog_is_active_top_header' ) ) {
	/**
	 * Checks if top header is enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_is_active_top_header( $control ) {

		return $control->manager->get_setting( 'masonry_blog_display_top_header' )->value();
	}
}


if ( ! function_exists( 'masonry_blog_is_active_top_header_menu' ) ) {
	/**
	 * Checks if top header menu is enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_is_active_top_header_menu( $control ) {

		return (
			$control->manager->get_setting( 'masonry_blog_display_top_header' )->value() === true &&
			$control->manager->get_setting( 'masonry_blog_enable_top_header_menu' )->value() === true
			) ? true : false;
	}
}


if ( ! function_exists( 'masonry_blog_is_active_social_menu' ) ) {
	/**
	 * Checks if social menu is enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_is_active_social_menu( $control ) {

		return (
			$control->manager->get_setting( 'masonry_blog_display_top_header' )->value() === true &&
			$control->manager->get_setting( 'masonry_blog_enable_social_menu' )->value() === true
			) ? true : false;
	}
}


if ( ! function_exists( 'masonry_blog_active_author_section' ) ) {
	/**
	 * Checks if author section is enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_active_author_section( $control ) {

		return $control->manager->get_setting( 'masonry_blog_display_author_section' )->value();
	}
}


if ( ! function_exists( 'masonry_blog_active_related_section' ) ) {
	/**
	 * Checks if related section is enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_active_related_section( $control ) {

		return $control->manager->get_setting( 'masonry_blog_display_related_section' )->value();
	}
}


if ( ! function_exists( 'masonry_blog_not_active_global_sidebar' ) ) {
	/**
	 * Checks if global sidebar is not enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_not_active_global_sidebar( $control ) {

		return ! $control->manager->get_setting( 'masonry_blog_enable_global_sidebar_position' )->value();
	}
}


if ( ! function_exists( 'masonry_blog_active_global_sidebar' ) ) {
	/**
	 * Checks if global sidebar is enabled.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_active_global_sidebar( $control ) {

		return $control->manager->get_setting( 'masonry_blog_enable_global_sidebar_position' )->value();
	}
}


if ( ! function_exists( 'masonry_blog_active_common_post_sidebar' ) ) {
	/**
	 * Checks if common sidebar is enabled for posts.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_active_common_post_sidebar( $control ) {

		return (
			$control->manager->get_setting( 'masonry_blog_enable_global_sidebar_position' )->value() === false &&
			$control->manager->get_setting( 'masonry_blog_enable_common_post_sidebar_position' )->value() === true
			) ? true : false;
	}
}


if ( ! function_exists( 'masonry_blog_active_common_page_sidebar' ) ) {
	/**
	 * Checks if common sidebar is enabled for pages.
	 *
	 * @since 1.0.0
	 *
	 * @param  object $control WP Customize Control.
	 * @return boolean
	 */
	function masonry_blog_active_common_page_sidebar( $control ) {

		return (
			$control->manager->get_setting( 'masonry_blog_enable_global_sidebar_position' )->value() === false &&
			$control->manager->get_setting( 'masonry_blog_enable_common_page_sidebar_position' )->value() === true
			) ? true : false;
	}
}
