/**
 * Load Plugin
 * 
 * Handles to load plugin after
 * dependent plugin is loaded 
 * successfully
 *
 * @package Easy Digital Downloads - Points and Rewards
 * @since 1.3.0
 **/
function edd_points_plugin_loaded()
{
    //check easy digital downloads is activated or not
    if (class_exists('Easy_Digital_Downloads')) {
        // load first text domain
        edd_points_load_text_domain();
        //check EDD_License class is exist
        if (class_exists('EDD_License')) {
            // Instantiate the licensing / updater. Must be placed in the main plugin file
            $license = new EDD_License(__FILE__, 'Points and Rewards', EDD_POINTS_VERSION, 'WPWeb');
        }
        /**
         * Deactivation Hook
         * 
         * Register plugin deactivation hook.
         * 
         * @package Easy Digital Downloads - Points and Rewards
         * @since 1.0.0
         */
        register_deactivation_hook(__FILE__, 'edd_points_uninstall');
        /**
         * Plugin Setup (On Deactivation)
         * 
         * Delete  plugin options.
         * 
         * @package Easy Digital Downloads - Points and Rewards
         * @since 1.0.0
         */
        function edd_points_uninstall()
        {
            global $wpdb;
            //IMP Call of Function
            //Need to call when custom post type is being used in plugin
            flush_rewrite_rules();
        }
        /**
         * Includes Files
         * 
         * Includes some required files for plugin
         * 
         * @package Easy Digital Downloads - Points and Rewards
         * @since 1.0.0
         */
        global $edd_points_model, $edd_points_scripts, $edd_points_render, $edd_points_shortcodes, $edd_points_public, $edd_points_admin, $edd_points_log;
        //Pagination Class
        require_once EDD_POINTS_DIR . '/includes/class-edd-points-pagination-public.php';
        // front end pagination class
        //Model Class for generic functions
        require_once EDD_POINTS_DIR . '/includes/class-edd-points-model.php';
        $edd_points_model = new EDD_Points_Model();
        //Scripts Class for scripts / styles
        require_once EDD_POINTS_DIR . '/includes/class-edd-points-scripts.php';
        $edd_points_scripts = new EDD_Points_Scripts();
        $edd_points_scripts->add_hooks();
        //Renderer Class for HTML
        require_once EDD_POINTS_DIR . '/includes/class-edd-points-renderer.php';
        $edd_points_render = new EDD_Points_Renderer();
        //Shortcodes class for handling shortcodes
        require_once EDD_POINTS_DIR . '/includes/class-edd-points-shortcodes.php';
        $edd_points_shortcodes = new EDD_Points_Shortcodes();
        $edd_points_shortcodes->add_hooks();
        //Insert logs for points functionality.
        require_once EDD_POINTS_DIR . '/includes/class-edd-points-log.php';
        $edd_points_log = new EDD_Points_Logging();
        //Public Class for public functionlities
        require_once EDD_POINTS_DIR . '/includes/class-edd-points-public.php';
        $edd_points_public = new EDD_Points_Public();
        $edd_points_public->add_hooks();
        //Admin Pages Class for admin site
        require_once EDD_POINTS_ADMIN . '/class-edd-points-admin.php';
        $edd_points_admin = new EDD_Points_Admin();
        $edd_points_admin->add_hooks();
    }
    //end if to check class Easy_Digital_Downloads is exist or not
}
    //Pagination Class
    require_once EDD_POINTS_DIR . '/includes/class-edd-points-pagination-public.php';
    // front end pagination class
    //Model Class for generic functions
    require_once EDD_POINTS_DIR . '/includes/class-edd-points-model.php';
    $edd_points_model = new EDD_Points_Model();
    //Scripts Class for scripts / styles
    require_once EDD_POINTS_DIR . '/includes/class-edd-points-scripts.php';
    $edd_points_scripts = new EDD_Points_Scripts();
    $edd_points_scripts->add_hooks();
    //Renderer Class for HTML
    require_once EDD_POINTS_DIR . '/includes/class-edd-points-renderer.php';
    $edd_points_render = new EDD_Points_Renderer();
    //Shortcodes class for handling shortcodes
    require_once EDD_POINTS_DIR . '/includes/class-edd-points-shortcodes.php';
    $edd_points_shortcodes = new EDD_Points_Shortcodes();
    $edd_points_shortcodes->add_hooks();
    //Add post type page for points functionality.
    require_once EDD_POINTS_DIR . '/includes/edd-points-post-types.php';
    //Insert logs for points functionality.
    require_once EDD_POINTS_DIR . '/includes/class-edd-points-log.php';
    $edd_points_log = new EDD_Points_Logging();
    //Public Class for public functionlities
    require_once EDD_POINTS_DIR . '/includes/class-edd-points-public.php';
    $edd_points_public = new EDD_Points_Public();
    $edd_points_public->add_hooks();
    //Admin Pages Class for admin site
    require_once EDD_POINTS_ADMIN . '/class-edd-points-admin.php';
    $edd_points_admin = new EDD_Points_Admin();
    $edd_points_admin->add_hooks();
}