From 31c628d055e9b0044df283dca6a5a93a4a78d57c Mon Sep 17 00:00:00 2001 From: trendschau Date: Thu, 5 Dec 2024 21:37:22 +0100 Subject: [PATCH] v2.12.0 remove shortcode completely if disabled is active for ebooks --- .../Extensions/ParsedownExtension.php | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/system/typemill/Extensions/ParsedownExtension.php b/system/typemill/Extensions/ParsedownExtension.php index 5c7723d..083d8a6 100644 --- a/system/typemill/Extensions/ParsedownExtension.php +++ b/system/typemill/Extensions/ParsedownExtension.php @@ -769,12 +769,8 @@ class ParsedownExtension extends \ParsedownExtra if(is_array($this->allowedShortcodes) && empty($this->allowedShortcodes)) { return array( - 'element' => array( - 'rawHtml' => htmlspecialchars($matches[0]), // Escape the entire shortcode - 'allowRawHtmlInSafeMode' => true, - ), - 'extent' => strlen($matches[0]), // Consume the full shortcode - 'complete' => true, // Close the block at the end of the line. + 'element' => array(), // No element to render + 'extent' => strlen($matches[0]), // Consume the entire shortcode ); } @@ -788,12 +784,8 @@ class ParsedownExtension extends \ParsedownExtra if(is_array($this->allowedShortcodes) && !in_array($shortcode['name'], $this->allowedShortcodes)) { return array( - 'element' => array( - 'rawHtml' => htmlspecialchars($matches[0]), // Escape the entire shortcode - 'allowRawHtmlInSafeMode' => true, - ), - 'extent' => strlen($matches[0]), // Consume the full shortcode - 'complete' => true, // Close the block at the end of the line. + 'element' => array(), // No element to render + 'extent' => strlen($matches[0]), // Consume the entire shortcode ); } @@ -844,11 +836,8 @@ class ParsedownExtension extends \ParsedownExtra if(is_array($this->allowedShortcodes) && empty($this->allowedShortcodes)) { return array( - 'element' => array( - 'rawHtml' => htmlspecialchars($matches[0]), // Escape the entire shortcode - 'allowRawHtmlInSafeMode' => true, - ), - 'extent' => strlen($matches[0]), // Consume the full shortcode + 'element' => array(), // No element to render + 'extent' => strlen($matches[0]), // Consume the entire shortcode ); } @@ -862,11 +851,8 @@ class ParsedownExtension extends \ParsedownExtra if(is_array($this->allowedShortcodes) && !in_array($shortcode['name'], $this->allowedShortcodes)) { return array( - 'element' => array( - 'rawHtml' => htmlspecialchars($matches[0]), // Escape the entire shortcode - 'allowRawHtmlInSafeMode' => true, - ), - 'extent' => strlen($matches[0]), // Consume the full shortcode + 'element' => array(), // No element to render + 'extent' => strlen($matches[0]), // Consume the entire shortcode ); }