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


PHP Domain::GetFlagList方法代码示例

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


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

示例1: FixTransferLonelyFlag

 private function FixTransferLonelyFlag(Domain $Domain, Changelist $Changes)
 {
     $added = $Changes->GetAdded();
     $removed = $Changes->GetRemoved();
     if (count($added) + count($removed) < 2 && in_array('clientTransferProhibited', array_merge($added, $removed))) {
         // Add flag that is presented in domain and not will be removed at this time
         $candidates = array_diff($Domain->GetFlagList(), $removed);
         if ($candidates) {
             $added[] = array_shift($candidates);
         } else {
             // Remove flag that not presented in domain and not will be added at this time
             $candidates = array_diff($this->epp_flags, $Domain->GetFlagList(), $added);
             if ($candidates) {
                 $removed[] = array_shift($candidates);
             }
         }
     }
     return array($added, $removed);
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:19,代码来源:class.RegistryModule.php

示例2: Save

 /**
  * Save domain in database
  *
  * @param Domain $domain
  * @return Domain
  */
 public function Save(Domain $domain)
 {
     if (!$domain->ID) {
         // check for duplicate domain
         $duplicate = $this->DB->GetOne('SELECT COUNT(*) FROM domains WHERE name = ? AND TLD = ?', array($domain->Name, $domain->Extension));
         if ($duplicate) {
             throw new Exception(sprintf(_('Domain %s already exists in DB and could\'t be added twice'), $domain->GetHostName()));
         }
     }
     // Properties data
     $row = array();
     foreach ($this->FieldPropertyMap as $field => $property) {
         $row[$field] = $domain->{$property} !== null ? $domain->{$property} : "";
     }
     if ($domain->IncompleteOrderOperation === null) {
         $row['incomplete_operation'] = null;
     }
     // Nameservers data
     $nslist = $domain->GetNameserverList();
     // If nameservers list smaller then size of db slots
     for ($i = 2; $i > count($ns_list); $i--) {
         $row['ns' . $i] = '';
     }
     $ns_n = array();
     foreach (array_values($nslist) as $i => $ns) {
         if ($i < 2) {
             $row['ns' . ($i + 1)] = $ns->HostName;
         } else {
             $ns_n[] = $ns->HostName;
         }
     }
     $row['ns_n'] = join(';', $ns_n);
     // Contacts data
     $contact_list = $domain->GetContactList();
     foreach ($this->ContactFieldTypeMap as $field => $contact_type) {
         $contact = $contact_list[$contact_type];
         // Add/Remove references to contact
         $row[$field] = $contact ? $contact->CLID : '';
     }
     // Domain extra fields
     $extra_fields = array();
     foreach ($domain->GetConfig()->xpath('registration/extra_fields/field') as $field) {
         settype($field, "array");
         $field = $field["@attributes"];
         if (isset($domain->{$field['name']})) {
             $extra_fields[$field['name']] = $domain->{$field['name']};
         }
     }
     foreach ((array) $domain->ExtraFields as $k => $v) {
         $extra_fields[$k] = $v;
     }
     // Prepare data for DB
     $row["start_date"] = $row["start_date"] ? date("Y-m-d H:i:s", $row["start_date"]) : '0000-00-00 00:00:00';
     $row["end_date"] = $row["end_date"] ? date("Y-m-d H:i:s", $row["end_date"]) : '0000-00-00 00:00:00';
     $row['dtTransfer'] = $row['dtTransfer'] ? date("Y-m-d H:i:s", $row["dtTransfer"]) : '0000-00-00 00:00:00';
     $row["islocked"] = (int) (bool) $row["islocked"];
     $row['managed_dns'] = (int) (bool) $row['managed_dns'];
     $row['period'] = (int) $row['period'];
     $row['delete_status'] = (int) $row['delete_status'];
     $row['renew_disabled'] = (int) (bool) $row['renew_disabled'];
     // Save it!
     //if ($domain->ID)
     unset($row['id']);
     // Prepare SQL statement
     $set = array();
     $bind = array();
     foreach ($row as $field => $value) {
         $set[] = "`{$field}` = ?";
         $bind[] = $value;
     }
     $set = join(', ', $set);
     $this->DB->BeginTrans();
     try {
         if ($domain->ID) {
             // Perform Update
             $bind[] = $domain->ID;
             $this->DB->Execute("UPDATE domains SET {$set} WHERE id = ?", $bind);
         } else {
             // Perform Insert
             $this->DB->Execute("INSERT INTO domains SET {$set}", $bind);
             $domain->ID = $this->DB->Insert_ID();
         }
         // Save extra data
         $this->DB->Execute('DELETE FROM domains_data WHERE domainid = ?', array($domain->ID));
         foreach ($extra_fields as $name => $value) {
             $this->DB->Execute('INSERT INTO domains_data SET `domainid` = ?, `key` = ?, `value` = ?', array($domain->ID, $name, $value));
         }
         // Save flags
         $this->DB->Execute('DELETE FROM domains_flags WHERE domainid = ?', array($domain->ID));
         $flag_list = $domain->GetFlagList();
         foreach ($flag_list as $flag) {
             $this->DB->Execute('INSERT INTO domains_flags SET domainid = ?, flag = ?', array($domain->ID, $flag));
         }
         // Save contacts
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:class.DBDomain.php


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