config = [ 'title' => 'HTML Block Plugin', 'type' => 'content', ]; } public function setAPI(PluginAPIInterface $api): void { $this->api = $api; } 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 .= '
' . htmlspecialchars($tr('file_info')) . ':
' . htmlspecialchars($tr('created')) . ': ' . htmlspecialchars($fileInfo['created']) . '
' . htmlspecialchars($tr('modified')) . ': ' . htmlspecialchars($fileInfo['modified']) . '
'; } // Add dynamic quick navigation $menu = $this->api->getMenu(); if (!empty($menu)) { $content .= '
' . htmlspecialchars($tr('quick_navigation')) . '
'; } } return $content; } public function getConfig(): array { return $this->config; } public function setConfig(array $config): void { $this->config = array_merge($this->config, $config); } }