diff options
Diffstat (limited to 'rt/share/html/Elements/MakeClicky')
| -rw-r--r-- | rt/share/html/Elements/MakeClicky | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/rt/share/html/Elements/MakeClicky b/rt/share/html/Elements/MakeClicky index 2f2b87990..583e70fe8 100644 --- a/rt/share/html/Elements/MakeClicky +++ b/rt/share/html/Elements/MakeClicky @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -48,22 +48,29 @@ <%ONCE> use Regexp::Common qw(URI); +my $escaper = sub { + my $content = shift; + RT::Interface::Web::EscapeUTF8( \$content ); + return $content; +}; + my %actions = ( default => sub { my %args = @_; - return $args{value}; + return $escaper->($args{value}); }, url => sub { my %args = @_; + $args{value} = $escaper->($args{value}); my $result = qq{[<a target="new" href="$args{value}">}. loc('Open URL') .qq{</a>]}; return $args{value} . qq{ <span class="clickylink">$result</span>}; }, url_overwrite => sub { my %args = @_; - my $result = qq{<a target="new" href="$args{'value'}">}; + my $result = qq{<a target="new" href="} . $escaper->($args{'value'}) . q{">}; #XXX: use spaces here. ­ <wbr> are not well supported :( $args{'value'} =~ s/(\S{30})/$1 /g; - $result .= qq{$args{'value'}</a>}; + $result .= $escaper->($args{value}).qq{</a>}; return qq{<span class="clickylink">$result</span>}; }, ); @@ -91,12 +98,6 @@ my $handle = sub { } }; -my $escaper = sub { - my $content = shift; - RT::Interface::Web::EscapeUTF8( \$content ); - return $content; -}; - # Hook to add more Clicky types # XXX Have to have Page argument, as Mason gets caller wrong in Callback? # This happens as we are in <%ONCE> block |
