Esempio n. 1
0
 private function parseFacts()
 {
     // Split the record into facts
     if ($this->gedcom) {
         $gedcom_facts = preg_split('/\\n(?=1)/s', $this->gedcom);
         array_shift($gedcom_facts);
     } else {
         $gedcom_facts = array();
     }
     if ($this->pending) {
         $pending_facts = preg_split('/\\n(?=1)/s', $this->pending);
         array_shift($pending_facts);
     } else {
         $pending_facts = array();
     }
     $this->facts = array();
     foreach ($gedcom_facts as $gedcom_fact) {
         $fact = new WT_Fact($gedcom_fact, $this, md5($gedcom_fact));
         if ($this->pending !== null && !in_array($gedcom_fact, $pending_facts)) {
             $fact->setIsOld();
         }
         $this->facts[] = $fact;
     }
     foreach ($pending_facts as $pending_fact) {
         if (!in_array($pending_fact, $gedcom_facts)) {
             $fact = new WT_Fact($pending_fact, $this, md5($pending_fact));
             $fact->setIsNew();
             $this->facts[] = $fact;
         }
     }
 }