From b92d192399d06c283faa69ad1d58ea0052543393 Mon Sep 17 00:00:00 2001 From: Edwin Noorlander Date: Sat, 22 Nov 2025 17:07:31 +0100 Subject: [PATCH] Fix formatDisplayName special cases for directory names - Restrict special case handling (phpinfo, ICT) to exact filenames only - Prevent special cases from overriding directory names like 'nl.test' - Directory names now use formatDisplayName() without special case overrides - This ensures 'nl.test' directory displays as 'Test' not 'Untitled' --- engine/core/class/CodePressCMS.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/engine/core/class/CodePressCMS.php b/engine/core/class/CodePressCMS.php index c6f3c3b..e4d6702 100644 --- a/engine/core/class/CodePressCMS.php +++ b/engine/core/class/CodePressCMS.php @@ -559,11 +559,12 @@ class CodePressCMS { // Remove file extensions (.md, .php, .html) from display names $filename = preg_replace('/\.(md|php|html)$/', '', $filename); - // Handle special cases first - if (strtolower($filename) === 'phpinfo') { + // Handle special cases first (only for exact filenames, not directories) + // These should only apply to actual files, not directory names + if (strtolower($filename) === 'phpinfo' && !preg_match('/\//', $filename)) { return 'phpinfo'; } - if (strtolower($filename) === 'ict') { + if (strtolower($filename) === 'ict' && !preg_match('/\//', $filename)) { return 'ICT'; } @@ -718,6 +719,9 @@ class CodePressCMS { // Get the directory name from the path, not from a potential file $pathParts = explode('/', $pagePath); $dirName = end($pathParts); + + // Get the directory name from path, not from a potential file + $title = $this->formatDisplayName($dirName) ?: 'Home'; $content = '

' . htmlspecialchars($title) . '

';