You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.1 KiB
59 lines
2.1 KiB
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @author Robert Strutts <Bob_586@Yahoo.com>
|
|
* @copyright (c) 2025, Robert Strutts
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace Project\outputs\app\home;
|
|
|
|
use \CodeHydrater\bootstrap\safer_io as SafeIO;
|
|
use \CodeHydrater\enums\view_type as ViewType;
|
|
|
|
class val_tests_out {
|
|
|
|
public static function entry(object $app, array & $input): array {
|
|
$html_output = [];
|
|
$errors = [];
|
|
foreach(SafeIO::html_escape_and_sanitize($input['html']) as $html) {
|
|
$key = $html['name'] ?? "";
|
|
$html_output[$key] = $html['html'];
|
|
if (\CodeHydrater\common::get_count($html['errors'])) {
|
|
$errors[$key] = $html['errors'][$key];
|
|
}
|
|
// dump($html);
|
|
}
|
|
|
|
$did_submit = ($input['method'] === "POST");
|
|
$name = $input['post_data']['name'] ?? "Anonymous";
|
|
$data = [
|
|
'table_options' => ['helper' => 'single-row','escape' => false],
|
|
'safe_html' => $html_output,
|
|
'did_submit' => $did_submit,
|
|
'table_headers' => $input['table_headers'],
|
|
'escaping' => ['escape' => false],
|
|
'post_data' => $input['post_data'],
|
|
'safe_name' => \CodeHydrater\bootstrap\safer_io::h($name),
|
|
'a_errors' => array_merge($input['a_errors'], $errors)
|
|
];
|
|
|
|
$app->view->set('twig_data', $data);
|
|
$app->view->set('twig_functions', [
|
|
'show_table' => '\CodeHydrater\html::show_table_from',
|
|
'show_errors' => '\CodeHydrater\html::show_errors',
|
|
]);
|
|
// $app->view->set('table_cells', $input['html']);
|
|
// $app->view->set('table_headers', $input['table_headers']);
|
|
// $app->view->include("app/val_tests", ViewType::PHP);
|
|
$content = $app->view->fetch($app, "app/val_tests.html", ViewType::TWIG);
|
|
|
|
$mem = \CodeHydrater\memory_usage::get_memory_stats(echo: false);
|
|
$content = \CodeHydrater\common::str_replace_first("</memory>", $mem, $content);
|
|
|
|
$app->response->set_content($content);
|
|
return [];
|
|
}
|
|
} |