/** * @param $licenseKey * @return Wslm_ProductLicense|WP_Error */ public function licenseThisSite($licenseKey) { $result = $this->api->licenseSite($this->productSlug, $licenseKey, $this->getSiteUrl()); if ($result->success()) { //Success! Lets save our license data. $this->license = $this->createLicenseObject($result->response->license); $this->siteToken = $result->response->site_token; $this->licenseKey = $licenseKey; $this->save(); //Now that we have a valid license, an update might be available. Clear the cache. if ($this->updateChecker !== null) { $this->updateChecker->resetUpdateState(); } return $this->license; } else { $error = $result->asWpError(); if (isset($result->response->license)) { $error->add_data($this->createLicenseObject($result->response->license), 'license'); } return $error; } }
/** * Activate a license on the current site. * * @param string $licenseKey * @return Wslm_ProductLicense|WP_Error */ public function licenseThisSite($licenseKey) { $result = $this->api->licenseSite($this->productSlug, $licenseKey, $this->getSiteUrl()); return $this->processActivationResponse($result, $licenseKey); }