<?php
/**
 * Business Article Ship Theme Customizer Helper Functions
 *
 * @package Business Article Ship
 */

/**
* Render callback for site title
* 
* @return void
*/
function business_article_ship_site_title_callback() {
    bloginfo( 'name' );
}

/**
* Render callback for site description
* 
* @return void
*/
function business_article_ship_site_description_callback() {
    bloginfo( 'description' );
}

/**
 * Check if the single post no sidebar is enabled or not
 */
function business_article_ship_single_post_no_sidebar_enable( $control ) {
	if ( $control->manager->get_setting( 'business_article_ship_blog_single_sidebar_layout' )->value() == "no" ) {
		return true;
	} else {
		return false;
	}
}

/**
 * Check if the single post no sidebar is enabled & full width disabled
 */
function business_article_ship_single_post_no_sidebar_enable_full_width_disable( $control ) {
	if ( $control->manager->get_setting( 'business_article_ship_blog_single_sidebar_layout' )->value() == "no" && $control->manager->get_setting( 'business_article_ship_enable_single_post_full_width' )->value() == false  ) {
		return true;
	} else {
		return false;
	}
}

/**
 * Check if the menu sidebar is enabled or not
 */
function business_article_ship_menu_sidebar_enable( $control ) {
	if ( $control->manager->get_setting( 'business_article_ship_enable_menu_left_sidebar' )->value() == true ) {
		return true;
	} else {
		return false;
	}
}

/**
 * Check if the category archive settigns is enabled or not
 */
function business_article_ship_cat_archive_enable( $control ) {
	if ( $control->manager->get_setting( 'business_article_ship_enable_cat_archive_settings' )->value() == true ) {
		return true;
	} else {
		return false;
	}
}

/**
 * Check if the normal header is selected
 */
function business_article_ship_select_header_styles_callback( $control ) {
	if ( $control->manager->get_setting( 'business_article_ship_select_header_styles' )->value() == "style1" ) {
		return true;
	} else {
		return false;
	}
}

/**
 * Check if the page title is enabled (Customizer callback)
 */
function business_article_ship_page_title_enable( $control ) {
	return $control->manager->get_setting( 'business_article_ship_enable_page_title' )->value() === true;
}

/**
 * Check if the color option is selected (Customizer callback)
 */
if ( ! function_exists( 'business_article_ship_page_title_color_enable' ) ) {
	function business_article_ship_page_title_color_enable( $control ) {
		return (
			$control->manager->get_setting( 'business_article_ship_page_bg_radio' )->value() === 'color' &&
			$control->manager->get_setting( 'business_article_ship_enable_page_title' )->value() === true
		);
	}
}

/**
 * Check if the image option is selected (Customizer callback)
 */
if ( ! function_exists( 'business_article_ship_page_title_image_enable' ) ) {
	function business_article_ship_page_title_image_enable( $control ) {
		return (
			$control->manager->get_setting( 'business_article_ship_page_bg_radio' )->value() === 'image' &&
			$control->manager->get_setting( 'business_article_ship_enable_page_title' )->value() === true
		);
	}
}

/**
 * Helper function (used outside Customizer) to check if image bg is selected
 */
if ( ! function_exists( 'business_article_ship_page_title_image_enabled' ) ) {
	function business_article_ship_page_title_image_enabled() {
		return get_theme_mod( 'business_article_ship_enable_page_title', true ) 
			&& get_theme_mod( 'business_article_ship_page_bg_radio', 'color' ) === 'image';
	}
}

/**
 * Check if the footer copyrights links enabled or not
 */
function business_article_ship_footer_copyrights_links_enable( $control ) {
	if ( $control->manager->get_setting( 'business_article_ship_footer_enable_footer_links' )->value() == true) {
		return true;
	} else {
		return false;
	}
}