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


PHP CommonFunctions::fromJSON方法代码示例

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


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

示例1: validate

 /**
  * Validates current session at Registry side
  * 
  * @return json
  */
 public function validate($cltrid = false)
 {
     $json = ApiRequest::GET('/auth', $cltrid ?: ApiRequest::defaultClientTransactionID(), $this->getAuthToken());
     $response = CommonFunctions::fromJSON($json);
     if ($response->code == 1000) {
         $this->_sessionData['expires'] = $response->result['expires'];
     }
     return $json;
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:14,代码来源:Session.php

示例2: exist

 /**
  * Check if host already exist at ST Registry
  * 
  * @param str $hostname
  * 
  * @return boolean
  */
 public function exist($hostname, $cltrid = false)
 {
     $json = ApiRequest::GET(sprintf("/hosts/%s/check", $hostname), $cltrid ?: ApiRequest::defaultClientTransactionID(), STRegistry::Session()->getAuthToken());
     $response = CommonFunctions::fromJSON($json);
     return (bool) (!$response->result['avail']);
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:13,代码来源:Hosts.php

示例3: fromJSON

 /**
  * Create Contact object from json string
  * 
  * @param str $json json string representing contact state
  * 
  * @return Contact
  */
 public static function fromJSON($json)
 {
     $data = CommonFunctions::fromJSON($json, 'info')->result;
     $contact = new Contact();
     $contact->setContactId($data['id'])->setEmail($data['email'])->setPhoneNumber($data['voice'])->setFaxNumber($data['fax']);
     foreach (array(Contact::POSTALINFO_INT, Contact::POSTALINFO_LOCAL) as $type) {
         if (isset($data['postalInfo'][$type])) {
             $pi = $data['postalInfo'][$type];
             $contact->setName($pi['name'], $type)->setOrganization($pi['org'], $type)->setAddress(@$pi['addr']['street'][0], @$pi['addr']['street'][1], @$pi['addr']['street'][2])->setCity($pi['addr']['city'])->setCountryCode($pi['addr']['cc'])->setState($pi['addr']['sp'])->setPostalCode($pi['addr']['pc']);
         }
     }
     return $contact;
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:20,代码来源:Contact.php

示例4: 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

示例5: fromJSON

 /**
  * Create Host object from json string
  * 
  * @param str $json json string representing domain state
  * 
  * @return Host
  */
 public static function fromJSON($json)
 {
     $data = CommonFunctions::fromJSON($json, 'info')->result;
     $host = new Host($data['name']);
     foreach ($data['addr'] as $addr) {
         $keys = array_keys($addr);
         $version = array_shift($keys);
         if ($version == Host::IP_VERSION_4) {
             $host->addIPv4($addr[$version]);
         } else {
             $host->addIPv6($addr[$version]);
         }
     }
     foreach ($data['status'] as $status) {
         $host->addStatus($status);
     }
     return $host;
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:25,代码来源:Host.php


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