VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/webtrees/resources/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/webtrees/resources/views/fact-gedcom-fields.phtml
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Elements\AbstractXrefElement;
use Fisharebest\Webtrees\Elements\XrefSource;
use Fisharebest\Webtrees\Gedcom;
use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Source;
use Fisharebest\Webtrees\Tree;

/**
 * @var string $gedcom
 * @var string $parent e.g. "INDI:BIRT:DATE"
 * @var Tree   $tree
 */

$hierarchy = explode(':', $parent);

// Merge CONT records onto their parent line.
$gedcom = preg_replace('/\n\d CONT ?/', "\r", $gedcom);

preg_match_all('/^(\d+) (\w+) ?(.*)/m', $gedcom, $matches);
[, $levels, $tags, $values] = $matches;
$levels   = array_map(static fn (string $x): int => (int) $x, $levels);
$keys     = array_keys($levels);
$elements = [];

$private_level = PHP_INT_MAX;

foreach ($keys as $key) {
    $hierarchy[$levels[$key]] = $tags[$key];
    $full_tag                 = implode(':', array_slice($hierarchy, 0, 1 + $levels[$key]));
    $elements[$key]           = Registry::elementFactory()->make($full_tag);

    if ($elements[$key] instanceof AbstractXrefElement && preg_match('/^@(' . Gedcom::REGEX_XREF . ')@$/', $values[$key], $match) === 1) {
        $record = Registry::gedcomRecordFactory()->make($match[1], $tree);

        if ($record instanceof GedcomRecord && !$record->canShow()) {
            $private_level = min($private_level, $levels[$key]);
        }
    }

    if ($levels[$key] >= $private_level) {
        $values[$key] = '';
    } else {
        $private_level = PHP_INT_MAX;
    }
}

?>

<?php if ($elements[0] instanceof XrefSource && preg_match('/^@(' . Gedcom::REGEX_XREF . ')@$/', $values[0], $match) === 1) : ?>
    <?php $source = Registry::sourceFactory()->make($match[1], $tree) ?>
    <?php if ($source instanceof Source) : ?>
        <?php $id = Registry::idFactory()->id() ?>
        <?php $expanded = $tree->getPreference('EXPAND_SOURCES') === '1' ?>
        <div>
            <?php if (isset($elements[1])) : ?>
                <button type="button" class="btn btn-text p-0" href="#<?= e($id) ?>" data-bs-toggle="collapse" aria-controls="<?= e($id) ?>" aria-expanded="<?= $expanded ? 'true' : 'false' ?>">
                        <?= view('icons/expand') ?>
                        <?= view('icons/collapse') ?>
                </button>
            <?php else : ?>
                <span class="btn btn-text p-0">
                    <?= view('icons/spacer') ?>
                </span>
            <?php endif ?>

            <?php $label = '<span class="label">' . I18N::translate('Source') . '</span>' ?>
            <?php $value = '<span class="field" dir="auto"><a href="' . e($source->url()) . '">' . $source->fullName() . '</a></span>' ?>
            <?= I18N::translate('%1$s: %2$s', $label, $value) ?>
        </div>

        <div id="<?= e($id) ?>" class="ps-4 collapse <?= $expanded ? 'show' : '' ?>">
            <?php array_shift($keys) ?>
            <?php foreach ($keys as $key) : ?>
                <?php if ($values[$key] !== '') : ?>
                    <?= $elements[$key]->labelValue(strtr($values[$key], ["\r" => "\n"]), $tree) ?>
                <?php endif ?>
            <?php endforeach ?>
        </div>
    <?php endif ?>
<?php else : ?>
    <?php foreach ($keys as $key) : ?>
        <?php if ($values[$key] !== '') : ?>
            <?= $elements[$key]->labelValue(strtr($values[$key], ["\r" => "\n"]), $tree) ?>
        <?php endif ?>
    <?php endforeach ?>
<?php endif ?>

VaKeR 2022