mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
Corrected internal parser conflict when code/pre tags contained curly brackets.
This commit is contained in:
@@ -5372,12 +5372,12 @@ return;
|
||||
$html = str_replace('>','>',$html);
|
||||
}
|
||||
|
||||
$html = str_replace(' ', '{E_PARSER_CLEAN_HTML_NON_BREAKING_SPACE}', $html); // prevent replacement of with spaces.
|
||||
$html = str_replace(' ', '__E_PARSER_CLEAN_HTML_NON_BREAKING_SPACE__', $html); // prevent replacement of with spaces.
|
||||
// Workaround for https://bugs.php.net/bug.php?id=76285
|
||||
// Part 1 of 2
|
||||
$html = str_replace("\n", "{E_PARSER_CLEAN_HTML_LINE_BREAK}", $html);
|
||||
|
||||
|
||||
$html = str_replace("\n", "__E_PARSER_CLEAN_HTML_LINE_BREAK__", $html);
|
||||
$html = str_replace("{", "__E_PARSER_CLEAN_HTML_CURLY_OPEN__", $html);
|
||||
$html = str_replace("}", "__E_PARSER_CLEAN_HTML_CURLY_CLOSED__", $html);
|
||||
|
||||
|
||||
if(strpos($html, "<body")===false) // HTML Fragment
|
||||
@@ -5529,16 +5529,16 @@ return;
|
||||
$value = str_replace('<br></br>', PHP_EOL, $value);
|
||||
|
||||
}
|
||||
|
||||
if($node->nodeName === 'code')
|
||||
elseif($node->nodeName === 'code')
|
||||
{
|
||||
$value = preg_replace('/^<code[^>]*>/', '', $value);
|
||||
$value = str_replace("</code>", "", $value);
|
||||
$value = str_replace("<br></br>", PHP_EOL, $value);
|
||||
}
|
||||
|
||||
$value = str_replace('{', '{{{', $value); // temporarily change {e_XXX} to {{{e_XXX}}}
|
||||
$value = str_replace('}', '}}}', $value); // temporarily change {e_XXX} to {{{e_XXX}}}
|
||||
$value = str_replace('__E_PARSER_CLEAN_HTML_CURLY_OPEN__', '{{{', $value); // temporarily change {e_XXX} to {{{e_XXX}}}
|
||||
$value = str_replace('__E_PARSER_CLEAN_HTML_CURLY_CLOSED__', '}}}', $value); // temporarily change {e_XXX} to {{{e_XXX}}}
|
||||
|
||||
|
||||
$newNode = $doc->createElement($node->nodeName);
|
||||
$newNode->nodeValue = $value;
|
||||
@@ -5591,13 +5591,16 @@ return;
|
||||
// Workaround for https://bugs.php.net/bug.php?id=76285
|
||||
// Part 2 of 2
|
||||
$cleaned = str_replace("\n", "", $cleaned);
|
||||
$cleaned = str_replace("{E_PARSER_CLEAN_HTML_LINE_BREAK}", "\n", $cleaned);
|
||||
$cleaned = str_replace("__E_PARSER_CLEAN_HTML_LINE_BREAK__", "\n", $cleaned);
|
||||
|
||||
$cleaned = str_replace('{E_PARSER_CLEAN_HTML_NON_BREAKING_SPACE}', ' ', $cleaned); // prevent replacement of with spaces. - convert back.
|
||||
$cleaned = str_replace('__E_PARSER_CLEAN_HTML_NON_BREAKING_SPACE__', ' ', $cleaned); // prevent replacement of with spaces. - convert back.
|
||||
|
||||
$cleaned = str_replace('{{{','{', $cleaned); // convert shortcode temporary triple-curly braces back to entities.
|
||||
$cleaned = str_replace('}}}','}', $cleaned); // convert shortcode temporary triple-curly braces back to entities.
|
||||
|
||||
$cleaned = str_replace("__E_PARSER_CLEAN_HTML_CURLY_OPEN__","{", $cleaned);
|
||||
$cleaned = str_replace("__E_PARSER_CLEAN_HTML_CURLY_CLOSED__","}", $cleaned);
|
||||
|
||||
$cleaned = str_replace(array('<body>','</body>'),'', $cleaned); // filter out tags.
|
||||
|
||||
return trim($cleaned);
|
||||
|
Reference in New Issue
Block a user