<?php 
/**
 * all helper functions
 * those can be called stand alone  
 * suppose to be here. 
 */
// Ensure get_plugins function is loaded
if ( ! function_exists( 'get_plugins' ) ) {
    include ABSPATH . '/wp-admin/includes/plugin.php';
}
if(!function_exists('edumodo_get_active_plugins_arr')){
    function edumodo_get_active_plugins_arr(){
        $active_plugins_arr = get_option( 'active_plugins', array() );
        return $active_plugins_arr;
    }
}
if(!function_exists('edumodo_get_installed_plugins_arr')){
    function edumodo_get_installed_plugins_arr(){
        $all_plugins_arr = array_keys(get_plugins());
        return $all_plugins_arr;
    }
}
if(!function_exists('edumodo_get_inactive_plugins_arr')){
    function edumodo_get_inactive_plugins_arr(){
        $inactive_plugins_arr = [];
        $all_installed_plugins_arr = edumodo_get_installed_plugins_arr();
        $all_active_plugins_arr = edumodo_get_active_plugins_arr();
        foreach($all_installed_plugins_arr as $single_plugin){
            if(! in_array($single_plugin, $all_active_plugins_arr) ){
                array_push($inactive_plugins_arr, $single_plugin);
            }
        }
        return $inactive_plugins_arr;
    }
}
if(!function_exists('edumodo_check_if_this_plugin_is_active')){
    function edumodo_check_if_this_plugin_is_active($plugin_name = ''){
        $active_plugins_arr = edumodo_get_active_plugins_arr();
        if(in_array($plugin_name, $active_plugins_arr)){
            return true;
        }else{
            return false;
        }
    }
}
if(!function_exists('edumodo_check_if_this_plugin_is_installed')){
    function edumodo_check_if_this_plugin_is_installed($plugin_name = ''){
        $install_plugins_arr = edumodo_get_installed_plugins_arr();
        if(in_array($plugin_name, $install_plugins_arr)){
            return true;
        }else{
            return false;
        }
    }
}
if(!function_exists('edumodo_check_if_this_plugin_is_inactive')){
    function edumodo_check_if_this_plugin_is_inactive($plugin_name = ''){
        $inactive_plugins_arr = edumodo_get_inactive_plugins_arr();
        if(in_array($plugin_name, $inactive_plugins_arr)){
            return true;
        }else{
            return false;
        }
    }
}
?>