line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: ENT.pm 284 2006-12-01 07:51:49Z chronos $ |
2
|
|
|
|
|
|
|
package BBCode::Tag::ENT; |
3
|
1
|
|
|
1
|
|
7
|
use base qw(BBCode::Tag); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
155
|
|
4
|
1
|
|
|
1
|
|
7
|
use BBCode::Util qw(:parse decodeHTML); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
257
|
|
5
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
398
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.34'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub Class($):method { |
10
|
2
|
|
|
2
|
1
|
7
|
return qw(TEXT INLINE); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub NamedParams($):method { |
14
|
2
|
|
|
2
|
1
|
6
|
return qw(VAL); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub DefaultParam($):method { |
18
|
2
|
|
|
2
|
1
|
6
|
return 'VAL'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub validateParam($$$):method { |
22
|
1
|
|
|
1
|
1
|
3
|
my($this,$param,$val) = @_; |
23
|
1
|
50
|
|
|
|
5
|
if($param eq 'VAL') { |
24
|
1
|
|
|
|
|
4
|
my $ent = parseEntity($val); |
25
|
1
|
50
|
|
|
|
3
|
if(defined $ent) { |
26
|
1
|
|
|
|
|
5
|
return $ent; |
27
|
|
|
|
|
|
|
} else { |
28
|
0
|
|
|
|
|
0
|
die qq(Invalid value "$val" for [ENT]); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
0
|
return $this->SUPER::validateParam($param,$val); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub toHTML($):method { |
35
|
1
|
|
|
1
|
1
|
3
|
my $this = shift; |
36
|
1
|
|
|
|
|
6
|
my $ent = $this->param('VAL'); |
37
|
1
|
50
|
|
|
|
11
|
return "&$ent;" if defined $ent; |
38
|
0
|
|
|
|
|
|
return ""; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub toText($):method { |
42
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
43
|
0
|
|
|
|
|
|
my $ent = $this->param('VAL'); |
44
|
0
|
0
|
|
|
|
|
return decodeHTML("&$ent;") if defined $ent; |
45
|
0
|
|
|
|
|
|
return ""; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |