# CMS Architectuur CodePress is een file-based CMS zonder database. Content, configuratie en gebruikers worden opgeslagen in bestanden. ## Mappenstructuur ``` codepress/ ├── cms/ # Core CMS engine │ ├── core/ │ │ ├── class/ │ │ │ ├── CodePressCMS.php # Hoofd CMS class (routing, rendering, breadcrumb) │ │ │ ├── ThemeManager.php # Thema-resolver + Twig render + SCSS compile │ │ │ ├── ContentAPI.php # Read-only API voor PHP content │ │ │ ├── ContentSecurityPolicy.php # CSP header management │ │ │ ├── Analytics.php # Bezoekersstatistieken │ │ │ ├── BotGuard.php # Bot/AI detectie │ │ │ ├── Cache.php # Cache systeem │ │ │ ├── GeoIP.php # GeoIP lookup (land, vlag) │ │ │ ├── Logger.php # Basis logging │ │ │ ├── LogManager.php # Dynamisch logging (SQLite/syslog) │ │ │ ├── RateLimiter.php # Rate limiting per IP │ │ │ ├── RequestLogger.php # Request logging + visitor info │ │ │ ├── SearchEngine.php # Volledige tekst zoekfunctie │ │ │ └── AccessibilityManager.php # Accessibility features │ │ ├── plugin/ │ │ │ ├── PluginManager.php # Plugin loader (hooks, filters, sidebar, admin routes) │ │ │ └── CMSAPI.php # API voor plugins (getPage, getConfig, etc.) │ │ ├── config.php # Config loader (leest config.json) │ │ └── index.php # Bootstrap (autoloader, requires) │ ├── lang/ # Taalbestanden (nl.php, en.php) │ └── router.php # PHP dev server router ├── themes/ # Dynamische thema's │ └── default/ # Standaard thema (views + assets) │ ├── theme.json # { title, config.default_template, template: layout→.twig } │ ├── base.twig # Hoofd layout │ ├── *.twig # Layout templates │ ├── partials/ # header.twig, navigation.twig, footer.twig │ └── assets/ │ ├── scss/theme.scss # SCSS bron (enige CSS bron) │ ├── css_compiled/ # Gegenereerd door scssphp (read-only) │ ├── css/ # Externe CSS (bootstrap.min.css, etc.) │ ├── js/ # JavaScript │ └── img/ # Afbeeldingen ├── admin/ # Admin paneel │ ├── config/ │ │ ├── app.php # Admin app configuratie │ │ └── admin.json # Gebruikers & security (file-based, .gitignore'd) │ ├── src/ │ │ └── AdminAuth.php # Authenticatie + RBAC │ ├── theme/default/ # Admin thema (views + assets) │ │ ├── theme.json │ │ ├── assets/ # CSS, JS, CodeMirror, fonts │ │ └── views/ # login.twig, layouts/, pages/ │ └── storage/ # Logs, cache, geoip ├── plugins/ # CMS plugins │ ├── Navigation/ # Essentiële navigatie plugin (beschermd) │ │ ├── Navigation.php # Plugin code (NIET plugin.php) │ │ ├── plugin.json # Metadata met type veld │ │ └── assets/ # SCSS + CSS │ └── HTMLBlock/ # Voorbeeld sidebar plugin ├── content/ # Website content (.md, .php, .html) — .gitignore'd ├── guide/ # Handleidingen (nl/en) ├── public/ # Web root │ ├── index.php # Website entry point │ ├── admin.php # Admin entry point + routing │ ├── asset.php # Asset server voor Apache (themes/, admin/assets/, plugins/) │ ├── .htaccess # Stuurt asset URLs door naar asset.php │ ├── favicon.ico │ └── robots.txt ├── var/ # Cache (twig) — .gitignore'd ├── config.json # Site configuratie — .gitignore'd ├── composer.json # PHP dependencies (CommonMark, Twig, scssphp) └── version.php # Versie informatie (2.5.2) ``` ## Principes - **Geen database** — Alles in bestanden (content in `content/`, gebruikers in `admin/config/admin.json`, config in `config.json`) - **File-based auth** — `AdminAuth` gebruikt bcrypt hashes in `admin.json`, sessies voor login - **Twig templating** — Themes gebruiken Twig; `ThemeManager` rendert via Twig - **SCSS compilatie** — `assets/scss/theme.scss` → `assets/css_compiled/theme.css` via scssphp (read-only output) - **Plugin systeem** — `PluginManager` laadt content en systeem plugins met hooks/filters - **Asset serving** — PHP dev router (`cms/router.php`) of Apache (`.htaccess` → `public/asset.php`)