public static function getSummary($xml, $title) { // husband surname | husband given | wife surname | wife given | marriage date | marriage place list($husbandGiven, $husbandSurname, $wifeGiven, $wifeSurname) = StructuredData::parseFamilyTitle($title->getText()); $marriageDate = $marriagePlace = ''; if (isset($xml)) { if (isset($xml->husband)) { foreach ($xml->husband as $spouse) { $husbandGiven = (string) @$spouse['given']; $husbandSurname = (string) @$spouse['surname']; } } if (isset($xml->wife)) { foreach ($xml->wife as $spouse) { $wifeGiven = (string) @$spouse['given']; $wifeSurname = (string) @$spouse['surname']; } } if (isset($xml->event_fact)) { foreach ($xml->event_fact as $eventFact) { if ($eventFact['type'] == 'Marriage') { $marriageDate = (string) @$eventFact['date']; $marriagePlace = (string) @$eventFact['place']; } } } } return StructuredData::removeBars($husbandSurname) . '|' . StructuredData::removeBars($husbandGiven) . '|' . StructuredData::removeBars($wifeSurname) . '|' . StructuredData::removeBars($wifeGiven) . '|' . StructuredData::removeBars($marriageDate) . '|' . StructuredData::removePreBar($marriagePlace); }
public static function getSummary($xml, $title) { // surname | given | gender | birthdate | birthplace | deathdate | deathplace list($given, $surname) = StructuredData::parsePersonTitle($title->getText()); $gender = ''; $birthDate = $birthPlace = $deathDate = $deathPlace = ''; $chrDate = $chrPlace = $burDate = $burPlace = ''; $birthFound = $deathFound = false; if (isset($xml)) { $name = (string) @$xml->name['surname']; if ($name) { $surname = $name; } $name = (string) @$xml->name['given']; if ($name) { $given = $name; } $gender = (string) @$xml->gender; if (isset($xml->event_fact)) { foreach ($xml->event_fact as $eventFact) { if ($eventFact['type'] == 'Birth') { $birthFound = true; $birthDate = (string) @$eventFact['date']; $birthPlace = (string) @$eventFact['place']; } else { if ($eventFact['type'] == 'Christening' || $eventFact['type'] == 'Baptism') { $chrDate = (string) @$eventFact['date']; $chrPlace = (string) @$eventFact['place']; } else { if ($eventFact['type'] == 'Death') { $deathFound = true; $deathDate = (string) @$eventFact['date']; $deathPlace = (string) @$eventFact['place']; } else { if ($eventFact['type'] == 'Burial') { $burDate = (string) @$eventFact['date']; $burPlace = (string) @$eventFact['place']; } } } } } } } return StructuredData::removeBars($surname) . '|' . StructuredData::removeBars($given) . '|' . StructuredData::removeBars($gender) . '|' . StructuredData::removeBars($birthFound ? $birthDate : $chrDate) . '|' . StructuredData::removePreBar($birthFound ? $birthPlace : $chrPlace) . '|' . StructuredData::removeBars($deathFound ? $deathDate : $burDate) . '|' . StructuredData::removePreBar($deathFound ? $deathPlace : $burPlace); }