本文整理汇总了PHP中Family::loadFamilyMember方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::loadFamilyMember方法的具体用法?PHP Family::loadFamilyMember怎么用?PHP Family::loadFamilyMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Family
的用法示例。
在下文中一共展示了Family::loadFamilyMember方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatFamilyMemberElement
public static function formatFamilyMemberElement($tag, $titleString, $prevFamilyMembers = array())
{
// TODO If the family member used to be a child of this family and now it is a spouse of this family, and it has another set of parents,
// those parents won't appear in this person's spouse element in this family. Have to include this check in our periodic audit.
$title = Title::newFromText($titleString, NS_PERSON);
if ($title) {
if (isset($prevFamilyMembers[$title->getText()])) {
$person = $prevFamilyMembers[$title->getText()];
} else {
$person = Family::loadFamilyMember($title->getText());
}
$result = "<{$tag} title=\"" . StructuredData::escapeXml($title->getText()) . '"';
foreach (self::$FAMILY_MEMBER_ATTRS as $attr) {
if (isset($person[$attr]) && !($tag == 'child' && $attr == 'child_of_family')) {
$attrValue = trim($person[$attr]);
if (strlen($attrValue) > 0) {
$result .= " {$attr}=\"" . StructuredData::escapeXml($attrValue) . '"';
}
}
}
$result .= "/>\n";
} else {
$result = '';
}
return $result;
}
示例2: formatPageElement
private function formatPageElement($tag, $titleString, $ns)
{
$title = Title::newFromText($titleString, $ns);
if (!$title) {
return '';
}
$title = StructuredData::getRedirectToTitle($title);
// ok to read from slave here; mistakes will get corrected in propagate
if ($ns == NS_PERSON) {
if (isset($this->prevPeople[$title->getText()])) {
$page = $this->prevPeople[$title->getText()];
} else {
$page = Family::loadFamilyMember($title->getText());
}
$attrs = self::$PERSON_ATTRS;
} else {
// NS_FAMILY
if (isset($this->prevFamilies[$title->getText()])) {
$page = $this->prevFamilies[$title->getText()];
} else {
$page = array();
}
$attrs = self::$FAMILY_ATTRS;
}
$result = "<{$tag} title=\"" . StructuredData::escapeXml($title->getText()) . '"';
foreach ($attrs as $attr) {
if (isset($page[$attr])) {
$attrValue = trim($page[$attr]);
if (strlen($attrValue) > 0) {
$result .= " {$attr}=\"" . StructuredData::escapeXml($attrValue) . '"';
}
}
}
$result .= "/>\n";
return $result;
}