line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormFu::Filter::HTMLScrubber; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
471
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
4
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
7
|
use Moose; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
8036
|
use MooseX::Attribute::FormFuChained; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
52
|
|
8
|
|
|
|
|
|
|
extends 'HTML::FormFu::Filter'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
8
|
use Clone (); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
128
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has allow => ( is => 'rw', traits => ['FormFuChained'] ); |
13
|
|
|
|
|
|
|
has comment => ( is => 'rw', traits => ['FormFuChained'] ); |
14
|
|
|
|
|
|
|
has default => ( is => 'rw', traits => ['FormFuChained'] ); |
15
|
|
|
|
|
|
|
has rules => ( is => 'rw', traits => ['FormFuChained'] ); |
16
|
|
|
|
|
|
|
has script => ( is => 'rw', traits => ['FormFuChained'] ); |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
903
|
use HTML::Scrubber; |
|
2
|
|
|
|
|
12101
|
|
|
2
|
|
|
|
|
275
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub filter { |
21
|
3
|
|
|
3
|
0
|
3
|
my ( $self, $value ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
3
|
50
|
|
|
|
7
|
return if !defined $value; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
4
|
my %params = ( allow => 0 ); |
26
|
3
|
|
|
|
|
6
|
foreach (qw(allow comment default rules script)) { |
27
|
15
|
|
|
|
|
358
|
my $val = $self->$_; |
28
|
15
|
100
|
|
|
|
22
|
$params{$_} = $val if ( defined($val) ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
13
|
my $scrubber = HTML::Scrubber->new(%params); |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
277
|
return $scrubber->scrub($value); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub clone { |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $clone = $self->SUPER::clone(@_); |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
$clone->allow( Clone::clone $self->allow ) |
42
|
|
|
|
|
|
|
if ref $self->allow; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $clone; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
HTML::FormFu::Filter::HTMLScrubber - filter removing HTML markup |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
version 2.05 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Remove HTML markup using L<HTML::Scrubber>. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
All the functionality of L<HTML::Scrubber> can be accessed using |
66
|
|
|
|
|
|
|
this module, other than the C<process> directive (which has a name |
67
|
|
|
|
|
|
|
clash with the L<HTML::FormFu::Filter> framework). |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
For details of the filtering functionality see |
70
|
|
|
|
|
|
|
L<HTML::Scrubber/allow>, L<HTML::Scrubber/comment>, |
71
|
|
|
|
|
|
|
L<HTML::Scrubber/default>, L<HTML::Scrubber/rules> and |
72
|
|
|
|
|
|
|
L<HTML::Scrubber/script> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Extended by Nigel Metheringham, C<nigelm@cpan.org> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Based on the original source code of L<HTML::Widget::Filter::HTMLStrip>, by |
81
|
|
|
|
|
|
|
Lyo Kato, C<lyo.kato@gmail.com> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
86
|
|
|
|
|
|
|
the same terms as Perl itself. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |