WE_Frontend/Plugin/HtmlNum.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 92.5% 25 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« WE_Frontend/Indexer/htdig_common/nomatch.pl ↑ Summary WE/DB/ComplexUser.pm »
1 # -*- perl -*-
2  
3 #
4 # $Id: HtmlNum.pm,v 1.4 2005/02/03 00:06:29 eserte Exp $
5 # Author: Slaven Rezic
6 #
7 # Copyright (C) 2004 Slaven Rezic.
8 # This is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License, see the file COPYING.
10  
11 #
12 # Mail: slaven@rezic.de
13 # WWW: http://we-framework.sourceforge.net
14 #
15  
16 package WE_Frontend::Plugin::HtmlNum;
17 2 ▶use base qw(Template::Plugin::Filter);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 $VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
22  
23 2 ▶use HTML::Entities 1.27 (); # numeric entities
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =head1 NAME
26  
27 WE_Frontend::Plugin::HtmlNum - numeric html/xml entities
28  
29 =head1 SYNOPSIS
30  
31 # In the calling script (normally already done by WebEditor::OldController)
32 my $t = Template->new({PLUGIN_BASE => "WE_Frontend::Plugin"});
33  
34 # In the template
35 [% USE HtmlNum %]
36 [% FILTER html_num %]
37 ...
38 [% END %]
39 [% variable | html_num %]
40  
41 =head1 DESCRIPTION
42  
43 Like the html_entities filter, but use numeric entities instead. The
44 usage of this filter over the "html" or "html_entities" filters is
45 highly recommended to avoid all kind of utf-8 vs. 8 bit charset
46 problems.
47  
48 =cut
49  
50 2 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
51 2 my $self = shift;
52 2 $self->install_filter("html_num");
53 2 $self;
54 }
55  
56 4 ▶sub filter {
Subroutine filter: called CC=1 SCAR=0.0
Pod undocumented
57 4 my($self, $text) = @_;
58 4 return HTML::Entities::encode_entities_numeric($text);
59 }
60  
61 2 1;
62  
63 __END__
« WE_Frontend/Indexer/htdig_common/nomatch.pl ↑ Summary WE/DB/ComplexUser.pm »