<?php
/* The GDPR Framework support functions
------------------------------------------------------------------------------- */

// Theme init
if (!function_exists('healthcoach_gdpr_framework_theme_setup')) {
    add_action( 'healthcoach_action_before_init_theme', 'healthcoach_gdpr_framework_theme_setup', 1 );
    function healthcoach_gdpr_framework_theme_setup() {
        if (is_admin()) {
            add_filter( 'healthcoach_filter_required_plugins', 'healthcoach_gdpr_framework_required_plugins' );
        }
    }
}

// Check if Instagram Widget installed and activated
if ( !function_exists( 'healthcoach_exists_gdpr_framework' ) ) {
    function healthcoach_exists_gdpr_framework() {
        return defined( 'GDPR_FRAMEWORK_VERSION' );
    }
}

// Filter to add in the required plugins list
if ( !function_exists( 'healthcoach_gdpr_framework_required_plugins' ) ) {
    
    function healthcoach_gdpr_framework_required_plugins($list=array()) {
        if (in_array('gdpr_framework', (array)healthcoach_storage_get('required_plugins')))
            $list[] = array(
                'name'         => esc_html__('The GDPR Framework', 'healthcoach'),
                'slug'         => 'gdpr-framework',
                'required'     => false
            );
        return $list;
    }
}
?>