本文整理汇总了PHP中License::IsModuleLicensed方法的典型用法代码示例。如果您正苦于以下问题:PHP License::IsModuleLicensed方法的具体用法?PHP License::IsModuleLicensed怎么用?PHP License::IsModuleLicensed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类License
的用法示例。
在下文中一共展示了License::IsModuleLicensed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetRegistryByExtension
/**
* @access public
* @param string $TLD TLD part, without dot
* @param bool $extended If true, return all TLD's exports by module
* @return Registry
*/
public function GetRegistryByExtension($extension, $db_check = true, $ignore_cache = false)
{
$db = Core::GetDBInstance();
$extensions = $this->GetExtensionList($db_check);
if (in_array($extension, $extensions)) {
$this->ListModules();
$module_name = $this->Modules[$extension];
if (!$module_name) {
throw new Exception(sprintf(_("Module not defined for %s domain extension."), $extension));
}
// Validate license for this module
if (!License::IsModuleLicensed($module_name)) {
switch (CONTEXTS::$APPCONTEXT) {
case APPCONTEXT::CRONJOB:
case APPCONTEXT::REGISTRAR_CP:
$message = "Your license does not permit module {$module_name}. For additional module purchases, please contact sales@webta.net";
break;
case APPCONTEXT::REGISTRANT_CP:
$message = sprintf(_("Application license does not permit module %s. Please contact %s"), $module_name, UI::GetSupportEmailLink());
break;
case APPCONTEXT::ORDERWIZARD:
$message = "Your license does not permit module {$module_name}. For additional module purchases, please contact sales@webta.net";
break;
}
// Validate license for this module
if (!License::IsModuleLicensed($module_name)) {
throw new LicensingException($message);
}
}
$Manifest = new RegistryManifest("{$this->ModulesPath}/{$module_name}/module.xml");
$module_codebase = $Manifest->GetModuleCodebase();
if (!$module_codebase) {
$module_codebase = $module_name;
}
$this->LoadRegistryModule($module_codebase);
if (!$this->ModulesCache[$extension] || $ignore_cache) {
$reflect = new ReflectionClass("{$module_codebase}RegistryModule");
$Module = $reflect->newInstance($Manifest);
$Config = $this->LoadModuleConfig($Module->GetConfigurationForm(), $module_name);
$Module->InitializeModule($extension, $Config);
$this->ModulesCache[$extension] = $Module;
}
} else {
throw new Exception(sprintf(_("No modules configured to handle extension '%s'"), $extension));
}
return new Registry($this->ModulesCache[$extension]);
}
示例2: OnPaid
public function OnPaid(Invoice $Invoice, AbstractPaymentModule $payment_module = null)
{
$db = Core::GetDBInstance();
if (!in_array($Invoice->Purpose, $this->HandledPurposes)) {
return;
}
Log::Log("RegistryInvoiceObserver::OnPaid(InvoiceID={$Invoice->ID})", E_USER_NOTICE);
// Get domain information
try {
$Domain = DBDomain::GetInstance()->Load($Invoice->ItemID);
} catch (Exception $e) {
Log::Log("RegistryInvoiceObserver::OnPaid() thown exception: {$e->getMessage()}", E_USER_ERROR);
}
if ($Domain) {
Log::Log("Invoice purpose: {$Invoice->Purpose}", E_USER_NOTICE);
// Get user information
$userinfo = $db->GetRow("SELECT * FROM users WHERE id=?", array($Domain->UserID));
// Check command
switch ($Invoice->Purpose) {
case INVOICE_PURPOSE::DOMAIN_TRADE:
try {
$Action = new UpdateDomainContactAction($Invoice);
try {
$Action->Run();
} catch (UpdateDomainContactAction_Exception $e) {
Log::Log(sprintf("Trade failed. %s", $e->getMessage()), E_ERROR);
DBDomain::GetInstance()->Save($Action->GetDomain());
// Send mail
$args = array("client" => $userinfo, "Invoice" => $Invoice, "domain_name" => $Domain->Name, "extension" => $Domain->Extension, "domain_trade_failure_reason" => $e->getMessage());
mailer_send("domain_trade_action_required.eml", $args, $userinfo["email"], $userinfo["name"]);
}
} catch (LogicException $e2) {
Log::Log($e2->getMessage(), E_ERROR);
}
break;
case INVOICE_PURPOSE::DOMAIN_CREATE:
if ($Domain->Status == DOMAIN_STATUS::AWAITING_PAYMENT || $Domain->Status == DOMAIN_STATUS::REJECTED) {
$Domain->Status = DOMAIN_STATUS::PENDING;
$Domain->IncompleteOrderOperation = INCOMPLETE_OPERATION::DOMAIN_CREATE;
$Domain = DBDomain::GetInstance()->Save($Domain);
// If domain has incomplete information skip domain creation. Update status to Pending.
if (count($Domain->GetContactList()) == 0 || count($Domain->GetNameserverList()) == 0) {
//
// Send mail
//
Log::Log("Domain registration process not completed. Need more information from client.", E_USER_NOTICE);
$args = array("client" => $userinfo, "Invoice" => $Invoice, "domain_name" => $Domain->Name, "extension" => $Domain->Extension);
mailer_send("domain_registration_action_required.eml", $args, $userinfo["email"], $userinfo["name"]);
// Write information in invoice
$Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED;
$Invoice->ActionFailReason = _('Domain registration process not completed. Need more information from client.');
} else {
Log::Log("Trying to register domain", E_USER_NOTICE);
///// get Registry instance and connect to registry server
try {
$Registry = RegistryModuleFactory::GetInstance()->GetRegistryByExtension($Domain->Extension);
} catch (Exception $e) {
Log::Log($e->getMessage(), E_ERROR);
return;
}
// Validate license for this module
if (!License::IsModuleLicensed($Registry->GetModuleName())) {
throw new LicensingException("Your license does not permit module {$Registry->ModuleName()}");
}
//
$extra_data = $db->GetAll("SELECT * FROM domains_data WHERE domainid=?", array($Domain->ID));
if ($extra_data && count($extra_data) > 0) {
foreach ($extra_data as $v) {
$extra[$v["key"]] = $v["value"];
}
} else {
$extra = array();
}
// Try to create domain name
try {
$cr = $Registry->CreateDomain($Domain, $Domain->Period, $extra);
} catch (Exception $e) {
$args = array("client" => $userinfo, "Invoice" => $Invoice, "domain_name" => $Domain->Name, "extension" => $Domain->Extension, "domain_reg_failure_reason" => $e->getMessage());
mailer_send("domain_registration_action_required.eml", $args, $userinfo["email"], $userinfo["name"]);
// If domain not created
Log::Log("Cannot register domain name. Server return: " . $e->getMessage(), E_ERROR);
$Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED;
$Invoice->ActionFailReason = $e->getMessage();
}
if ($cr) {
// If domain created
Log::Log(sprintf("Domain %s successfully registered. Updating database", $Domain->GetHostName()), E_USER_NOTICE);
$Invoice->ActionStatus = INVOICE_ACTION_STATUS::COMPLETE;
}
}
} else {
Log::Log("Domain status '{$Domain->Status}'. Expected 'Awaiting payment'", E_ERROR);
$retval = false;
$Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED;
$Invoice->ActionFailReason = sprintf(_("Domain status '%s'. Expected 'Awaiting payment'"), $Domain->Status);
}
break;
case INVOICE_PURPOSE::DOMAIN_TRANSFER:
if ($Domain->Status == DOMAIN_STATUS::AWAITING_PAYMENT) {
//
//.........这里部分代码省略.........
示例3: LicensingException
}
$db->CompleteTrans();
if (!$err)
{
$okmsg = "Module successfully disabled";
CoreUtils::Redirect("modules_view.php");
}
}
}
// Enable modules
elseif($get_action == "enable" && $get_module)
{
// Check if this module licensed
if (!License::IsModuleLicensed($get_module))
throw new LicensingException("Your license does not permit module {$get_module}. For additional module purchases, please contact sales@webta.net");
if (CONFIG::$DEV_DEMOMODE != 1)
{
$get_module = preg_replace("/[^A-Za-z0-9_-]+/", "", $get_module);
// Validate Manifest
RegistryManifest::LoadCompiledManifest(CONFIG::$PATH."/modules/registries/{$get_module}/module.xml", true);
$res = RegistryManifest::Validate(CONFIG::$PATH."/modules/registries/{$get_module}/module.xml");
if ($res !== true)
{
Log::Log($res, E_USER_ERROR);
$errmsg = sprintf(_("Module %s XML manifest did not pass validation. The following errors occured:"), $get_module);
$err[] = $res;
}