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


PHP Family::getPageXml方法代码示例

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


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

示例1: readPageXml

 function readPageXml($title)
 {
     $page = null;
     $xml = null;
     $titleString = $title->getText();
     if ($title->getNamespace() == NS_PERSON) {
         $page = new Person($titleString);
     } else {
         $page = new Family($titleString);
     }
     if ($page) {
         $page->loadPage();
         $xml = $page->getPageXml();
     }
     return $xml;
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:16,代码来源:AddTreePagesJob.php

示例2: readFamilyData

 public static function readFamilyData($titleString, &$data, &$gedcomData, $includeRelativeData = false, $includeNonCompareData = false, $revid = 0, $timestamp = '')
 {
     $children = array();
     $data['familyTitle'][] = $titleString;
     if (GedcomUtil::isGedcomTitle($titleString)) {
         $title = null;
         $data['Exists'] = true;
         $xml = GedcomUtil::getGedcomXml($gedcomData, $titleString);
         $data['GedcomMatchTitle'] = (string) $xml['match'];
         $contents = GedcomUtil::getGedcomContents($gedcomData, $titleString);
     } else {
         $title = Title::newFromText($titleString, NS_FAMILY);
         $data['Exists'] = $title->exists();
         $p = new Family($titleString);
         $p->loadPage($revid);
         if ($revid) {
             $data['Revid'][] = $revid;
         }
         // for consistency with readPersonData
         $xml = $p->getPageXml();
         $contents = $p->getPageContents();
     }
     $husbandFound = $wifeFound = false;
     if ($includeRelativeData) {
         CompareForm::initPersonData('husband', $data);
         CompareForm::initPersonData('wife', $data);
     }
     if (isset($xml)) {
         foreach ($xml->event_fact as $ef) {
             $type = (string) $ef['type'];
             if ($type == Family::$MARRIAGE_TAG || $type == Family::$ALT_MARRIAGE_TAG) {
                 CompareForm::getDatePlace($ef, 'Marriagedate', 'Marriageplace', $data);
             } else {
                 if ($includeNonCompareData) {
                     CompareForm::getOtherEvent($ef, '', $data);
                 }
             }
         }
         if ($includeNonCompareData) {
             CompareForm::getSINContents($xml, $contents, '', $data);
         }
         if ($includeRelativeData) {
             $husbandFound = CompareForm::readRelativeData('husband', $xml->husband, $data, $gedcomData, true, false, $includeNonCompareData, $timestamp);
             $wifeFound = CompareForm::readRelativeData('wife', $xml->wife, $data, $gedcomData, true, false, $includeNonCompareData, $timestamp);
             $i = 0;
             foreach ($xml->child as $c) {
                 $childTitle = (string) $c['title'];
                 if ($childTitle) {
                     $children[$i] = array();
                     CompareForm::initPersonData('child', $children[$i]);
                     if (GedcomUtil::isGedcomTitle($childTitle)) {
                         $childRevid = 0;
                     } else {
                         $t = Title::newFromText($childTitle, NS_PERSON);
                         $childRevid = $timestamp ? StructuredData::getRevidForTimestamp($t, $timestamp) : 0;
                     }
                     CompareForm::readPersonData('child', $childTitle, $children[$i], $gedcomData, false, false, true, $includeNonCompareData, $childRevid);
                     $i++;
                 }
             }
         } else {
             $data['husbandTitle'] = array();
             foreach ($xml->husband as $m) {
                 $data['husbandTitle'][] = (string) $m['title'];
             }
             $data['wifeTitle'] = array();
             foreach ($xml->wife as $m) {
                 $data['wifeTitle'][] = (string) $m['title'];
             }
             $data['childTitle'] = array();
             foreach ($xml->child as $m) {
                 $data['childTitle'][] = (string) $m['title'];
             }
         }
     } else {
         if ($title && StructuredData::isRedirect($contents)) {
             $data['Redirect'] = true;
         }
     }
     if ($includeRelativeData && (!$husbandFound || !$wifeFound)) {
         list($fg, $fs, $mg, $ms) = StructuredData::parseFamilyTitle($titleString);
         if (!$husbandFound) {
             if ($fg) {
                 $data['husbandGiven'][] = $fg;
             }
             if ($fs) {
                 $data['husbandSurname'][] = $fs;
             }
         }
         if (!$wifeFound) {
             if ($mg) {
                 $data['wifeGiven'][] = $mg;
             }
             if ($ms) {
                 $data['wifeSurname'][] = $ms;
             }
         }
     }
     $data['Nomerge'] = CompareForm::getNomergeTitleStrings($title);
     if ($title) {
//.........这里部分代码省略.........
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:SpecialCompare.php

示例3: getFamilyData

 public function getFamilyData($titleString, $orn, $numDescLevels, $numAncLevels)
 {
     global $wgServer, $wgStylePath;
     $family = new Family($titleString);
     $xml = $family->getPageXml(true);
     $obj = array();
     if (isset($xml)) {
         $obj['name'] = 'Family';
         $obj['id'] = $family->getTitle()->getPrefixedDBkey();
         // populate data
         list($marriageYear, $marriageDate, $marriagePlace, $eventTypeIndex) = $this->getEventData($xml, array('Marriage'));
         $thumbURL = $this->getPrimaryImage($xml, false);
         $data = array();
         $data['url'] = $family->getTitle()->getFullURL();
         $found = false;
         list($hg, $hs, $wg, $ws) = StructuredData::parseFamilyTitle($titleString);
         foreach ($xml->husband as $p) {
             $person = $this->getPersonSummary($p);
             if ($person['name']) {
                 $data['husbandname'] = $person['name'];
             }
             if ($person['url']) {
                 $data['husbandurl'] = $person['url'];
             }
             if ($person['yearrange']) {
                 $data['husbandyearrange'] = $person['yearrange'];
             }
             $found = true;
             break;
         }
         if (!$found) {
             $data['husbandname'] = "{$hg} {$hs}";
         }
         $found = false;
         foreach ($xml->wife as $p) {
             $person = $this->getPersonSummary($p);
             if ($person['name']) {
                 $data['wifename'] = $person['name'];
             }
             if ($person['url']) {
                 $data['wifeurl'] = $person['url'];
             }
             if ($person['yearrange']) {
                 $data['wifeyearrange'] = $person['yearrange'];
             }
             $found = true;
             break;
         }
         if (!$found) {
             $data['wifename'] = "{$wg} {$ws}";
         }
         $children = array();
         // sort by birth date -- use sort for fetching children as well
         $sort = array();
         $ix = 0;
         $prevKey = 0;
         foreach ($xml->child as $p) {
             $person = $this->getPersonSummary($p);
             $key = StructuredData::getDateKey($person['birthdate'], true);
             if ($key) {
                 $prevKey = $key;
             } else {
                 $key = $prevKey;
             }
             $sort[$key * 50 + $ix] = $person;
             $ix++;
         }
         ksort($sort, SORT_NUMERIC);
         $ix = 0;
         foreach ($sort as $key => $person) {
             if ($ix++ == 12) {
                 $data['morechildren'] = 'true';
                 break;
             }
             $child = array();
             if ($person['name']) {
                 $child['name'] = $person['name'];
             }
             if ($person['url']) {
                 $child['url'] = $person['url'];
             }
             if ($person['yearrange']) {
                 $child['yearrange'] = $person['yearrange'];
             }
             $children[] = $child;
         }
         $data['children'] = $children;
         if ($marriageDate) {
             $data['marriagedate'] = $marriageDate;
         }
         if ($marriagePlace) {
             $data['marriageplace'] = $marriagePlace;
         }
         //         if ($marriagePlaceUrl) $data['marriageplaceurl'] = $marriagePlaceUrl;
         $data['type'] = 'Family';
         $data['$orn'] = $orn;
         if ($thumbURL) {
             $data['thumb'] = $this->makeImgTag($thumbURL, $titleString);
         }
         //         $data['icon'] = $this->makeImgTag($wgServer.$wgStylePath.TreeData::FAMILY_ICON, 'Family', TreeData::FAMILY_ICON_WIDTH, TreeData::FAMILY_ICON_HEIGHT);
//.........这里部分代码省略.........
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:GetTreeData.php

示例4: setFamilyMatchVars

 private function setFamilyMatchVars($gedcomData)
 {
     if ($gedcomData) {
         $xml = GedcomUtil::getGedcomXml($gedcomData, $this->pagetitle);
     } else {
         $f = new Family($this->pagetitle);
         $xml = $f->getPageXml();
     }
     if (isset($xml)) {
         // add match string
         foreach ($xml->husband as $h) {
             $this->husbandGivenname .= ($this->husbandGivenname ? ' ' : '') . (string) @$h['given'];
             $this->husbandSurname .= ($this->husbandSurname ? ' ' : '') . (string) @$h['surname'];
         }
         foreach ($xml->wife as $w) {
             $this->wifeGivenname .= ($this->wifeGivenname ? ' ' : '') . (string) @$w['given'];
             $this->wifeSurname .= ($this->wifeSurname ? ' ' : '') . (string) @$w['surname'];
         }
         foreach ($xml->event_fact as $ef) {
             $type = (string) $ef['type'];
             if ($type == Family::$MARRIAGE_TAG) {
                 $this->marriagedate = (string) @$ef['date'];
                 $this->marriageplace = (string) @$ef['place'];
                 $pos = strpos($this->marriageplace, '|');
                 if ($pos !== false) {
                     $this->marriageplace = substr($this->marriageplace, 0, $pos);
                 }
                 break;
             }
         }
     }
     if (!$this->husbandGivenname || !$this->husbandSurname || !$this->wifeGivenname || !$this->wifeSurname) {
         $t = Title::makeTitleSafe(NS_FAMILY, $this->pagetitle);
         if ($t) {
             list($hg, $hs, $wg, $ws) = StructuredData::parseFamilyTitle($t->getText());
             if (!$this->husbandGivenname) {
                 $this->husbandGivenname = $hg;
             }
             if (!$this->husbandSurname) {
                 $this->husbandSurname = $hs;
             }
             if (!$this->wifeGivenname) {
                 $this->wifeGivenname = $wg;
             }
             if (!$this->wifeSurname) {
                 $this->wifeSurname = $ws;
             }
         }
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:50,代码来源:SpecialSearch.php

示例5: getFamilyBadge

    protected function getFamilyBadge($family, $isParentsSiblings, $gender, $parentFamilies, &$marriageEvents)
    {
        global $wrHostName;
        $marriageKey = 0;
        $title = (string) $family['title'];
        $warning = '';
        $subtitle = '';
        if ($isParentsSiblings) {
            $label = "Parents and Siblings";
            $husbandLabel = 'F';
            $wifeLabel = 'M';
            $childLabel = 'S';
            $class = "wr-infobox-parentssiblings";
            if (count($parentFamilies) > 1) {
                $pfs = array();
                foreach ($parentFamilies as $pf) {
                    $t = Title::newFromText($pf, NS_FAMILY);
                    $pfs[] = wfUrlencode($t->getDBkey());
                }
                $warning = "Duplicate parents - <span class=\"plainlinks\">[http://{$wrHostName}/wiki/Special:Compare?ns=Family&compare=" . join('|', $pfs) . " compare]</span>";
            }
        } else {
            $label = "Spouse and Children";
            $husbandLabel = 'H';
            $wifeLabel = 'W';
            $childLabel = 'C';
            $class = "wr-infobox-spousechildren";
        }
        $spouses = '';
        $marriage = '';
        $children = '';
        $spouseLinks = array();
        if ($this->isGedcomPage) {
            if (mb_strpos($title, ' - Excluded (') > 0) {
                $label .= ' - Excluded';
            }
            $spouses = "<li>[[Family:{$title}|View family members]]<br><span style=\"font-size:75%\">family members not shown in gedcom review</span></li>";
        } else {
            $familyObject = new Family($title);
            $familyXml = $familyObject->getPageXml(true);
            if (isset($familyXml)) {
                if (isset($familyXml->husband)) {
                    foreach ($familyXml->husband as $spouse) {
                        $spouses .= $this->getFamilyMember($spouse, $husbandLabel, !$isParentsSiblings && $gender == 'F', $spouseLinks);
                    }
                } else {
                    list($hg, $hs, $wg, $ws) = StructuredData::parseFamilyTitle($title);
                    if ($hg || $hs) {
                        $spouses .= $this->getFamilyMember(null, $husbandLabel, !$isParentsSiblings && $gender == 'F', $spouseLinks, "{$hg} {$hs}", 'M', $title);
                    }
                }
                if (isset($familyXml->wife)) {
                    foreach ($familyXml->wife as $spouse) {
                        $spouses .= $this->getFamilyMember($spouse, $wifeLabel, !$isParentsSiblings && $gender == 'M', $spouseLinks);
                    }
                } else {
                    list($hg, $hs, $wg, $ws) = StructuredData::parseFamilyTitle($title);
                    if ($wg || $ws) {
                        $spouses .= $this->getFamilyMember(null, $wifeLabel, !$isParentsSiblings && $gender == 'M', $spouseLinks, "{$wg} {$ws}", 'F', $title);
                    }
                }
                if (isset($familyXml->event_fact)) {
                    foreach ($familyXml->event_fact as $eventFact) {
                        if ((string) $eventFact['type'] == 'Marriage') {
                            $marriageDate = (string) $eventFact['date'];
                            $marriageKey = StructuredData::getDateKey($marriageDate, true);
                            $marriage = "<div class=\"wr-infobox-event\">m. <span class=\"wr-infobox-date\">{$marriageDate}</span></div>";
                        }
                        if (!$isParentsSiblings) {
                            $marriageDesc = (string) $eventFact['desc'];
                            if ($marriageDesc) {
                                $marriageDesc .= '<br/>';
                            }
                            // sometimes event type is "Reference Number" -- I don't know why
                            $conjunction = @Family::$EVENT_CONJUNCTIONS[(string) $eventFact['type']];
                            $marriageDesc .= $conjunction . ' ' . join(' or ', $spouseLinks);
                            $marriageEvents[] = array('type' => (string) $eventFact['type'], 'date' => (string) $eventFact['date'], 'place' => (string) $eventFact['place'], 'desc' => $marriageDesc, 'srcs' => (string) $eventFact['sources'], 'no_citation_needed' => true);
                        }
                    }
                }
                foreach ($familyXml->child as $child) {
                    $children .= $this->getFamilyMember($child, $childLabel, false, $spouseLinks);
                }
                if ($children) {
                    $children = "<ol>{$children}</ol>";
                }
            } else {
                list($hg, $hs, $wg, $ws) = StructuredData::parseFamilyTitle($title);
                if ($hg || $hs) {
                    $spouses .= $this->getFamilyMember(null, $husbandLabel, false, $spouseLinks, "{$hg} {$hs}", 'M', $title);
                }
                if ($wg || $ws) {
                    $spouses .= $this->getFamilyMember(null, $wifeLabel, false, $spouseLinks, "{$wg} {$ws}", 'F', $title);
                }
            }
            $t = Title::makeTitleSafe(NS_FAMILY, $title);
            $subtitle = "<div class=\"wr-infobox-editlink\"><span class=\"plainlinks\">([" . $t->getFullURL('action=edit') . " edit])</span></div>";
        }
        if ($warning) {
            $subtitle = "<div class=\"wr-infobox-warning\">{$warning}</div>";
//.........这里部分代码省略.........
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:Person.php


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