Beispiel #1
0
 /**
  * Generate license code using license key.
  *
  * @access private
  * @param string $sLicenseKey The host name or the URL of domain. Default NULL
  * @return string The license key.
  */
 private function _generate($sLicenseKey = null)
 {
     if (empty($sLicenseKey)) {
         $sLicenseKey = $this->_sHostName;
     }
     $sLicenseKey = trim($sLicenseKey);
     $iUrlProtLength = strlen(PH7_URL_PROT);
     if (substr($sLicenseKey, 0, $iUrlProtLength) === PH7_URL_PROT) {
         $sLicenseKey = substr($sLicenseKey, $iUrlProtLength);
     }
     if (substr($sLicenseKey, 0, 4) === 'www.') {
         $sLicenseKey = substr($sLicenseKey, 4);
     }
     $oHttp = new Http();
     if ($oHttp->detectSubdomain($sLicenseKey)) {
         $sLicenseKey = str_replace($oHttp->getSubdomain($sLicenseKey) . PH7_DOT, '', $sLicenseKey);
     }
     unset($oHttp);
     $iLicenseKeyLength = strlen($sLicenseKey);
     if (substr($sLicenseKey, $iLicenseKeyLength - 1, 1) === PH7_SH) {
         $sLicenseKey = substr($sLicenseKey, 0, $iLicenseKeyLength - 1);
     }
     return $this->_bDynamicHostIp ? $sLicenseKey : $this->_sHostIp . $sLicenseKey;
 }
 /**
  * @access protected
  * @param string $sUrl
  * @return string
  */
 protected function clear($sUrl)
 {
     $oHttp = new Http();
     if ($oHttp->detectSubdomain($sUrl)) {
         // Removes the subdomain with its dot (e.g. mysub.domain.com becomes domain.com).
         $sUrl = str_replace($oHttp->getSubdomain($sUrl) . PH7_DOT, '', $sUrl);
     }
     unset($oHttp);
     return preg_replace('#(^https?://|www\\.|\\.[a-z]{2,4}/?(.+)?$)#i', '', $sUrl);
 }