예제 #1
0
 public function getLicenseKey($key)
 {
     if (!$key or $key === '') {
         return false;
     }
     $result = wp_remote_get($this->baseUrl . 'license-keys/' . $key);
     if (is_wp_error($result)) {
         add_settings_error('invalid-license-server-message', '', 'We couldn\'t check your license. Are you connected to the Internet?');
     }
     $code = wp_remote_retrieve_response_code($result);
     if ($code !== 200) {
         return false;
     }
     $body = wp_remote_retrieve_body($result);
     $array = json_decode($body, true);
     if (!$array) {
         return false;
     }
     return LicenseKey::fromShipperResponseArray($array);
 }