Beispiel #1
0
 /**
  * @param string $licenseKey
  * @return Wslm_ProductLicense|WP_Error
  */
 public function requestLicenseDetails($licenseKey = null)
 {
     //Try to download license details.
     if (isset($licenseKey)) {
         $result = $this->api->getLicense($this->productSlug, $licenseKey, $this->getSiteUrl());
     } else {
         if ($this->getLicenseKey() !== null) {
             $result = $this->api->getLicense($this->productSlug, $this->getLicenseKey(), $this->getSiteUrl());
         } else {
             $result = $this->api->getLicenseByToken($this->productSlug, $this->getSiteToken(), $this->getSiteUrl());
         }
     }
     if ($result->success()) {
         return $this->createLicenseObject($result->response->license);
     } else {
         return $result->asWpError();
     }
 }
 /**
  * Associate an already-activated, site-specific license with the current site.
  *
  * This is for situations where you have already obtained a site token somehow and just need
  * the license manager to verify it and refresh license details.
  *
  * @param string $siteToken
  * @return WP_Error|Wslm_ProductLicense
  */
 public function licenseThisSiteByToken($siteToken)
 {
     $result = $this->api->getLicenseByToken($this->productSlug, $siteToken, $this->getSiteUrl());
     return $this->processActivationResponse($result, null, $siteToken);
 }