1use strict;
2
3package HTML::FormFu::Filter::HTMLEscape;
4$HTML::FormFu::Filter::HTMLEscape::VERSION = '2.07';
5# ABSTRACT: filter escaping HTML
6
7use Moose;
8extends 'HTML::FormFu::Filter';
9
10sub filter {
11    my ( $self, $value ) = @_;
12
13    return if !defined $value;
14
15    $value =~ s/&(?!(amp|lt|gt|quot);)/&/g;
16    $value =~ s/</&lt;/g;
17    $value =~ s/>/&gt;/g;
18    $value =~ s/"/&quot;/g;
19
20    return $value;
21}
22
23__PACKAGE__->meta->make_immutable;
24
251;
26
27__END__
28
29=pod
30
31=encoding UTF-8
32
33=head1 NAME
34
35HTML::FormFu::Filter::HTMLEscape - filter escaping HTML
36
37=head1 VERSION
38
39version 2.07
40
41=head1 DESCRIPTION
42
43HTML escaping filter.
44
45=head1 AUTHOR
46
47Carl Franks, C<cfranks@cpan.org>
48
49Based on the original source code of L<HTML::Widget::Filter::HTMLEscape>, by
50Lyo Kato, C<lyo.kato@gmail.com>
51
52=head1 LICENSE
53
54This library is free software, you can redistribute it and/or modify it under
55the same terms as Perl itself.
56
57=head1 AUTHOR
58
59Carl Franks <cpan@fireartist.com>
60
61=head1 COPYRIGHT AND LICENSE
62
63This software is copyright (c) 2018 by Carl Franks.
64
65This is free software; you can redistribute it and/or modify it under
66the same terms as the Perl 5 programming language system itself.
67
68=cut
69