本文整理汇总了PHP中Fisharebest\Webtrees\Functions\FunctionsEdit::removeLinks方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionsEdit::removeLinks方法的具体用法?PHP FunctionsEdit::removeLinks怎么用?PHP FunctionsEdit::removeLinks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Functions\FunctionsEdit
的用法示例。
在下文中一共展示了FunctionsEdit::removeLinks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$old_gedcom = $linker->getGedcom();
$new_gedcom = FunctionsEdit::removeLinks($old_gedcom, $record->getXref());
// FunctionsDb::fetch_all_links() does not take account of pending changes. The links (or even the
// record itself) may have already been deleted.
if ($old_gedcom !== $new_gedcom) {
// If we have removed a link from a family to an individual, and it has only one member
if (preg_match('/^0 @' . WT_REGEX_XREF . '@ FAM/', $new_gedcom) && preg_match_all('/\\n1 (HUSB|WIFE|CHIL) @(' . WT_REGEX_XREF . ')@/', $new_gedcom, $match) == 1) {
// Delete the family
$family = GedcomRecord::getInstance($xref, $WT_TREE);
FlashMessages::addMessage(I18N::translate('The family “%s” has been deleted because it only has one member.', $family->getFullName()));
$family->deleteRecord();
// Delete any remaining link to this family
if ($match) {
$relict = GedcomRecord::getInstance($match[2][0], $WT_TREE);
$new_gedcom = $relict->getGedcom();
$new_gedcom = FunctionsEdit::removeLinks($new_gedcom, $linker->getXref());
$relict->updateRecord($new_gedcom, false);
FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $relict->getFullName(), $family->getFullName()));
}
} else {
// Remove links from $linker to $record
FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $linker->getFullName(), $record->getFullName()));
$linker->updateRecord($new_gedcom, false);
}
}
}
// Delete the record itself
$record->deleteRecord();
} else {
http_response_code(406);
}