<?php 

    class WK_Pro_Check_License{
        private static $instance;
        public static function init(){
            if(null === self::$instance ){
                self::$instance = new self;
            }
            return self::$instance;
        }

        public function check_wk_pro_license($license=''){
            global $wp_version;
            // check_admin_referer('wk-pro-license'); 
    
            $api_params = array(
                'edd_action' => 'check_license',
                'license' => $license,
                'item_name' => urlencode( WKP_PRODUCT_NAME ),
                'url'       => home_url()
            );
    
            // Call the custom API.
            $response = wp_remote_post( WKP_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
            
            if ( is_wp_error( $response ) )
            return false;
            
            $license_data = json_decode( wp_remote_retrieve_body( $response ) );
            return $license_data;
            
        }
    }

?>