line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Filter::HTMLStrip; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
93323
|
use warnings; |
|
88
|
|
|
|
|
207
|
|
|
88
|
|
|
|
|
2947
|
|
4
|
88
|
|
|
88
|
|
492
|
use strict; |
|
88
|
|
|
|
|
300
|
|
|
88
|
|
|
|
|
2781
|
|
5
|
88
|
|
|
88
|
|
487
|
use base 'HTML::Widget::Filter'; |
|
88
|
|
|
|
|
232
|
|
|
88
|
|
|
|
|
7048
|
|
6
|
88
|
|
|
88
|
|
95740
|
use HTML::Scrubber; |
|
88
|
|
|
|
|
236370
|
|
|
88
|
|
|
|
|
6817
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/allow/); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
HTML::Widget::Filter::HTMLStrip - HTML Strip Filter |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $f = $widget->filter( 'HTMLStrip', 'foo' )->allow( 'br', 'a' ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
HTML Strip Filter. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 allow |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Accepts a list of HTML tags which shouldn't be stripped |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 filter |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub filter { |
33
|
2
|
|
|
2
|
1
|
3
|
my ( $self, $value ) = @_; |
34
|
2
|
|
50
|
|
|
6
|
my $allowed = $self->allow || []; |
35
|
2
|
|
|
|
|
22
|
my $scrubber = HTML::Scrubber->new( allow => $allowed ); |
36
|
2
|
|
|
|
|
221
|
return $scrubber->scrub($value); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 AUTHOR |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Lyo Kato, C |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 LICENSE |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
46
|
|
|
|
|
|
|
the same terms as Perl itself. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |