private function _NewContactInstance($contact_config) { $contact = new Contact($contact_config); $new_id_pattern = (string) $contact_config->attributes()->new_id; if (!$new_id_pattern) { $new_id_pattern = '%8d'; } // Replace config variable (maybe) by it value $new_id_pattern = preg_replace_callback('/\\{\\#([^\\}]+)\\}/', array($this, '_ReplaceConfigVariable'), $new_id_pattern); $contact->CLID = $this->DBContact->GenerateCLID($new_id_pattern); $contact->GroupName = (string) $contact_config->attributes()->group; $contact->ModuleName = $this->GetModuleName(); // XXX Need to rewrite contact -> tld bindings if ((bool) $this->GetManifest()->GetRegistryOptions()->ability->section_shared_contacts) { $contact->SectionName = ''; $contact->TargetIndex = 0; } else { $contact->SectionName = $this->GetManifest()->GetSectionName(); $i = 0; foreach ($contact_config->targets->target as $target) { $tlds = explode(',', $target->attributes()->tlds); if (in_array($this->Extension, $tlds)) { $contact->TargetIndex = $i; break; } $i++; } } if ($contact->TargetIndex === null) { throw new Exception("Failed to map registry extension to contact target group"); } return $contact; }