Edwin Noorlander 60276cdccd Fix security vulnerabilities, remove dead code, and improve code quality
- Fix path traversal with realpath() validation in getPage() and executePhpFile()
- Remove insecure JWT secret fallback, require JWT_SECRET env var
- Fix IP spoofing by only trusting proxy headers from configured proxies
- Add Secure/HttpOnly/SameSite flags to all cookies
- Use env var for debug mode instead of hardcoded true
- Fix operator precedence bug in MQTTTracker track_user_flows check
- Remove dead code: duplicate is_dir() block, unused scanForPageNames()
- Remove htmlspecialchars() from filesystem path operations
- Remove duplicate require_once calls and redundant autoloader includes
- Fix unclosed </div> in getDirectoryListing()
- Escape breadcrumb titles and add lang param to search result URLs
- Make language prefixes dynamic from config instead of hardcoded nl|en
- Make HTML lang attribute dynamic, add go_to translation key
- Add aria-label/aria-expanded to sidebar toggle for accessibility
- Fix event listener leak in app.js using event delegation
- Remove console.log from production code
- Update guides (NL/EN) with sidebar toggle documentation
- Add TODO.md documenting all identified improvements
2026-02-16 15:05:27 +01:00
..

CodePress CMS Plugins

Deze map bevat plugins voor de CodePress CMS. Elke plugin heeft zijn eigen submap met de plugin code.

Plugin Structuur

Elke plugin map moet het volgende bevatten:

PluginName/
├── PluginName.php          # Hoofd plugin bestand
├── README.md              # Plugin documentatie (optioneel)
├── config.json           # Plugin configuratie (optioneel)
└── assets/               # CSS, JS, images (optioneel)
    ├── css/
    ├── js/
    └── images/

Beschikbare Plugins

HTMLBlock

Toont een custom HTML blok in de sidebar met pagina-informatie en navigatie.

Locatie: HTMLBlock/HTMLBlock.php

Functies:

  • Toont huidige pagina informatie
  • Dynamische navigatie
  • Bestandsinformatie
  • Interactive controls

Plugin Development

Basis Plugin Class

<?php

class MyPlugin
{
    private ?CMSAPI $api = null;
    
    public function setAPI(CMSAPI $api): void
    {
        $this->api = $api;
    }
    
    public function getSidebarContent(): string
    {
        return '<div>Mijn plugin content</div>';
    }
}

Beschikbare API Methodes

  • getCurrentPage() - Huidige pagina data
  • getCurrentPageTitle() - Huidige pagina titel
  • getMenu() - Menu structuur
  • getConfig($key) - Configuratie waardes
  • translate($key) - Vertalingen
  • getCurrentLanguage() - Huidige taal
  • isHomepage() - Check of homepage
  • getCurrentPageFileInfo() - Bestandsinformatie
  • createUrl($page, $lang) - URL generatie

Plugin Hooks

Plugins kunnen de volgende methodes implementeren:

  • getSidebarContent() - Content voor sidebar
  • setAPI(CMSAPI $api) - API injectie

Configuratie

Plugins kunnen een config.json bestand hebben:

{
    "enabled": true,
    "settings": {
        "option1": "value1",
        "option2": "value2"
    }
}

Installatie

  1. Maak een nieuwe map in plugins/
  2. Plaats de plugin class in PluginName/PluginName.php
  3. Optioneel: voeg README.md en config.json toe
  4. De plugin wordt automatisch geladen door de CMS

Best Practices

  • Gebruik htmlspecialchars() voor output
  • Implementeer setAPI() voor CMS toegang
  • Volg PSR-12 coding standards
  • Gebruik namespace indien nodig
  • Documenteer je plugin met README.md