| @@ 668-704 (lines=37) @@ | ||
| 665 | * |
|
| 666 | * @return string |
|
| 667 | */ |
|
| 668 | public static function putReplacedBackToPreserveHtmlEntities(string $html): string |
|
| 669 | { |
|
| 670 | static $DOM_REPLACE__HELPER_CACHE = null; |
|
| 671 | ||
| 672 | if ($DOM_REPLACE__HELPER_CACHE === null) { |
|
| 673 | $DOM_REPLACE__HELPER_CACHE['tmp'] = \array_merge( |
|
| 674 | self::$domLinkReplaceHelper['tmp'], |
|
| 675 | self::$domReplaceHelper['tmp'] |
|
| 676 | ); |
|
| 677 | $DOM_REPLACE__HELPER_CACHE['orig'] = \array_merge( |
|
| 678 | self::$domLinkReplaceHelper['orig'], |
|
| 679 | self::$domReplaceHelper['orig'] |
|
| 680 | ); |
|
| 681 | ||
| 682 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>'; |
|
| 683 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>'; |
|
| 684 | ||
| 685 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = ''; |
|
| 686 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = ''; |
|
| 687 | ||
| 688 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper; |
|
| 689 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
| 690 | ||
| 691 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script'; |
|
| 692 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>'; |
|
| 693 | } |
|
| 694 | ||
| 695 | if ( |
|
| 696 | isset(self::$domBrokenReplaceHelper['tmp']) |
|
| 697 | && |
|
| 698 | \count(self::$domBrokenReplaceHelper['tmp']) > 0 |
|
| 699 | ) { |
|
| 700 | $html = \str_replace(self::$domBrokenReplaceHelper['tmp'], self::$domBrokenReplaceHelper['orig'], $html); |
|
| 701 | } |
|
| 702 | ||
| 703 | return \str_replace($DOM_REPLACE__HELPER_CACHE['tmp'], $DOM_REPLACE__HELPER_CACHE['orig'], $html); |
|
| 704 | } |
|
| 705 | ||
| 706 | /** |
|
| 707 | * @param string $html |
|
| @@ 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 |
|