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


PHP Domain::setContacts方法代码示例

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


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

示例1: stregistry_RegisterDomain

/**
 * make domain registration api call
 * 
 * @param array $params call params with domain details
 * 
 * @return mixed array containig error message will return if error was ocurred, 'success' string in other case
 */
function stregistry_RegisterDomain($params)
{
    // init connection
    if (($status = __initConnectionAndAuthorize($params)) !== true) {
        return __errorArray($status);
    }
    $domain = new Domain($params['domainname']);
    // create domain contacts
    $contactIds = array();
    foreach (array('registrant', 'admin', 'tech', 'billing') as $contactType) {
        $contact = new Contact();
        $contact->setEmail($params['email'])->setPhoneNumber($params['phonenumberformatted'] ?: '')->setName($params['fullname'])->setOrganization($params['companyname'])->setAddress($params['address1'], $params['address1'] ?: '')->setCity($params['city'])->setState($params['fullstate'])->setPostalCode($params['postcode'])->setCountryCode($params['countrycode']);
        $json = STRegistry::Contacts()->create($contact);
        if (!ResponseHelper::isSuccess($json)) {
            return __errorArray(ResponseHelper::fromJSON($json)->message);
        }
        $contactIds[$contactType] = ResponseHelper::fromJSON($json, 'creData')->result['id'];
    }
    $domain->setContacts($contactIds['registrant'], $contactIds['admin'], $contactIds['tech'], $contactIds['billing']);
    if ($params['idprotection']) {
        $domain->setPrivacyContacts(STRegistryPrivacyContact::getRegistrantId(), STRegistryPrivacyContact::getAdminId(), STRegistryPrivacyContact::getTechId(), STRegistryPrivacyContact::getBillingId());
    }
    // add nameservers
    foreach (array('ns1', 'ns2', 'ns3', 'ns4', 'ns5') as $nsKey) {
        if (!empty($params[$nsKey])) {
            $domain->addNameServer($params[$nsKey]);
        }
    }
    // creating domain
    $json = STRegistry::Domains()->create($domain, $params['regperiod']);
    if (!ResponseHelper::isSuccess($json)) {
        return __errorArray(ResponseHelper::fromJSON($json)->message);
    }
    return 'success';
}
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:42,代码来源:stregistry.php

示例2: fromJSON

 /**
  * Create Domain object from json string
  * 
  * @param str $json json string representing domain state
  * 
  * @return Domain
  */
 public static function fromJSON($json)
 {
     $data = CommonFunctions::fromJSON($json, 'info')->result;
     $domain = new Domain($data['name']);
     $domain->setContacts($data['contacts'][Domain::CONTACT_TYPE_REGISTRANT], $data['contacts'][Domain::CONTACT_TYPE_ADMIN], $data['contacts'][Domain::CONTACT_TYPE_TECH], $data['contacts'][Domain::CONTACT_TYPE_BILLING])->setPrivacyContacts(@$data['contacts'][Domain::CONTACT_TYPE_REGISTRANT_PRIVACY], @$data['contacts'][Domain::CONTACT_TYPE_ADMIN_PRIVACY], @$data['contacts'][Domain::CONTACT_TYPE_TECH_PRIVACY], @$data['contacts'][Domain::CONTACT_TYPE_BILLING_PRIVACY])->setDateCreated($data['crDate'])->setDateExpire($data['exDate'])->setAuthCode($data['authInfo']['pw']);
     if (isset($data['ns']) && count($data['ns'])) {
         foreach ($data['ns'] as $nameserver) {
             $domain->addNameServer($nameserver);
         }
     }
     foreach ($data['status'] as $status) {
         $domain->addStatus($status);
     }
     return $domain;
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:22,代码来源:Domain.php


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