mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Add API to unescape HTML entities
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -266,6 +266,27 @@ $tmp =~ s/=/=/g;
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
=head2 html_unescape(string)
|
||||
|
||||
Converts HTML entities to the corresponding character
|
||||
|
||||
=cut
|
||||
sub html_unescape
|
||||
{
|
||||
my ($str) = @_;
|
||||
if (!defined $str) {
|
||||
return ''; # empty string
|
||||
};
|
||||
$str =~ s/&/&/g;
|
||||
$str =~ s/</</g;
|
||||
$str =~ s/>/>/g;
|
||||
$str =~ s/"/"/g;
|
||||
$str =~ s/'/'/g;
|
||||
$str =~ s/=/=/g;
|
||||
$str =~ s/ / /g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
=head2 html_strip(string, replacement)
|
||||
|
||||
Removes any HTML from a string, replacing with nothing or given chars
|
||||
|
||||
Reference in New Issue
Block a user