app/Functions/FunctionsPrint.php
public static function printFactNotes(Tree $tree, $factrec, $level): string
    {
        $data          = '';
        $previous_spos = 0;
        $nlevel        = $level + 1;
        $ct            = preg_match_all("/$level NOTE (.*)/", $factrec, $match, PREG_SET_ORDER);
        for ($j = 0; $j < $ct; $j++) {
            $spos1 = strpos($factrec, $match[$j][0], $previous_spos);
            $spos2 = strpos($factrec . "\n$level", "\n$level", $spos1 + 1);
            if (!$spos2) {
                $spos2 = strlen($factrec);
            }
            $previous_spos = $spos2;
            $nrec          = substr($factrec, $spos1, $spos2 - $spos1);
            if (!isset($match[$j][1])) {
                $match[$j][1] = '';
            }
            if (!preg_match('/^@(' . Gedcom::REGEX_XREF . ')@$/', $match[$j][1], $nmatch)) {
                $data .= self::printNoteRecord($tree, $match[$j][1], $nlevel, $nrec);
            } else {
                $note = Note::getInstance($nmatch[1], $tree);
                if ($note) {
                    if ($note->canShow()) {
                        $noterec = $note->gedcom();
                        $nt      = preg_match("/0 @$nmatch[1]@ NOTE (.*)/", $noterec, $n1match);
                        $data    .= self::printNoteRecord($tree, ($nt > 0) ? $n1match[1] : '', 1, $noterec);
                    }
                } else {
                    $data = '<div class="fact_NOTE"><span class="label">' . I18N::translate('Note') . '</span>: <span class="field error">' . $nmatch[1] . '</span></div>';
                }
            }
        }

        return $data;
    }
public static function printFactNotes(Tree $tree, $factrec, $level): string
    {
        $data          = '';
        $previous_spos = 0;
        $nlevel        = $level + 1;
        $ct            = preg_match_all("/$level NOTE (.*)/", $factrec, $match, PREG_SET_ORDER);
        for ($j = 0; $j < $ct; $j++) {
            $spos1 = strpos($factrec, $match[$j][0], $previous_spos);
            $spos2 = strpos($factrec . "\n$level", "\n$level", $spos1 + 1);
            if (!$spos2) {
                $spos2 = strlen($factrec);
            }
            $previous_spos = $spos2;
            $nrec          = substr($factrec, $spos1, $spos2 - $spos1);
            if (!isset($match[$j][1])) {
                $match[$j][1] = '';
            }
            if (!preg_match('/^@(' . Gedcom::REGEX_XREF . ')@$/', $match[$j][1], $nmatch)) {
                $data .= self::printNoteRecord($tree, $match[$j][1], $nlevel, $nrec);
            } else {
                $note = Note::getInstance($nmatch[1], $tree);
                if ($note) {
                    if ($note->canShow()) {
                        $noterec = $note->gedcom();
                        $nt      = preg_match("/0 @$nmatch[1]@ NOTE (.*)/", $noterec, $n1match);
                        $data    .= self::printNoteRecord($tree, ($nt > 0) ? $n1match[1] : '', 1, $noterec);
                    }
                } else {
                    $data = '<div class="fact_NOTE"><span class="label">' . I18N::translate('Note') . '</span>: <span class="field error">' . $nmatch[1] . '</span></div>';
                }
            }
        }

        return $data;
    }
public static function printFactNotes ( Tree $ tree , $ factrec , $ level ) : string { $ data = '' ; $ previous_spos = 0 ; $ nlevel = $ level + 1 ; $ ct = preg_match_all ( "/$level NOTE (.*)/" , $ factrec , $ match , PREG_SET_ORDER ) ; for ( $ j = 0 ; $ j < $ ct ; $ j ++ ) { $ spos1 = strpos ( $ factrec , $ match [ $ j ] [ 0 ] , $ previous_spos ) ; $ spos2 = strpos ( $ factrec . "\n$level" , "\n$level" , $ spos1 + 1 ) ; if ( ! $ spos2 ) { $ spos2 = strlen ( $ factrec ) ; } $ previous_spos = $ spos2 ; $ nrec = substr ( $ factrec , $ spos1 , $ spos2 - $ spos1 ) ; if ( ! isset ( $ match [ $ j ] [ 1 ] ) ) { $ match [ $ j ] [ 1 ] = '' ; } if ( ! preg_match ( '/^@(' . Gedcom :: REGEX_XREF . ')@$/' , $ match [ $ j ] [ 1 ] , $ nmatch ) ) { $ data .= self :: printNoteRecord ( $ tree , $ match [ $ j ] [ 1 ] , $ nlevel , $ nrec ) ; } else { $ note = Note :: getInstance ( $ nmatch [ 1 ] , $ tree ) ; if ( $ note ) { if ( $ note -> canShow ( ) ) { $ noterec = $ note -> gedcom ( ) ; $ nt = preg_match ( "/0 @$nmatch[1]@ NOTE (.*)/" , $ noterec , $ n1match ) ; $ data .= self :: printNoteRecord ( $ tree , ( $ nt > 0 ) ? $ n1match [ 1 ] : '' , 1 , $ noterec ) ; } } else { $ data = '<div class="fact_NOTE"><span class="label">' . I18N :: translate ( 'Note' ) . '</span>: <span class="field error">' . $ nmatch [ 1 ] . '</span></div>' ; } } } return $ data ; }
Print all of the notes in this fact record

@param Tree   $tree
@param string $factrec The factrecord to print the notes from
@param int    $level   The level of the factrecord

@return string HTML
Print all of the notes in this fact record