mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Refactor based on suggestion by @PhrozenByte
This commit is contained in:
parent
624a08b7eb
commit
88dc949890
@ -1500,21 +1500,8 @@ class Parsedown
|
|||||||
{
|
{
|
||||||
$text = $Element['rawHtml'];
|
$text = $Element['rawHtml'];
|
||||||
|
|
||||||
$allowRawHtmlInSafeMode = false;
|
$allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
|
||||||
|
$permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
|
||||||
if (isset($Element['allowRawHtmlInSafeMode']))
|
|
||||||
{
|
|
||||||
$allowRawHtmlInSafeMode = (true === $Element['allowRawHtmlInSafeMode']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->safeMode !== true)
|
|
||||||
{
|
|
||||||
$permitRawHtml = true;
|
|
||||||
}
|
|
||||||
elseif ($this->safeMode and $allowRawHtmlInSafeMode)
|
|
||||||
{
|
|
||||||
$permitRawHtml = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($text))
|
if (isset($text))
|
||||||
@ -1530,7 +1517,7 @@ class Parsedown
|
|||||||
{
|
{
|
||||||
$markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
|
$markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
|
||||||
}
|
}
|
||||||
elseif ($permitRawHtml !== true)
|
elseif (!$permitRawHtml)
|
||||||
{
|
{
|
||||||
$markup .= self::escape($text, true);
|
$markup .= self::escape($text, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user