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


PHP FunctionsEdit::removeLinks方法代码示例

本文整理汇总了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);
 }
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:action.php


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