line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::BBCode::StripScripts; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
95
|
use strict; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
591
|
|
4
|
17
|
|
|
17
|
|
18999
|
use URI; |
|
17
|
|
|
|
|
193073
|
|
|
17
|
|
|
|
|
709
|
|
5
|
17
|
|
|
17
|
|
186
|
use base qw(HTML::StripScripts::Parser); |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
20479
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %bbattrib; |
10
|
|
|
|
|
|
|
my %bbstyle; |
11
|
|
|
|
|
|
|
my %bbstyle_overrides = ( |
12
|
|
|
|
|
|
|
'text-decoration' => 'word', |
13
|
|
|
|
|
|
|
'font-style' => 'word', |
14
|
|
|
|
|
|
|
'font-weight' => 'word', |
15
|
|
|
|
|
|
|
'list-style-type' => 'word', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init_attrib_whitelist { |
20
|
24
|
100
|
|
24
|
1
|
4725
|
unless (%bbattrib) { |
21
|
17
|
|
|
|
|
45
|
%bbattrib = %{__PACKAGE__->SUPER::init_attrib_whitelist}; |
|
17
|
|
|
|
|
180
|
|
22
|
17
|
|
|
|
|
1076
|
$bbattrib{'h5'}{'class'} = 'word'; |
23
|
|
|
|
|
|
|
} |
24
|
24
|
|
|
|
|
117
|
return \%bbattrib; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init_style_whitelist { |
28
|
24
|
100
|
|
24
|
1
|
374
|
unless (%bbstyle) { |
29
|
17
|
|
|
|
|
34
|
%bbstyle = %{__PACKAGE__->SUPER::init_style_whitelist}; |
|
17
|
|
|
|
|
178
|
|
30
|
17
|
|
|
|
|
330
|
@bbstyle{keys %bbstyle_overrides} = values %bbstyle_overrides; |
31
|
|
|
|
|
|
|
} |
32
|
24
|
|
|
|
|
246
|
return \%bbstyle; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub validate_href_attribute { |
36
|
16
|
|
|
16
|
1
|
2573
|
my ($self, $text) = @_; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Encode URLs if needed (as per bug 31927) |
39
|
16
|
|
|
|
|
131
|
my $uri = URI->new($text); |
40
|
16
|
|
|
|
|
77461
|
my $query = $uri->query; |
41
|
16
|
100
|
|
|
|
1217
|
if($query) { |
42
|
5
|
50
|
33
|
|
|
50
|
if($query =~ m/[^A-Za-z0-9\-_.!~*'()]/ && $query !~ m/%(?![A-Fa-f0-9])/) { |
43
|
5
|
|
|
|
|
18
|
$query =~ s/([^;&=A-Za-z0-9\-_.!~*'()\%])/sprintf("%%%02X", ord($1))/ge; |
|
3
|
|
|
|
|
22
|
|
44
|
5
|
|
|
|
|
19
|
$uri->query($query); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
16
|
|
|
|
|
226
|
$text = $uri->as_string; |
49
|
|
|
|
|
|
|
|
50
|
16
|
100
|
66
|
|
|
757
|
return $1 |
51
|
|
|
|
|
|
|
if $self->{_hssCfg}{AllowRelURL} |
52
|
|
|
|
|
|
|
and $text =~ /^((?:[\w\-.!~*|;\/?=+\$,%#]|&){0,100})$/; |
53
|
|
|
|
|
|
|
|
54
|
15
|
100
|
|
|
|
308
|
$text =~ m< ^ ( (f|ht)tps? :// [\w\-\.]{1,100} (?:\:\d{1,5})? |
55
|
|
|
|
|
|
|
(?: / (?:[\w\-.!~*|;/?=+\$,%#]|&){0,2000} )? |
56
|
|
|
|
|
|
|
) |
57
|
|
|
|
|
|
|
$ |
58
|
|
|
|
|
|
|
>x ? $1 : undef; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |