line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: COLOR.pm 284 2006-12-01 07:51:49Z chronos $ |
2
|
|
|
|
|
|
|
package BBCode::Tag::COLOR; |
3
|
2
|
|
|
2
|
|
13
|
use base qw(BBCode::Tag::Inline); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
214
|
|
4
|
2
|
|
|
2
|
|
10
|
use BBCode::Util qw(:parse encodeHTML); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
484
|
|
5
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
85
|
|
6
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
684
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.34'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub BodyPermitted($):method { |
10
|
4
|
|
|
4
|
1
|
17
|
return 1; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub NamedParams($):method { |
14
|
2
|
|
|
2
|
1
|
7
|
return qw(VAL); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub DefaultParam($):method { |
18
|
2
|
|
|
2
|
1
|
8
|
return 'VAL'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub validateParam($$$):method { |
22
|
2
|
|
|
2
|
1
|
5
|
my($this,$param,$val) = @_; |
23
|
|
|
|
|
|
|
|
24
|
2
|
50
|
|
|
|
7
|
if($param eq 'VAL') { |
25
|
2
|
|
|
|
|
10
|
my $color = parseColor($val); |
26
|
2
|
100
|
|
|
|
7
|
if(defined $color) { |
27
|
1
|
|
|
|
|
6
|
return $color; |
28
|
|
|
|
|
|
|
} else { |
29
|
1
|
|
|
|
|
30
|
die qq(Invalid value "$val" for [COLOR]); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
|
|
|
0
|
return $this->SUPER::validateParam($param,$val); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub replace($):method { |
36
|
1
|
|
|
1
|
0
|
2
|
my $this = shift; |
37
|
1
|
|
|
|
|
8
|
my $that = BBCode::Tag->new($this->parser, 'FONT', [ 'COLOR', $this->param('VAL') ]); |
38
|
1
|
|
|
|
|
3
|
@{$that->body} = @{$this->body}; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
39
|
1
|
|
|
|
|
4
|
return $that; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |