From 170af7327a12e84422110d93240223e75b16015b Mon Sep 17 00:00:00 2001 From: gtbu Date: Wed, 2 Apr 2025 18:32:40 +0200 Subject: [PATCH] Update Layout.php and Editing.php --- include/admin/Layout.php | 18 +++++++++--------- include/tool/Editing.php | 37 +++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/include/admin/Layout.php b/include/admin/Layout.php index 45887e6..4b84489 100644 --- a/include/admin/Layout.php +++ b/include/admin/Layout.php @@ -1979,17 +1979,17 @@ class Layout extends \gp\admin\Addon\Install{ return $theme; } + public function TitlesCount($layout) { + $titles_count = 0; - public function TitlesCount($layout){ - $titles_count = 0; - foreach($this->LayoutArray as $layout_comparison){ - if( $layout == $layout_comparison ){ - $titles_count++; - } - } - return $titles_count; - } + foreach ($this->LayoutArray ?? [] as $layout_comparison) { + if ($layout == $layout_comparison) { + $titles_count++; + } + } + return $titles_count; + } /** * Restore a layout to it's default content arrangement diff --git a/include/tool/Editing.php b/include/tool/Editing.php index 794ac87..878c52c 100644 --- a/include/tool/Editing.php +++ b/include/tool/Editing.php @@ -1000,22 +1000,31 @@ namespace gp\tool{ echo ''; + // Get and escape captions + $caption = isset($_POST['captions'][$i]) ? $_POST['captions'][$i] : ''; + \gp\tool\Files::cleanText($caption); // Assuming this cleans text correctly + $caption = htmlspecialchars($caption, ENT_QUOTES, 'UTF-8'); + + // Sanitize the alt text + $img_alt = htmlspecialchars(str_replace('_', ' ', basename(pathinfo($image, PATHINFO_FILENAME))), ENT_QUOTES, 'UTF-8'); + + echo '
  • '; + echo ''; + echo '' . $img_alt . ''; + echo '' . $caption . ''; + echo ''; + echo '
  • '; + } + + echo ''; $section['content'] = ob_get_clean(); $section['images'] = $_POST['images'];