<?php
/**
 * Active Callback
 * 
 * @package Wellness_Coach_Lite
*/

/**
 * Active Callback for Banner Slider
*/
function wellness_coach_lite_banner_ac( $control ){
    $banner           = $control->manager->get_setting( 'ed_banner_section' )->value();
    $slider_type      = $control->manager->get_setting( 'slider_type' )->value();
    $control_id       = $control->id;

    if ( $control_id == 'header_image' && ( $banner == 'static_banner' || $banner == 'static_nl_banner' ) ) return true;
    if ( $control_id == 'header_video' && ( $banner == 'static_banner' || $banner == 'static_nl_banner' ) ) return true;
    if ( $control_id == 'external_header_video' && ( $banner == 'static_banner' || $banner == 'static_nl_banner' ) ) return true;
    if ( $control_id == 'banner_title' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'banner_subtitle' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'banner_content' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'button_one' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'button_one_url' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'button_one_tab_new' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'button_two' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'button_two_url' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'button_two_tab_new' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'banner_caption_layout' && ( $banner == 'static_banner' || $banner == 'static_nl_banner' ) ) return true;
    if ( $control_id == 'banner_newsletter' && $banner == 'static_nl_banner' ) return true;
    
    if ( $control_id == 'slider_type' && $banner == 'slider_banner' ) return true;
    if ( $control_id == 'slider_auto' && $banner == 'slider_banner' ) return true;
    if ( $control_id == 'slider_loop' && $banner == 'slider_banner' ) return true;
    if ( $control_id == 'slider_caption' && $banner == 'slider_banner' ) return true;          
    if ( $control_id == 'slider_readmore' && $banner == 'slider_banner' ) return true;    
    if ( $control_id == 'slider_cat' && $banner == 'slider_banner' && $slider_type == 'cat' ) return true;
    if ( $control_id == 'no_of_slides' && $banner == 'slider_banner' && $slider_type == 'latest_posts' ) return true;
    if ( $control_id == 'slider_full_image' && $banner == 'slider_banner' ) return true;
    if ( $control_id == 'slider_animation' && $banner == 'slider_banner' ) return true;
    if ( $control_id == 'slider_speed' && $banner == 'slider_banner' ) return true;
    if ( $control_id == 'hr' && $banner == 'slider_banner' ) return true;

    if ( $control_id == 'cta_static_banner_text' && $banner == 'static_banner' ) return true;
    if ( $control_id == 'slider_banner_text' && $banner == 'slider_banner' ) return true;
    if ( $control_id == 'banner_newsletter_text' && $banner == 'static_nl_banner' ) return true;

    return false;
}

/**
 * Active Callback for frontpage contact section
*/
function wellness_coach_lite_contact_section_ac( $control ){
    
    $contact_widget = is_active_sidebar( 'contact' );
    $control_id = $control->id;

    if ( $control_id == 'follow_on_text' && $contact_widget == true ) return true;
    
    return false;
}

/**
 * Active Callback for post/page
*/
function wellness_coach_lite_post_page_ac( $control ){
    
    $ed_related = $control->manager->get_setting( 'ed_related' )->value();
    $ed_comment = $control->manager->get_setting( 'ed_comments' )->value();
    $control_id = $control->id;
    
    if ( $control_id == 'related_post_title' && $ed_related == true ) return true;
    if ( $control_id == 'toggle_comments' && $ed_comment == true ) return true;
    return false;
}

/**
 * Active Callback for post/page
*/
function wellness_coach_lite_top_pick_ac( $control ){
    $top_pick     = $control->manager->get_setting( 'blog_top_pick' )->value();
    $ed_top_picks = $control->manager->get_setting( 'ed_top_picks' )->value();
    $ed_popular   = $control->manager->get_setting( 'ed_popular' )->value();
    $ed_featured  = $control->manager->get_setting( 'ed_blog_featured_post' )->value();
    $control_id   = $control->id;

    if( $control_id == 'top_picks_cat' && $top_pick == 'cat' ) return true;
    if( $control_id == 'top_picks_number' && $ed_top_picks == true && ( $top_pick == 'cat' || $top_pick == 'popular') ) return true;
    if( $control_id == 'blog_custom' && $top_pick == 'custom' ) return true;
    if( $control_id == 'popular_post_title' && $ed_popular == true ) return true;
    if( $control_id == 'top_pick_label' && $ed_top_picks == true ) return true;
    if( $control_id == 'blog_top_pick' && $ed_top_picks == true ) return true;
    if( $control_id == 'featured_post_title' && $ed_featured == true ) return true;
    if( $control_id == 'blog_featured_post' && $ed_featured == true ) return true;
    if( $control_id == 'read_more_text' && $ed_featured == true ) return true;

    return false;
}

/**
 * Active Callback for Wheel of Life
*/
function wellness_coach_lite_wheeloflife_ac( $control ){
    $ed_wheeloflife = get_theme_mod( 'ed_wheeloflife_section' , false );
    $ed_tab         = $control->manager->get_setting( 'wheel_of_life_tab' )->value();
    $control_id     = $control->id;
    
    if ( $ed_wheeloflife && $control_id == 'wol_section_title'  ) return true;
    if ( $ed_wheeloflife && $control_id == 'wol_section_content'  ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_img'  ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheel_of_life_tab'  ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_cp_text' && $ed_tab == 'coach' ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_url_cp' && $ed_tab == 'coach' ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_text_cp' && $ed_tab == 'coach' ) return true;
    if ( $ed_wheeloflife && $control_id == 'wol_activate_note' && $ed_tab == 'wol' ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_text' && $ed_tab == 'wol' ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_shortcode' && $ed_tab == 'wol' ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_learn_text' && $ed_tab == 'wol' ) return true;
    if ( $ed_wheeloflife && $control_id == 'wheeloflife_color' && $ed_tab == 'wol' ) return true;
    
    return false; 
}

/**
 * Active Callback for local fonts
*/
function wellness_coach_lite_ed_localgoogle_fonts(){
    $ed_localgoogle_fonts = get_theme_mod( 'ed_localgoogle_fonts' , false );

    if( $ed_localgoogle_fonts ) return true;
    
    return false; 
}

/**
 * Active Callback for Instagram.
*/
function wellness_coach_lite_ed_instagram($control){

    $ed_instagram = get_theme_mod( 'ed_instagram', false );
    $control_id     = $control->id;

    if ( $control_id == 'instagram_shortcode' && $ed_instagram ) return true;

    return false;
}