Index: t/filters/htmlscrubber.t =================================================================== --- t/filters/htmlscrubber.t (revision 1724) +++ t/filters/htmlscrubber.t (working copy) @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 6; use HTML::FormFu; @@ -9,6 +9,7 @@ $form->element('Text')->name('foo')->filter('HTMLScrubber'); $form->element('Text')->name('bar')->filter('HTMLScrubber')->allow( ['b'] ); +$form->element('Text')->name('fum')->filter('HTMLScrubber')->rules( '*' => 0, p => { '*' => 0 }, a => { href => 1, '*' => 0 } ); my $original_foo = "

message

"; my $filtered_foo = "message"; @@ -16,9 +17,13 @@ my $original_bar = "

message

"; my $filtered_bar = "message"; +my $original_fum = "

messagetext

"; +my $filtered_fum = "

messagetext

"; + $form->process( { foo => $original_foo, bar => $original_bar, + fum => $original_fum, } ); # foo is quoted @@ -29,3 +34,7 @@ is( $form->param('bar'), $filtered_bar, 'bar filtered' ); is( $form->params->{bar}, $filtered_bar, 'bar filtered' ); +# fum is filtered +is( $form->param('fum'), $filtered_fum, 'fum filtered' ); +is( $form->params->{fum}, $filtered_fum, 'fum filtered' ); + Index: lib/HTML/FormFu/Filter/HTMLScrubber.pm =================================================================== --- lib/HTML/FormFu/Filter/HTMLScrubber.pm (revision 1724) +++ lib/HTML/FormFu/Filter/HTMLScrubber.pm (working copy) @@ -7,7 +7,7 @@ use Clone (); -__PACKAGE__->mk_accessors(qw( allow )); +__PACKAGE__->mk_accessors(qw( allow comment default rules script )); use HTML::Scrubber; @@ -16,9 +16,13 @@ return if !defined $value; - my $allowed = $self->allow || []; + my %params = ( allow => 0 ); + foreach (qw(allow comment default rules script)) { + my $val = $self->$_; + $params{$_} = $val if ( defined($val) ); + } - my $scrubber = HTML::Scrubber->new( allow => $allowed ); + my $scrubber = HTML::Scrubber->new(%params); return $scrubber->scrub($value); } @@ -46,10 +50,21 @@ Remove HTML markup using L. +All the functionality of L can be accessed using +this module, other than the C directive (which has a name +clash with the L framework). + +For details of the filtering functionality see +L, L, +L, L and +L + =head1 AUTHOR Carl Franks, C +Extended by Nigel Metheringham, C + Based on the original source code of L, by Lyo Kato, C