From 2884972c8e355f551b3dff8cf11083e1febaa98b Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Tue, 6 Feb 2024 21:32:34 +0100 Subject: [PATCH] fix Cannot redeclare htmlEncode() --- fragments/FAQPage.json-ld.php | 23 +++++------------------ fragments/qanda.json-ld.php | 23 +++++------------------ lib/qanda.php | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/fragments/FAQPage.json-ld.php b/fragments/FAQPage.json-ld.php index 6fde917..ca927a1 100644 --- a/fragments/FAQPage.json-ld.php +++ b/fragments/FAQPage.json-ld.php @@ -1,18 +1,5 @@ 'Person', - 'name' => json_encode($question->getAuthor(), $GLOBALS['jsonOptions']), - ]; -} ?> diff --git a/lib/qanda.php b/lib/qanda.php index db25514..6a5a013 100644 --- a/lib/qanda.php +++ b/lib/qanda.php @@ -204,4 +204,23 @@ public static function showFAQPage(array|rex_yform_manager_collection $questions $fragment->setVar('questions', $questions); return $fragment->parse('FAQPage.json-ld.php'); } + + + /* Hilfsklasse für JSON-LD Fragmente */ + public static function htmlEncode($value) + { + return htmlentities($value, ENT_QUOTES, 'UTF-8'); + } + + /* Hilfsklasse für JSON-LD Fragmente */ + public static function getJsonAuthor($question) + { + return [ + '@type' => 'Person', + 'name' => json_encode($question->getAuthor(), $GLOBALS['jsonOptions']), + ]; + } + + + }