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.60'; |
11
|
33
|
|
|
33
|
|
66720
|
use strict; |
|
33
|
|
|
|
|
76
|
|
|
33
|
|
|
|
|
942
|
|
12
|
33
|
|
|
33
|
|
179
|
use warnings; |
|
33
|
|
|
|
|
83
|
|
|
33
|
|
|
|
|
861
|
|
13
|
|
|
|
|
|
|
|
14
|
33
|
|
|
33
|
|
17034
|
use HTML::Entities (); |
|
33
|
|
|
|
|
193626
|
|
|
33
|
|
|
|
|
5826
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my %html_escape = ('&' => '&', '>'=>'>', '<'=>'<', '"'=>'"'); |
18
|
|
|
|
|
|
|
my $html_escape = qr/([&<>"])/; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub basic_html_escape |
21
|
|
|
|
|
|
|
{ |
22
|
34
|
50
|
|
34
|
1
|
5236
|
return unless defined ${ $_[0] }; |
|
34
|
|
|
|
|
87
|
|
23
|
|
|
|
|
|
|
|
24
|
34
|
|
|
|
|
43
|
${ $_[0] } =~ s/$html_escape/$html_escape{$1}/mg; |
|
34
|
|
|
|
|
338
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub html_entities_escape |
28
|
|
|
|
|
|
|
{ |
29
|
16
|
50
|
|
16
|
1
|
674
|
return unless defined ${ $_[0] }; |
|
16
|
|
|
|
|
47
|
|
30
|
|
|
|
|
|
|
|
31
|
16
|
|
|
|
|
24
|
HTML::Entities::encode_entities( ${ $_[0] } ); |
|
16
|
|
|
|
|
52
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub url_escape |
35
|
|
|
|
|
|
|
{ |
36
|
5
|
50
|
|
5
|
1
|
616
|
return unless defined ${ $_[0] }; |
|
5
|
|
|
|
|
21
|
|
37
|
|
|
|
|
|
|
|
38
|
33
|
|
|
33
|
|
19876
|
use bytes; |
|
33
|
|
|
|
|
495
|
|
|
33
|
|
|
|
|
236
|
|
39
|
5
|
|
|
|
|
9
|
${ $_[0] } =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; |
|
5
|
|
|
|
|
23
|
|
|
49
|
|
|
|
|
166
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |