This commit is contained in:
Sven Steinert
2026-05-13 11:57:52 +02:00
parent 6abf6f9c3d
commit f4511b9213
76 changed files with 4494 additions and 1940 deletions

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace KbMarkdownImporter\Frontend;
final class TemplateLoader
{
public function render(string $template, array $vars = []): void
{
$path = KB_MARKDOWN_IMPORTER_DIR . 'templates/' . $template . '.php';
if (! is_readable($path)) {
status_header(500);
echo esc_html__('Knowledgebase template missing.', 'kb-markdown-importer');
return;
}
extract($vars, EXTR_SKIP);
include $path;
}
public function capture(string $template, array $vars = []): string
{
ob_start();
$this->render($template, $vars);
return (string) ob_get_clean();
}
}