db/demo_data
< >

return function () {
    $self = url('/@object/@action/' . urlencode('db/demo_data'));
    $demo = _class('docs')->_sample('demo_data');
    $p = $demo->params($_GET);
    $rows = $demo->rows($p);
    $h = fn ($v) => _prepare_html((string) $v, 0);

    $intro = '<p class="docs-demo-intro">The text generator of <b>Demo data</b> (admin Tools / Demo data, console <code>demo:seed</code>): the rows a
        source would write, made here in memory for the seed and language you choose; nothing is written to a database. Every value comes from
        fixed word, name and city lists (English, Ukrainian, German, Latin lorem) through a seeded generator, so a seed always gives the same rows;
        HTML columns get the same plain text inside a fixed <code><p></code> template. Addresses end in <code>example.invalid</code>,
        phone numbers are in the 555-01xx block and IPs in 192.0.2.0/24, all reserved for examples. On a site the admin module writes such
        rows only where a super-admin approves them, lists each one in a ledger and removes exactly those rows again.
        Classes: <code>yf_demo_seed</code>, <code>yf_demo_seed_text</code>, <code>yf_demo_seed_sources</code>.</p>';

    $select = function ($name, array $options, $selected, $label) use ($h) {
        $html = '<select name="' . $name . '" class="form-control form-select input-sm form-select-sm" aria-label="' . $h($label) . '">';
        foreach ($options as $value => $text) {
            $html .= '<option value="' . $h($value) . '"' . ((string) $value === (string) $selected ? ' selected' : '') . '>' . $h($text) . '</option>';
        }
        return $html . '</select>';
    };
    $sources = [];
    foreach ($demo->SOURCES as $s) {
        $sources[$s] = $demo->title($s);
    }
    $form = '<form method="get" action="' . $self . '" class="docs-demo-data-form">'
        . $select('source', $sources, $p['source'], 'Source') . $select('locale', $demo->LOCALES, $p['locale'], 'Language')
        . '<input type="number" name="seed" min="1" max="99999" value="' . (int) $p['seed'] . '" class="form-control input-sm form-control-sm" aria-label="Seed">'
        . $select('units', [1 => '1 unit', 2 => '2 units', 3 => '3 units', 4 => '4 units', 5 => '5 units'], $p['units'], 'Units')
        . '<button type="submit" class="btn btn-primary btn-sm">Generate</button></form>';

    $out = '';
    foreach ($rows as $e) {
        $cells = '';
        foreach ($e['row'] as $k => $v) {
            $v = is_scalar($v) ? (string) $v : '';
            $cells .= '<tr><th>' . $h($k) . '</th><td>' . $h(mb_strlen($v) > 200 ? mb_substr($v, 0, 200) . '…' : $v) . '</td></tr>';
        }
        $out .= '<div class="docs-demo-data-row"><div class="text-muted small">' . $h($e['table']) . '</div><table class="table table-condensed table-sm">' . $cells . '</table></div>';
    }
    css('.docs-demo-data-form { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-bottom:12px; } .docs-demo-data-form .form-control, .docs-demo-data-form .form-select { width:auto; }'
        . ' .docs-demo-data-rows { display:grid; grid-template-columns:repeat(auto-fill, minmax(340px, 1fr)); gap:10px; }'
        . ' .docs-demo-data-row { border:1px solid rgba(128,128,128,.3); border-radius:6px; padding:4px 8px; min-width:0; overflow-wrap:anywhere; } .docs-demo-data-row th { width:28%; }');
    return $intro . $form . '<div class="docs-demo-data-rows" id="docs-demo-data-rows">' . ($out ?: '<p>No rows.</p>') . '</div>';
};

The text generator of Demo data (admin Tools / Demo data, console demo:seed): the rows a source would write, made here in memory for the seed and language you choose; nothing is written to a database. Every value comes from fixed word, name and city lists (English, Ukrainian, German, Latin lorem) through a seeded generator, so a seed always gives the same rows; HTML columns get the same plain text inside a fixed <p> template. Addresses end in example.invalid, phone numbers are in the 555-01xx block and IPs in 192.0.2.0/24, all reserved for examples. On a site the admin module writes such rows only where a super-admin approves them, lists each one in a ledger and removes exactly those rows again. Classes: yf_demo_seed, yf_demo_seed_text, yf_demo_seed_sources.

news
titleWeek game place important name
urldemo-b1-1-week-game-place-important-name
head_textTeam bright service point hour large face time guy. Job line game, enjoy game case service story power.
full_text<p>Research money city guy small program. Teacher enjoy time book night research question end time. War reason issue important river guy book teacher, question small health life grow. Point market que…
meta_keywordsyoung, week, visit, place
meta_descIssue start side number friend moment community new eye way, part power air idea.
add_date1793445570
active1
localeen
news
titleCity take early level
urldemo-b1-2-city-take-early-level
head_textArt work simple force, question area guy case team hand. Teacher book high art program give, guy reason change.
full_text<p>Give open minute story, give small. High community information door week water word find. Business door work important give year water fact art question music moment garden. Green business new work…
meta_keywordswar, learn, team, hand
meta_descLevel coffee grow small history open hour house work public simple good power.
add_date1793187272
active1
localeen