*/ private array $config; /** * Plugin-API instantie voor communicatie met de CMS-core. * * @since 2.6.5 * @var PluginAPIInterface|null */ private ?PluginAPIInterface $api = null; /** * Initialiseert de plugin met standaardconfiguratie. * * @since 2.6.5 */ public function __construct() { $this->config = [ 'title' => 'HTML Block Plugin', 'type' => 'content', ]; } /** * Stelt de Plugin-API instantie in. * * @since 2.6.5 * @param PluginAPIInterface $api De Plugin-API instantie. * @return void */ public function setAPI(PluginAPIInterface $api): void { $this->api = $api; } /** * Genereert de HTML-inhoud voor de zijbalk. * * Toont informatie over de huidige pagina, taal, homepage-status, * bestandsinformatie en een snelle navigatielijst. * * @since 2.6.5 * @return string De opgebouwde HTML voor de zijbalk. */ public function getSidebarContent(): string { // Content plugin: translations follow the current content language. $t = $this->api ? $this->api->getPluginTranslations('HTMLBlock') : []; $tr = function (string $key) use ($t): string { return $t[$key] ?? $key; }; $currentPage = $this->api ? $this->api->getCurrentPageTitle() : $tr('unknown'); $isHomepage = $this->api ? $this->api->isHomepage() : false; $currentLang = $this->api ? $this->api->getCurrentLanguage() : 'nl'; $currentPath = $_GET['page'] ?? ''; $currentPath = preg_replace('/\.(md|php|html)$/', '', $currentPath); $content = '
' . htmlspecialchars($tr('current_page')) . ': ' . htmlspecialchars($currentPage) . '
' . htmlspecialchars($tr('language')) . ': ' . strtoupper($currentLang) . '
' . htmlspecialchars($tr('homepage')) . ': ' . htmlspecialchars($isHomepage ? $tr('yes') : $tr('no')) . '
'; // Add page-specific content if ($this->api) { $fileInfo = $this->api->getCurrentPageFileInfo(); if ($fileInfo) { $content .= '