public static function isLivingDates($birthDate, $chrDate, $deathDate = null, $deathPlace = null, $deathDesc = null, $burDate = null, $burPlace = null, $burDesc = null) { if (ESINHandler::isNonLivingValue($deathDate) || ESINHandler::isNonLivingValue($deathPlace) || ESINHandler::isNonLivingValue($deathDesc) || ESINHandler::isNonLivingValue($burDate) || ESINHandler::isNonLivingValue($burPlace) || ESINHandler::isNonLivingValue($burDesc)) { return false; } $birthYear = StructuredData::getYear($birthDate); $chrYear = StructuredData::getYear($chrDate); return $birthYear && (int) date("Y") - (int) $birthYear < 110 || $chrYear && (int) date("Y") - (int) $chrYear < 110; }
protected function getFamilyMember($member, $label, $addSpouseLink, &$spouseLinks, $defaultName = '', $gender = '', $familyTitle = '') { global $wrHostName; // $birthKey = 0; $yearrange = ''; if (isset($member)) { $title = (string) $member['title']; $fullname = StructuredData::getFullname($member); if (!$fullname) { $fullname = trim(preg_replace('/\\(\\d+\\)\\s*$/', '', $title)); } $link = "[[Person:{$title}|{$fullname}]]"; $birthDate = (string) $member['birthdate'] ? (string) $member['birthdate'] : (string) $member['chrdate']; // $birthKey = StructuredData::getDateKey($birthDate, true); $beginYear = StructuredData::getYear($birthDate, true); $endYear = StructuredData::getYear((string) $member['deathdate'] ? (string) $member['deathdate'] : (string) $member['burialdate'], true); if ($beginYear || $endYear) { $yearrange = "<span class=\"wr-infobox-yearrange\">{$beginYear} - {$endYear}</span>"; } $this->addHistoricalDataRelative($label, $title, $fullname); } else { $fields = explode(' ', $defaultName, 2); $given = urlencode($fields[0]); $surname = urlencode($fields[1]); $sf = urlencode($familyTitle); $params = "&g={$given}&s={$surname}&gnd={$gender}&sf={$sf}"; $link = "{$defaultName} <span class=\"plainlinks wr-infobox-editlink\">([http://{$wrHostName}/wiki/Special:AddPage?ns=Person{$params} add])</span>"; } if ($addSpouseLink) { $spouseLinks[] = $link; } if ($label == 'C' || $label == 'S') { $label = ''; } if ($label) { $label = "<span class=\"wr-infobox-label\">{$label}</span>. "; } $result = "<li><span class=\"wr-infobox-fullname\">{$label}{$link}</span>{$yearrange}</li>"; // return array($birthKey, $result); return $result; }
private function getPersonSummary($member) { $yearrange = ''; $url = ''; $title = (string) $member['title']; $t = Title::newFromText($title, NS_PERSON); if ($t) { $url = $t->getFullURL(); } $fullname = StructuredData::getFullname($member); $birthDate = (string) $member['birthdate'] ? (string) $member['birthdate'] : (string) $member['chrdate']; $beginYear = StructuredData::getYear($birthDate, true); $endYear = StructuredData::getYear((string) $member['deathdate'] ? (string) $member['deathdate'] : (string) $member['burialdate'], true); if ($beginYear || $endYear) { $yearrange = "{$beginYear} - {$endYear}"; } return array('name' => $fullname, 'url' => $url, 'yearrange' => $yearrange, 'birthdate' => $birthDate, 'title' => $title); }
protected function getFamilyMember($member) { $title = (string) $member['title']; $fullname = StructuredData::getFullname($member); if (!$fullname) { $fullname = trim(preg_replace('/\\(\\d+\\)\\s*$/', '', $title)); } $link = "[[Person:{$title}|{$fullname}]]"; $beginYear = StructuredData::getYear((string) $member['birthdate'] ? (string) $member['birthdate'] : (string) $member['chrdate'], true); $endYear = StructuredData::getYear((string) $member['deathdate'] ? (string) $member['deathdate'] : (string) $member['burialdate'], true); $yearrange = ''; if ($beginYear || $endYear) { $yearrange = "<span class=\"wr-infobox-yearrange\">{$beginYear} - {$endYear}</span>"; } return '<span class="wr-infobox-fullname">' . $link . '</span>' . $yearrange; }