From 30b85b2257682ce5e54429eeff4f13b47590b6a1 Mon Sep 17 00:00:00 2001 From: luxick Date: Thu, 22 Jan 2026 21:35:36 +0100 Subject: [PATCH] Fix settings page textarea displays --- admin/main.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/admin/main.php b/admin/main.php index 049e5a8..000b741 100644 --- a/admin/main.php +++ b/admin/main.php @@ -111,13 +111,13 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin echo '' . hsc($this->getLang('legend')) . ''; // paths: multiline textarea - $paths = (string)$this->getConf('paths'); + $paths = $this->normalizeMultilineDisplay((string)$this->getConf('paths'), 'paths'); echo '
'; // scratchpad_paths: multiline textarea - $scratchpadPaths = (string)$this->getConf('scratchpad_paths'); + $scratchpadPaths = $this->normalizeMultilineDisplay((string)$this->getConf('scratchpad_paths'), 'scratchpad_paths'); echo '
'; @@ -338,4 +338,24 @@ class admin_plugin_luxtools_main extends DokuWiki_Admin_Plugin return var_export($value, true); } + + /** + * Strip nowdoc markers from values when displaying in the admin form. + * + * @param string $value + * @param string $key + * @return string + */ + protected function normalizeMultilineDisplay(string $value, string $key): string + { + $marker = strtoupper('LUXTOOLS_' . preg_replace('/[^A-Z0-9_]/i', '_', $key) . '_EOT'); + $prefix = "<<<'$marker'\n"; + $suffix = "\n$marker"; + + if (str_starts_with($value, $prefix) && str_ends_with($value, $suffix)) { + return substr($value, strlen($prefix), -strlen($suffix)); + } + + return $value; + } }