1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-06 06:07:31 +02:00

V2.12.0 fix shortcode if not allowed in parsedownExtension

This commit is contained in:
trendschau
2024-12-04 22:58:51 +01:00
parent 031c75b530
commit 1d57194f7f

View File

@@ -768,7 +768,14 @@ class ParsedownExtension extends \ParsedownExtra
{
if(is_array($this->allowedShortcodes) && empty($this->allowedShortcodes))
{
return array('element' => array());
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.
);
}
$shortcodeString = substr($matches[0], 2, -2);
@@ -780,7 +787,14 @@ class ParsedownExtension extends \ParsedownExtra
if(is_array($this->allowedShortcodes) && !in_array($shortcode['name'], $this->allowedShortcodes))
{
return array('element' => array());
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.
);
}
$params = $this->shortcodeParams($shortcodeArray);
@@ -829,7 +843,13 @@ class ParsedownExtension extends \ParsedownExtra
{
if(is_array($this->allowedShortcodes) && empty($this->allowedShortcodes))
{
return array('element' => array());
return array(
'element' => array(
'rawHtml' => htmlspecialchars($matches[0]), // Escape the entire shortcode
'allowRawHtmlInSafeMode' => true,
),
'extent' => strlen($matches[0]), // Consume the full shortcode
);
}
$shortcodeString = substr($matches[0], 2, -2);
@@ -841,7 +861,13 @@ class ParsedownExtension extends \ParsedownExtra
if(is_array($this->allowedShortcodes) && !in_array($shortcode['name'], $this->allowedShortcodes))
{
return array('element' => array());
return array(
'element' => array(
'rawHtml' => htmlspecialchars($matches[0]), // Escape the entire shortcode
'allowRawHtmlInSafeMode' => true,
),
'extent' => strlen($matches[0]), // Consume the full shortcode
);
}
$params = $this->shortcodeParams($shortcodeArray);