line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: EMAIL.pm 284 2006-12-01 07:51:49Z chronos $ |
2
|
|
|
|
|
|
|
package BBCode::Tag::EMAIL; |
3
|
3
|
|
|
3
|
|
20
|
use base qw(BBCode::Tag::URL); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
330
|
|
4
|
3
|
|
|
3
|
|
17
|
use BBCode::Util qw(:parse encodeHTML); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1000
|
|
5
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
163
|
|
6
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
989
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.34'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub validateParam($$$):method { |
10
|
2
|
|
|
2
|
1
|
5
|
my($this,$param,$val) = @_; |
11
|
|
|
|
|
|
|
|
12
|
2
|
50
|
|
|
|
9
|
if($param eq 'HREF') { |
13
|
2
|
|
|
|
|
9
|
my $url = parseMailURL($val); |
14
|
2
|
50
|
|
|
|
9
|
if(defined $url) { |
15
|
2
|
|
|
|
|
9
|
return $url->as_string; |
16
|
|
|
|
|
|
|
} else { |
17
|
0
|
|
|
|
|
0
|
die qq(Invalid value "$val" for [EMAIL]); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
0
|
|
|
|
|
0
|
return $this->SUPER::validateParam($param,$val); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub replace($):method { |
24
|
4
|
|
|
4
|
0
|
44
|
my $this = shift; |
25
|
4
|
|
|
|
|
14
|
my $href = $this->param('HREF'); |
26
|
4
|
50
|
|
|
|
12
|
if(not defined $href) { |
27
|
0
|
|
|
|
|
0
|
my $text = $this->bodyText; |
28
|
0
|
|
|
|
|
0
|
my $url = parseMailURL $text; |
29
|
0
|
0
|
|
|
|
0
|
if(not defined $url) { |
30
|
0
|
|
|
|
|
0
|
return BBCode::Tag->new($this->parser, 'TEXT', [ undef, $text ]); |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
|
|
|
0
|
$this->param(HREF => $url); |
33
|
|
|
|
|
|
|
} |
34
|
4
|
|
|
|
|
12
|
return $this; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |