| @@ 3907-3935 (lines=29) @@ | ||
| 3904 | * |
|
| 3905 | * @return string |
|
| 3906 | */ |
|
| 3907 | public static function rawurldecode(string $str, bool $multi_decode = true): string |
|
| 3908 | { |
|
| 3909 | if (!isset($str[0])) { |
|
| 3910 | return ''; |
|
| 3911 | } |
|
| 3912 | ||
| 3913 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
|
| 3914 | if (\preg_match($pattern, $str)) { |
|
| 3915 | $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 3916 | } |
|
| 3917 | ||
| 3918 | $flags = ENT_QUOTES | ENT_HTML5; |
|
| 3919 | ||
| 3920 | do { |
|
| 3921 | $str_compare = $str; |
|
| 3922 | ||
| 3923 | $str = self::fix_simple_utf8( |
|
| 3924 | \rawurldecode( |
|
| 3925 | self::html_entity_decode( |
|
| 3926 | self::to_utf8($str), |
|
| 3927 | $flags |
|
| 3928 | ) |
|
| 3929 | ) |
|
| 3930 | ); |
|
| 3931 | ||
| 3932 | } while ($multi_decode === true && $str_compare !== $str); |
|
| 3933 | ||
| 3934 | return $str; |
|
| 3935 | } |
|
| 3936 | ||
| 3937 | /** |
|
| 3938 | * @param array $strings |
|
| @@ 7731-7759 (lines=29) @@ | ||
| 7728 | * |
|
| 7729 | * @return string |
|
| 7730 | */ |
|
| 7731 | public static function urldecode(string $str, bool $multi_decode = true): string |
|
| 7732 | { |
|
| 7733 | if (!isset($str[0])) { |
|
| 7734 | return ''; |
|
| 7735 | } |
|
| 7736 | ||
| 7737 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
|
| 7738 | if (\preg_match($pattern, $str)) { |
|
| 7739 | $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 7740 | } |
|
| 7741 | ||
| 7742 | $flags = ENT_QUOTES | ENT_HTML5; |
|
| 7743 | ||
| 7744 | do { |
|
| 7745 | $str_compare = $str; |
|
| 7746 | ||
| 7747 | $str = self::fix_simple_utf8( |
|
| 7748 | \urldecode( |
|
| 7749 | self::html_entity_decode( |
|
| 7750 | self::to_utf8($str), |
|
| 7751 | $flags |
|
| 7752 | ) |
|
| 7753 | ) |
|
| 7754 | ); |
|
| 7755 | ||
| 7756 | } while ($multi_decode === true && $str_compare !== $str); |
|
| 7757 | ||
| 7758 | return $str; |
|
| 7759 | } |
|
| 7760 | ||
| 7761 | /** |
|
| 7762 | * Return a array with "urlencoded"-win1252 -> UTF-8 |
|