| @@ 390-426 (lines=37) @@ | ||
| 387 | * |
|
| 388 | * @return string |
|
| 389 | */ |
|
| 390 | public static function putReplacedBackToPreserveHtmlEntities(string $html): string |
|
| 391 | { |
|
| 392 | static $DOM_REPLACE__HELPER_CACHE = null; |
|
| 393 | ||
| 394 | if ($DOM_REPLACE__HELPER_CACHE === null) { |
|
| 395 | $DOM_REPLACE__HELPER_CACHE['tmp'] = \array_merge( |
|
| 396 | self::$domLinkReplaceHelper['tmp'], |
|
| 397 | self::$domReplaceHelper['tmp'] |
|
| 398 | ); |
|
| 399 | $DOM_REPLACE__HELPER_CACHE['orig'] = \array_merge( |
|
| 400 | self::$domLinkReplaceHelper['orig'], |
|
| 401 | self::$domReplaceHelper['orig'] |
|
| 402 | ); |
|
| 403 | ||
| 404 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>'; |
|
| 405 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>'; |
|
| 406 | ||
| 407 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = ''; |
|
| 408 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = ''; |
|
| 409 | ||
| 410 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper; |
|
| 411 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
| 412 | ||
| 413 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script'; |
|
| 414 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>'; |
|
| 415 | } |
|
| 416 | ||
| 417 | if ( |
|
| 418 | isset(self::$domBrokenReplaceHelper['tmp']) |
|
| 419 | && |
|
| 420 | \count(self::$domBrokenReplaceHelper['tmp']) > 0 |
|
| 421 | ) { |
|
| 422 | $html = \str_replace(self::$domBrokenReplaceHelper['tmp'], self::$domBrokenReplaceHelper['orig'], $html); |
|
| 423 | } |
|
| 424 | ||
| 425 | return \str_replace($DOM_REPLACE__HELPER_CACHE['tmp'], $DOM_REPLACE__HELPER_CACHE['orig'], $html); |
|
| 426 | } |
|
| 427 | ||
| 428 | /** |
|
| 429 | * @param string $html |
|
| @@ 662-698 (lines=37) @@ | ||
| 659 | * |
|
| 660 | * @return string |
|
| 661 | */ |
|
| 662 | public static function putReplacedBackToPreserveHtmlEntities(string $html): string |
|
| 663 | { |
|
| 664 | static $DOM_REPLACE__HELPER_CACHE = null; |
|
| 665 | ||
| 666 | if ($DOM_REPLACE__HELPER_CACHE === null) { |
|
| 667 | $DOM_REPLACE__HELPER_CACHE['tmp'] = \array_merge( |
|
| 668 | self::$domLinkReplaceHelper['tmp'], |
|
| 669 | self::$domReplaceHelper['tmp'] |
|
| 670 | ); |
|
| 671 | $DOM_REPLACE__HELPER_CACHE['orig'] = \array_merge( |
|
| 672 | self::$domLinkReplaceHelper['orig'], |
|
| 673 | self::$domReplaceHelper['orig'] |
|
| 674 | ); |
|
| 675 | ||
| 676 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>'; |
|
| 677 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>'; |
|
| 678 | ||
| 679 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = ''; |
|
| 680 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = ''; |
|
| 681 | ||
| 682 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper; |
|
| 683 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
| 684 | ||
| 685 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script'; |
|
| 686 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>'; |
|
| 687 | } |
|
| 688 | ||
| 689 | if ( |
|
| 690 | isset(self::$domBrokenReplaceHelper['tmp']) |
|
| 691 | && |
|
| 692 | \count(self::$domBrokenReplaceHelper['tmp']) > 0 |
|
| 693 | ) { |
|
| 694 | $html = \str_replace(self::$domBrokenReplaceHelper['tmp'], self::$domBrokenReplaceHelper['orig'], $html); |
|
| 695 | } |
|
| 696 | ||
| 697 | return \str_replace($DOM_REPLACE__HELPER_CACHE['tmp'], $DOM_REPLACE__HELPER_CACHE['orig'], $html); |
|
| 698 | } |
|
| 699 | ||
| 700 | /** |
|
| 701 | * @param string $html |
|