line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Filter::HTMLEscape; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
76007
|
use warnings; |
|
88
|
|
|
|
|
213
|
|
|
88
|
|
|
|
|
4168
|
|
4
|
88
|
|
|
88
|
|
499
|
use strict; |
|
88
|
|
|
|
|
196
|
|
|
88
|
|
|
|
|
3124
|
|
5
|
88
|
|
|
88
|
|
751
|
use base 'HTML::Widget::Filter'; |
|
88
|
|
|
|
|
184
|
|
|
88
|
|
|
|
|
21285
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
HTML::Widget::Filter::HTMLEscape - HTML Escaping Filter |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $f = $widget->filter( 'HTMLEscape', 'foo' ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
HTML Escaping Filter. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 filter |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub filter { |
26
|
1
|
|
|
1
|
1
|
9
|
my ( $self, $value ) = @_; |
27
|
1
|
50
|
|
|
|
4
|
return unless defined $value; |
28
|
1
|
|
|
|
|
4
|
$value =~ s/&(?!(amp|lt|gt|quot);)/&/g; |
29
|
1
|
|
|
|
|
5
|
$value =~ s/</g; |
30
|
1
|
|
|
|
|
4
|
$value =~ s/>/>/g; |
31
|
1
|
|
|
|
|
3
|
$value =~ s/\"/"/g; |
32
|
1
|
|
|
|
|
8
|
return $value; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 BUGS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
L now checks for, and refuses to escape already-escaped |
38
|
|
|
|
|
|
|
characters. This means that if you wish to double-escape characters, you must |
39
|
|
|
|
|
|
|
now do it yourself. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 AUTHOR |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Lyo Kato, C |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 LICENSE |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
48
|
|
|
|
|
|
|
the same terms as Perl itself. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |