rebuild to module

This commit is contained in:
2026-03-03 02:13:17 +01:00
parent ffb52c6789
commit e61f9fb889
23 changed files with 7618 additions and 73 deletions

View File

@@ -13,6 +13,16 @@ function t(string $key, $default = '', array $vars = []): string
return app()->i18n()->get($key, $default, $vars);
}
function modules(): \App\ModuleManager
{
return app()->modules();
}
function module_fn(string $module, string $name, mixed ...$args): mixed
{
return modules()->call($module, $name, ...$args);
}
/**
* Lädt ein Template-Partial.
*
@@ -56,6 +66,24 @@ function tpl(string $name, string $folder = 'landing', array $data = []): void
require $path;
}
function module_tpl(string $module, string $name, array $data = []): void
{
$base = __DIR__ . '/../../modules/' . $module . '/partials/';
foreach ([$module, $name] as $value) {
if (preg_match('/[^a-zA-Z0-9_\-]/', $value)) {
echo "<!-- module_tpl(): invalid parameter -->";
return;
}
}
$path = $base . $name . '.php';
if (file_exists($path)) {
extract($data);
require $path;
} else {
echo "<!-- module_tpl(): not found: {$module}/{$name} -->";
}
}
/**
* HTML Escaping Helper.
*/