From 40cc6b8c662a370e341ed8e0c0de804dd7ca889c Mon Sep 17 00:00:00 2001 From: Andy Dixon <7983876+andydixon@users.noreply.github.com> Date: Thu, 9 Oct 2025 17:19:55 +0100 Subject: [PATCH] Fix issue with namespaces for DOM --- cms/src/NeoCMS/CMSController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cms/src/NeoCMS/CMSController.php b/cms/src/NeoCMS/CMSController.php index 4d744fb..50ea976 100644 --- a/cms/src/NeoCMS/CMSController.php +++ b/cms/src/NeoCMS/CMSController.php @@ -295,14 +295,18 @@ class CMSController // Load the HTML content from the file $htmlContent = file_get_contents($filePath); + if ($htmlContent === false) { + $htmlContent = file_get_contents($this->documentRoot . ltrim($filePath, '/')); + } + // Initialize a new DOMDocument object - $dom = new DOMDocument(); + $dom = new \DOMDocument(); // Suppress warnings that might occur due to malformed HTML @$dom->loadHTML($htmlContent); // Find all elements with the class "editable" - $xpath = new DOMXPath($dom); + $xpath = new \DOMXPath($dom); $editableElements = $xpath->query('//*[contains(@class, "editable")]'); // Return true if there are any elements with the "editable" class