v2.6.5 (Lyra): Dynamische pad-resolutie, WordPress-stijl docblocks, security-fix wachtwoord, git-historie schoon
- Bug: dashboard toonde 0 content (AdminPluginAPI::getContentDir() gaf relatief pad terug zonder normalisatie) - Dynamische pad-resolutie: PluginAPIInterface uitgebreid met getProjectRoot/getContentDir/getPluginsDir/getVersionInfo; CMSAPI en AdminPluginAPI implementeren deze universeel - public/index.php media-serving gebruikt $config['content_dir'] i.p.v. hardcoded /content - Navigation en Logs plugins halen paden via de API i.p.v. hardcoded dirname(__DIR__) - WordPress-stijl docblocks toegevoegd voor alle classes, methods, properties en functies (~450 docblocks, @since 2.6.5) - Security: hardcoded plaintext-wachtwoord 'admin' verwijderd uit AdminAuth.php; bij eerste installatie wordt een cryptografisch veilig wachtwoord gegenereerd (random_bytes, 16 tekens) en eenmalig op het inlogscherm getoond - Security: git-geschiedenis schoongemaakt (admin.json, admin.json.example, admin-console/config/admin.json verwijderd uit alle commits; filter-branch over alle branches + tags, gc --prune --aggressive) - README.md, README.en.md, AGENTS.md bijgewerkt - Test-scripts bijgewerkt naar clean-URL structuur + actuele ARIA-waarden - Versie verhoogd naar 2.6.5 - Tests: pentest 29/29, WCAG 25/25, functioneel 16/16, enhanced 25/25
This commit is contained in:
@@ -11,13 +11,13 @@
|
||||
* Bootstrap 5 styling, file-based organisatie, SEO-vriendelijke URLs en
|
||||
* responsive design.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*/
|
||||
class CodePressCMS {
|
||||
/**
|
||||
* Configuratie-array met alle site-instellingen.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @var array
|
||||
*/
|
||||
public $config;
|
||||
@@ -25,7 +25,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Actieve taalcode van het huidige verzoek (bijv. 'nl' of 'en').
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @var string
|
||||
*/
|
||||
public $currentLanguage;
|
||||
@@ -33,7 +33,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Resultaten van de laatst uitgevoerde zoekopdracht.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @var array
|
||||
*/
|
||||
public $searchResults = [];
|
||||
@@ -41,7 +41,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Opgebouwde menu-structuur vanuit de content-directory.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @var array
|
||||
*/
|
||||
private $menu = [];
|
||||
@@ -51,7 +51,7 @@ class CodePressCMS {
|
||||
*
|
||||
* Wordt lazy geinitialiseerd in getEffectiveDefaultPage().
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @var string|null
|
||||
*/
|
||||
private ?string $effectiveDefaultPage = null;
|
||||
@@ -59,7 +59,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Geladen vertalingen voor de actieve taal.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @var array
|
||||
*/
|
||||
private $translations = [];
|
||||
@@ -67,7 +67,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* PluginManager-instance die plugins en hooks beheert.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @var PluginManager
|
||||
*/
|
||||
private $pluginManager;
|
||||
@@ -79,7 +79,7 @@ class CodePressCMS {
|
||||
* initialiseert de PluginManager en de CMSAPI, bouwt het menu op en
|
||||
* voert een eventuele zoekopdracht uit.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param array $config Configuration array containing site settings.
|
||||
* @return void
|
||||
@@ -114,7 +114,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Bouw een clean URL voor een pagina.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string|null $page Page path (e.g., 'blog/leren/artikel').
|
||||
* @param string|null $lang Language code.
|
||||
@@ -144,7 +144,7 @@ class CodePressCMS {
|
||||
* slash zijn. De punt blijft behouden zodat content-bestandsextensies
|
||||
* (md/php/html) in de URL overleven.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $page Page parameter.
|
||||
* @return string Gesanitizeerde pagina-parameter of 'invalid-page'.
|
||||
@@ -161,7 +161,7 @@ class CodePressCMS {
|
||||
*
|
||||
* Het resultaat wordt gecached in $effectiveDefaultPage.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @return string Page key that is served on the language root URL.
|
||||
*/
|
||||
@@ -181,7 +181,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Bouw een clean admin URL.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $route Admin route.
|
||||
* @param array $params Additional query parameters.
|
||||
@@ -198,7 +198,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Bouw een URL-string voor gebruik in templates (niet-statisch, met huidige taal-context).
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $page Pagina-pad.
|
||||
* @param array $extraParams Extra query parameters.
|
||||
@@ -211,7 +211,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Bepaal de actieve taal vanuit het verzoek of de configuratie.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @return string Current language code.
|
||||
*/
|
||||
@@ -227,7 +227,7 @@ class CodePressCMS {
|
||||
*
|
||||
* Elke taal is een subdirectory onder language/ met een site.php-bestand.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @return array Available languages with their codes and names.
|
||||
*/
|
||||
@@ -267,7 +267,7 @@ class CodePressCMS {
|
||||
*
|
||||
* Valt terug op de standaardtaal en daarna op een lege array.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $lang Language code.
|
||||
* @return array Translations array.
|
||||
@@ -299,7 +299,7 @@ class CodePressCMS {
|
||||
*
|
||||
* Bevat een statische mapping van ISO-codes naar native taalnamen.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $langCode Language code.
|
||||
* @return string Native language name.
|
||||
@@ -383,7 +383,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Geef vertaalde tekst voor een sleutel terug.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $key Translation key.
|
||||
* @return string Translated text, of de sleutel zelf indien geen vertaling gevonden.
|
||||
@@ -397,7 +397,7 @@ class CodePressCMS {
|
||||
*
|
||||
* Roept de plugin-actie 'onMenuBuild' aan na het scannen.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return void
|
||||
*/
|
||||
private function buildMenu() {
|
||||
@@ -408,7 +408,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Scan recursief een directory voor content-bestanden en mappen.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $dir Directory path to scan.
|
||||
* @param string $prefix Relative path prefix.
|
||||
@@ -471,7 +471,7 @@ class CodePressCMS {
|
||||
* Reset de zoekresultaten, doorzoekt de content-directory en vuurt de
|
||||
* plugin-actie 'onSearch' af.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $query Search query string.
|
||||
* @return void
|
||||
@@ -485,7 +485,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Doorzoek recursief de bestanden in een directory naar de query.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $dir Directory to search in.
|
||||
* @param string $prefix Relative path prefix.
|
||||
@@ -524,7 +524,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Maak een zoeksnippet met de gevonden query.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $content Full content to create snippet from.
|
||||
* @param string $query Search query to highlight.
|
||||
@@ -546,7 +546,7 @@ class CodePressCMS {
|
||||
* Behandelt zoek-, guide-, welcome- en 404-verzoeken, path-traversal-
|
||||
* validatie, directory-listings en taal-specifieke bestandsversies.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return array Page data with title and content.
|
||||
*/
|
||||
public function getPage() {
|
||||
@@ -662,7 +662,7 @@ class CodePressCMS {
|
||||
* type eerst geprobeerd, zodat /nl/test.php test.php serveert ook als
|
||||
* test.md bestaat.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $basePath Absolute path without extension.
|
||||
* @param string|null $preferredExt Optional extension to try first (md|php|html).
|
||||
@@ -693,7 +693,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Verzamel bestandsinformatie inclusief aanmaak- en wijzigingsdatums.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $filePath Path to the file.
|
||||
* @param array $metadata Optional frontmatter metadata.
|
||||
@@ -735,7 +735,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Format een bestandsgrootte in leesbare vorm (B, KB, MB, GB).
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param int $bytes File size in bytes.
|
||||
* @return string Formatted file size.
|
||||
@@ -754,7 +754,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Bouw de content voor de zoekresultatenpagina.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return array Search results page data.
|
||||
*/
|
||||
private function getSearchResults() {
|
||||
@@ -787,7 +787,7 @@ class CodePressCMS {
|
||||
* Herkent een blok dat begint en eindigt met `---` en levert een array
|
||||
* met de metadata en de content zonder het meta-blok.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $content Raw content.
|
||||
* @return array Parsed metadata and content without meta block.
|
||||
@@ -830,7 +830,7 @@ class CodePressCMS {
|
||||
* Bevat de huidige HTTP_HOST (inclusief www-variant) en eventueel de
|
||||
* author-website host.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return array List of host names.
|
||||
*/
|
||||
private function getInternalHosts(): array
|
||||
@@ -862,7 +862,7 @@ class CodePressCMS {
|
||||
*
|
||||
* Behandelt hostnames die zonder protocol zijn opgeslagen (bijv. "noorlander.info").
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $url Raw URL or hostname.
|
||||
* @return string Normalized absolute URL, or '' if empty.
|
||||
@@ -885,7 +885,7 @@ class CodePressCMS {
|
||||
* Trekt eerst frontmatter-metadata uit, bepaalt de titel en configureert
|
||||
* de CommonMark-omgeving met extensies en custom afbeeldingsgrootte-syntax.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $content Raw Markdown content.
|
||||
* @param string $actualFilePath Path to the source file (used for display name fallback).
|
||||
@@ -991,7 +991,7 @@ class CodePressCMS {
|
||||
* Bestaande `<a>`-tags, `<h1>`-inhoud en Markdown-links worden beschermd
|
||||
* tegen dubbele linking. De titel van de huidige pagina wordt overgeslagen.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $content Content to process for auto-linking.
|
||||
* @param string $excludeTitle Title to exclude from auto-linking (current page title).
|
||||
@@ -1033,7 +1033,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Verzamel alle content-entries (mappen + bestanden) uit de content-directory.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @return array List of entries: ['path' => ..., 'title' => ..., 'type' => ...].
|
||||
* type is 'md'/'php'/'html' voor bestanden, 'folder' voor mappen.
|
||||
@@ -1053,7 +1053,7 @@ class CodePressCMS {
|
||||
* zit in het pad), en mappen krijgen hun eigen entry zodat de boom zichtbaar
|
||||
* blijft.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $dir Directory to scan.
|
||||
* @param string $prefix Relative path prefix.
|
||||
@@ -1102,7 +1102,7 @@ class CodePressCMS {
|
||||
* content-extensies, zet streepjes/underscores om in spaties en past
|
||||
* special cases toe (bijv. 'ict' -> 'ICT').
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $filename Filename without extension.
|
||||
* @return string Formatted display name.
|
||||
@@ -1145,7 +1145,7 @@ class CodePressCMS {
|
||||
* Voor Markdown wordt het eerste H1 gebruikt, voor PHP een $title-
|
||||
* variabele en voor HTML de <title>- of <h1>-tag.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $filePath Path to the file.
|
||||
* @return string|null Extracted title or null if not found.
|
||||
@@ -1184,7 +1184,7 @@ class CodePressCMS {
|
||||
* geinclude bestand. Wanneer het bestand een string returnt wordt
|
||||
* die als content gebruikt in plaats van de gebufferde output.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $filePath Path to PHP file.
|
||||
* @return array Parsed content with title and body.
|
||||
@@ -1233,7 +1233,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Parse HTML-content en extraheer de titel.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $content Raw HTML content.
|
||||
* @param string $actualFilePath Path to the source file (used for display name fallback).
|
||||
@@ -1270,7 +1270,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Controleer of de content-directory leeg is.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @return bool True if content directory is empty or doesn't exist.
|
||||
*/
|
||||
@@ -1297,7 +1297,7 @@ class CodePressCMS {
|
||||
* Toont een duidelijke "nieuwe installatie"-boodschap met vervolgstappen
|
||||
* wanneer de content-directory nog geen content-bestanden bevat.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return array Welcome page data.
|
||||
*/
|
||||
private function getWelcomePage() {
|
||||
@@ -1344,7 +1344,7 @@ class CodePressCMS {
|
||||
* Valt terug op het Engelse equivalent indien de gevraagde taal niet
|
||||
* beschikbaar is. Bouwt tevens breadcrumbs op voor de handleiding.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return array Guide page data.
|
||||
*/
|
||||
private function getGuidePage() {
|
||||
@@ -1418,7 +1418,7 @@ class CodePressCMS {
|
||||
* daarin. Leest eventuele layout/plugins-metadata uit een index.md in
|
||||
* dezelfde map.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $pagePath Relative path to directory.
|
||||
* @param string $dirPath Absolute path to directory.
|
||||
@@ -1524,7 +1524,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Geef de content van de 404-foutpagina.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return array 404 page data.
|
||||
*/
|
||||
private function getError404() {
|
||||
@@ -1545,7 +1545,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Geef de opgebouwde menu-structuur terug.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return array Menu structure for navigation.
|
||||
*/
|
||||
public function getMenu() {
|
||||
@@ -1559,7 +1559,7 @@ class CodePressCMS {
|
||||
* (menu, sidebar, breadcrumbs, SEO, theme-assets) en echoot de
|
||||
* gerenderde layout via ThemeManager.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return void
|
||||
*/
|
||||
public function render() {
|
||||
@@ -1730,7 +1730,7 @@ class CodePressCMS {
|
||||
* Ondersteunt guide-pagina's, zoekpagina's en reguliere content-pagina's
|
||||
* met subdirectory's. Toont optioneel een sidebar-toggle-knop.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param bool $hasSidebar Whether sidebar content exists and should show toggle.
|
||||
* @param array|null $guidePage Guide page data (when on a guide page).
|
||||
@@ -1818,7 +1818,7 @@ class CodePressCMS {
|
||||
* Bestanden op root-niveau worden als tabs getoond; bestanden in mappen
|
||||
* als dropdown-items. Mappen zonder kinderen worden als uitgevinkt getoond.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param array $items Menu items to render.
|
||||
* @param int $level Current nesting level.
|
||||
@@ -1892,7 +1892,7 @@ class CodePressCMS {
|
||||
* waarden worden doorgegeven zodat ThemeManager kan terugvallen op
|
||||
* default_layout.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $layout Layout value from page metadata.
|
||||
* @return string Theme template key.
|
||||
@@ -1913,7 +1913,7 @@ class CodePressCMS {
|
||||
* Scant de content-directory naar het eerste .md/.php/.html-bestand
|
||||
* (met voorkeur voor bestanden zonder taal-prefix) en geeft de page-key terug.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @return string Detected page key, or 'index' as fallback.
|
||||
*/
|
||||
@@ -1943,7 +1943,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Detecteer de meest recent gewijzigde of aangemaakte pagina.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @return string Page key that was most recently modified or created.
|
||||
*/
|
||||
@@ -2022,7 +2022,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Geef de titel van de homepagina terug.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
* @return string Homepage title.
|
||||
*/
|
||||
private function getHomepageTitle() {
|
||||
@@ -2034,7 +2034,7 @@ class CodePressCMS {
|
||||
/**
|
||||
* Controleer of een map de actieve pagina bevat.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param array $children Array of child items.
|
||||
* @return bool True if active page is found in children.
|
||||
@@ -2065,7 +2065,7 @@ class CodePressCMS {
|
||||
* data:-/mailto:-URLs, fragment-URLs en clean taal-voorziene
|
||||
* pagina-routes blijven ongemoeid.
|
||||
*
|
||||
* @since 2.6.4
|
||||
* @since 2.6.5
|
||||
*
|
||||
* @param string $content Content HTML to process.
|
||||
* @return string Verwerkte content met herschreven media-URLs.
|
||||
|
||||
Reference in New Issue
Block a user