| @@ 398-434 (lines=37) @@ | ||
| 395 | * |
|
| 396 | * @return string |
|
| 397 | */ |
|
| 398 | public static function putReplacedBackToPreserveHtmlEntities(string $html): string |
|
| 399 | { |
|
| 400 | static $DOM_REPLACE__HELPER_CACHE = null; |
|
| 401 | ||
| 402 | if ($DOM_REPLACE__HELPER_CACHE === null) { |
|
| 403 | $DOM_REPLACE__HELPER_CACHE['tmp'] = \array_merge( |
|
| 404 | self::$domLinkReplaceHelper['tmp'], |
|
| 405 | self::$domReplaceHelper['tmp'] |
|
| 406 | ); |
|
| 407 | $DOM_REPLACE__HELPER_CACHE['orig'] = \array_merge( |
|
| 408 | self::$domLinkReplaceHelper['orig'], |
|
| 409 | self::$domReplaceHelper['orig'] |
|
| 410 | ); |
|
| 411 | ||
| 412 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>'; |
|
| 413 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>'; |
|
| 414 | ||
| 415 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = ''; |
|
| 416 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = ''; |
|
| 417 | ||
| 418 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper; |
|
| 419 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
| 420 | ||
| 421 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script'; |
|
| 422 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>'; |
|
| 423 | } |
|
| 424 | ||
| 425 | if ( |
|
| 426 | isset(self::$domBrokenReplaceHelper['tmp']) |
|
| 427 | && |
|
| 428 | \count(self::$domBrokenReplaceHelper['tmp']) > 0 |
|
| 429 | ) { |
|
| 430 | $html = \str_replace(self::$domBrokenReplaceHelper['tmp'], self::$domBrokenReplaceHelper['orig'], $html); |
|
| 431 | } |
|
| 432 | ||
| 433 | return \str_replace($DOM_REPLACE__HELPER_CACHE['tmp'], $DOM_REPLACE__HELPER_CACHE['orig'], $html); |
|
| 434 | } |
|
| 435 | ||
| 436 | /** |
|
| 437 | * @param string $html |
|
| @@ 704-740 (lines=37) @@ | ||
| 701 | * |
|
| 702 | * @return string |
|
| 703 | */ |
|
| 704 | public static function putReplacedBackToPreserveHtmlEntities(string $html): string |
|
| 705 | { |
|
| 706 | static $DOM_REPLACE__HELPER_CACHE = null; |
|
| 707 | ||
| 708 | if ($DOM_REPLACE__HELPER_CACHE === null) { |
|
| 709 | $DOM_REPLACE__HELPER_CACHE['tmp'] = \array_merge( |
|
| 710 | self::$domLinkReplaceHelper['tmp'], |
|
| 711 | self::$domReplaceHelper['tmp'] |
|
| 712 | ); |
|
| 713 | $DOM_REPLACE__HELPER_CACHE['orig'] = \array_merge( |
|
| 714 | self::$domLinkReplaceHelper['orig'], |
|
| 715 | self::$domReplaceHelper['orig'] |
|
| 716 | ); |
|
| 717 | ||
| 718 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>'; |
|
| 719 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>'; |
|
| 720 | ||
| 721 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = ''; |
|
| 722 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = ''; |
|
| 723 | ||
| 724 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper; |
|
| 725 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
| 726 | ||
| 727 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script'; |
|
| 728 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>'; |
|
| 729 | } |
|
| 730 | ||
| 731 | if ( |
|
| 732 | isset(self::$domBrokenReplaceHelper['tmp']) |
|
| 733 | && |
|
| 734 | \count(self::$domBrokenReplaceHelper['tmp']) > 0 |
|
| 735 | ) { |
|
| 736 | $html = \str_replace(self::$domBrokenReplaceHelper['tmp'], self::$domBrokenReplaceHelper['orig'], $html); |
|
| 737 | } |
|
| 738 | ||
| 739 | return \str_replace($DOM_REPLACE__HELPER_CACHE['tmp'], $DOM_REPLACE__HELPER_CACHE['orig'], $html); |
|
| 740 | } |
|
| 741 | ||
| 742 | /** |
|
| 743 | * @param string $html |
|