예제 #1
0
 private function writePage($fullTitle)
 {
     $this->title = Title::newFromText($fullTitle);
     $id = $this->titleMap[$fullTitle];
     $obj = null;
     $this->xml = null;
     $this->contents = null;
     $ns = $this->title->getNamespace();
     if ($this->title->exists()) {
         if ($ns == NS_PERSON) {
             $obj = new Person($this->title->getText());
         } else {
             if ($ns == NS_FAMILY) {
                 $obj = new Family($this->title->getText());
             } else {
                 if ($ns == NS_SOURCE) {
                     $obj = new Source($this->title->getText());
                 } else {
                     if ($ns == NS_MYSOURCE) {
                         $obj = new MySource($this->title->getText());
                     }
                 }
             }
         }
         if ($obj) {
             $obj->loadPage();
             $this->xml = $obj->getPageXml();
             if ($this->xml == null) {
                 echo "XML not found for title=" . $this->title->getPrefixedText() . " treeId={$this->treeId}\n";
             }
             $this->contents = $obj->getPageContents();
         }
     }
     $this->refdCitations = array();
     $this->refdNotes = array();
     $this->refdImages = array();
     if ($ns == NS_PERSON) {
         $uid = "WeRelate:" . $this->title->getNsText() . ":" . $this->title->getDBkey();
         $this->writePerson($id, $uid);
     } else {
         if ($ns == NS_FAMILY) {
             $this->writeFamily($id);
         } else {
             if ($ns == NS_SOURCE) {
                 $this->writeSource($id);
             } else {
                 if ($ns == NS_MYSOURCE) {
                     $this->writeMySource($id);
                 }
             }
         }
     }
 }