当前位置: 首页>>代码示例>>PHP>>正文


PHP Domain::fromJSON方法代码示例

本文整理汇总了PHP中Domain::fromJSON方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::fromJSON方法的具体用法?PHP Domain::fromJSON怎么用?PHP Domain::fromJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Domain的用法示例。


在下文中一共展示了Domain::fromJSON方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hook_stregistrar_ShoppingCartValidateDomainsConfig

function hook_stregistrar_ShoppingCartValidateDomainsConfig($params)
{
    $errors = array();
    foreach ($_SESSION['cart']['domains'] as $key => $domain) {
        // check premium domain registration
        if ($domain['type'] == 'register') {
            $config = __getSTRegistrarModuleConfig();
            if (__domainIsPremium($domain['domain']) && $config['allowPremium'] !== 'on') {
                return $errors[] = "Registration of premium domains is disabled by server configuration";
            }
        }
        if ($domain['type'] == 'transfer') {
            // init api connection
            if (($status = __initConnectionAndAuthorize(__getSTRegistrarModuleConfig())) === false) {
                return $errors[] = $status;
            }
            // try to query domain using specified auth code
            $json = STRegistry::Domains()->query($domain['domain'], $domain['eppcode']);
            if (!ResponseHelper::isSuccess($json)) {
                $status = ResponseHelper::fromJSON($json);
                if ($status->code == 2202) {
                    $errors[] = sprintf('EPP Code is invalid for domain: %s', $domain['domain']);
                } else {
                    $errors[] = $status->message;
                }
            }
            $domainObj = Domain::fromJSON($json);
            // check status prohibitions
            if (in_array(Domain::STATUS_TRANSFER_PROHIBITED, $domainObj->getStatuses()) || in_array('serverTransferProhibited', $domainObj->getStatuses())) {
                $errors[] = sprintf('Domain %s is not eligible for transfer. Please contact current domain registrar for assistance', $domain['domain']);
            }
        }
        if (!count($errors)) {
            __storeDomainEppCode($domain['domain'], $domain['eppcode']);
        }
    }
    return count($errors) ? $errors : '';
}
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:38,代码来源:hooks.php

示例2: stregistry_Sync

function stregistry_Sync($params)
{
    // init connection
    if (($status = __initConnectionAndAuthorize($params)) !== true) {
        return __errorArray($status);
    }
    // fetch domain
    $json = STRegistry::Domains()->query($params['domain']);
    if (!ResponseHelper::isSuccess($json)) {
        $response = ResponseHelper::fromJSON($json);
        if ($response->code == 2303 || $response->code == 2203) {
            // domain does not already exists or not own by current registarar
            __markWHMCSDomainCancelled($params['domainid']);
            return array('active' => false, 'expired' => false);
        } else {
            return __errorArray($response->message);
        }
    }
    $domain = Domain::fromJSON($json);
    if ($domain->getDateExpire() < time()) {
        return array('expired' => true);
    }
    return array('active' => true, 'expired' => false, 'expirydate' => $domain->getDateExpire('Y-m-d'));
}
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:24,代码来源:stregistry.php

示例3: getRequestDataForUpdate

 /**
  * 
  */
 public function getRequestDataForUpdate(Domain $domain)
 {
     $data = array();
     $json = STRegistry::Domains()->query($domain->getName());
     $currentDomain = Domain::fromJSON($json);
     if ($currentDomain->getAuthCode() != $domain->getAuthCode()) {
         if (!isset($data['chg'])) {
             $data['chg'] = array();
         }
         $data['chg']['authInfo'] = array('pw' => $domain->getAuthCode());
     }
     foreach ($currentDomain->getContacts() as $type => $contact) {
         $newContacts = $domain->getContacts();
         if ($newContacts[$type] !== false && $newContacts[$type] != $contact) {
             if (!isset($data['rem']['contact'])) {
                 $data['rem']['contact'] = array();
             }
             if (!isset($data['add']['contact'])) {
                 $data['add']['contact'] = array();
             }
             $data['rem']['contact'][] = array($type => $contact);
             if (!empty($newContacts[$type])) {
                 $data['add']['contact'][] = array($type => $newContacts[$type]);
             }
         }
     }
     foreach ($domain->getNameServers() as $nameserver => $ips) {
         if (!in_array($nameserver, array_keys($currentDomain->getNameServers()))) {
             if (!isset($data['add']['ns'])) {
                 $data['add']['ns'] = array();
             }
             $upd = array('name' => $nameserver);
             if (count($ips)) {
                 $upd['addr'] = array();
                 foreach ($ips as $ip) {
                     $upd['addr'][] = array(CommonFunctions::detectIPType($ip) => $ip);
                 }
             }
             $data['add']['ns'][] = $upd;
         }
     }
     foreach ($currentDomain->getNameServers() as $nameserver => $ips) {
         if (!in_array($nameserver, array_keys($domain->getNameServers()))) {
             if (!isset($data['rem']['ns'])) {
                 $data['rem']['ns'] = array();
             }
             $data['rem']['ns'][] = $nameserver;
         }
     }
     foreach ($domain->getStatuses() as $status) {
         if (!in_array($status, array(Domain::STATUS_HOLD, Domain::STATUS_DELETE_PROHIBITED, Domain::STATUS_RENEW_PROHIBITED, Domain::STATUS_TRANSFER_PROHIBITED, Domain::STATUS_UPDATE_PROHIBITED))) {
             continue;
         }
         if (!in_array($status, $currentDomain->getStatuses())) {
             if (!isset($data['add']['status'])) {
                 $data['add']['status'] = array();
             }
             $data['add']['status'][] = $status;
         }
     }
     foreach ($currentDomain->getStatuses() as $status) {
         if (!in_array($status, array(Domain::STATUS_HOLD, Domain::STATUS_DELETE_PROHIBITED, Domain::STATUS_RENEW_PROHIBITED, Domain::STATUS_TRANSFER_PROHIBITED, Domain::STATUS_UPDATE_PROHIBITED))) {
             continue;
         }
         if (!in_array($status, $domain->getStatuses())) {
             if (!isset($data['rem']['status'])) {
                 $data['rem']['status'] = array();
             }
             $data['rem']['status'][] = $status;
         }
     }
     return $data;
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:76,代码来源:Domains.php


注:本文中的Domain::fromJSON方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。