2 # This file is part of Koha.
4 # Koha is free software; you can redistribute it and/or modify it under the
5 # terms of the GNU General Public License as published by the Free Software
6 # Foundation; either version 2 of the License, or (at your option) any later
9 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
15 # Suite 330, Boston, MA 02111-1307 USA
25 use vars qw($VERSION @ISA);
26 use vars qw(%scrubbertypes $scrubbertype);
30 # @ISA = qw(HTML::Scrubber);
35 default => {}, # place holder, default settings are below as fallbacks in call to constructor
36 tag => {}, # uses defaults
38 allow => [qw( br b i em big small strong )],
41 default => [ 1 =>{'*'=>1} ],
49 my $fakeself = shift; # not really OO, we return an HTML::Scrubber object.
50 my $type = (@_) ? shift : 'default';
51 exists $scrubbertypes{$type} or croak "New called with unrecognized type '$type'";
52 $debug and print STDERR "Building new Scrubber of type '$type'\n";
53 my $settings = $scrubbertypes{$type};
54 my $scrubber = HTML::Scrubber->new(
55 allow => exists $settings->{allow} ? $settings->{allow} : [],
56 rules => exists $settings->{rules} ? $settings->{rules} : [],
57 default => exists $settings->{default} ? $settings->{default} : [ 0 =>{'*'=>0} ],
58 comment => exists $settings->{comment} ? $settings->{comment} : 0,
70 Standardized wrapper with settings for building HTML::Scrubber tailored to various koha inputs.
71 More verbose debugging messages are sent in the presence of non-zero $ENV{"DEBUG"}.
73 The default is to scrub everything, leaving no markup at all. This is compatible with the expectations
78 =head3 TO DO: Add real perldoc