line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 1998-2005 by Jonathan Swartz. All rights reserved. |
2
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify it |
3
|
|
|
|
|
|
|
# under the same terms as Perl itself. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# A library of escape subroutines to be used for substitution escaping |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package HTML::Mason::Escapes; |
10
|
|
|
|
|
|
|
$HTML::Mason::Escapes::VERSION = '1.59'; |
11
|
33
|
|
|
33
|
|
67882
|
use strict; |
|
33
|
|
|
|
|
71
|
|
|
33
|
|
|
|
|
983
|
|
12
|
33
|
|
|
33
|
|
166
|
use warnings; |
|
33
|
|
|
|
|
80
|
|
|
33
|
|
|
|
|
875
|
|
13
|
|
|
|
|
|
|
|
14
|
33
|
|
|
33
|
|
16656
|
use HTML::Entities (); |
|
33
|
|
|
|
|
187987
|
|
|
33
|
|
|
|
|
5728
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my %html_escape = ('&' => '&', '>'=>'>', '<'=>'<', '"'=>'"'); |
18
|
|
|
|
|
|
|
my $html_escape = qr/([&<>"])/; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub basic_html_escape |
21
|
|
|
|
|
|
|
{ |
22
|
34
|
50
|
|
34
|
1
|
5254
|
return unless defined ${ $_[0] }; |
|
34
|
|
|
|
|
80
|
|
23
|
|
|
|
|
|
|
|
24
|
34
|
|
|
|
|
47
|
${ $_[0] } =~ s/$html_escape/$html_escape{$1}/mg; |
|
34
|
|
|
|
|
335
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub html_entities_escape |
28
|
|
|
|
|
|
|
{ |
29
|
16
|
50
|
|
16
|
1
|
647
|
return unless defined ${ $_[0] }; |
|
16
|
|
|
|
|
39
|
|
30
|
|
|
|
|
|
|
|
31
|
16
|
|
|
|
|
22
|
HTML::Entities::encode_entities( ${ $_[0] } ); |
|
16
|
|
|
|
|
46
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub url_escape |
35
|
|
|
|
|
|
|
{ |
36
|
5
|
50
|
|
5
|
1
|
585
|
return unless defined ${ $_[0] }; |
|
5
|
|
|
|
|
17
|
|
37
|
|
|
|
|
|
|
|
38
|
33
|
|
|
33
|
|
19985
|
use bytes; |
|
33
|
|
|
|
|
498
|
|
|
33
|
|
|
|
|
254
|
|
39
|
5
|
|
|
|
|
9
|
${ $_[0] } =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; |
|
5
|
|
|
|
|
28
|
|
|
49
|
|
|
|
|
137
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |