apikey = get_option('SHRSB_apikey'); $this->install_url = get_option('siteurl'); } public function set_api_key($apikey) { $bRet = false; if($apikey) { $auth = $this->authenticate($apikey); if($auth->plan_id > -2) { update_option('SHRSB_apikey', $apikey); $bRet = true; } } return $bRet; } public function delete_api_key() { update_option('SHRSB_apikey',$this->default_apikey); $this->apikey = get_option('apikey'); } public function authenticate($apikey = null) { $response_obj = null; $args = array('body' => array( "install_url" => $this->install_url, "api_key" => $apikey ? $apikey : $this->apikey )); if(function_exists(wp_remote_post)) { $response = wp_remote_post($this->authenicate_url, $args); $response_obj = json_decode($response['body']); } return $response_obj; } } ?>