當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。