X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FMakeClicky;h=3564ee16fe9db04f98f25eb385c4983edf5dd41f;hb=44dd00a3ff974a17999e86e64488e996edc71e3c;hp=8efe78c4ae36b3aa68892c7277e9451ef1a80944;hpb=c5922713bc199600bc8c203155a4016c9d24cbbc;p=freeside.git diff --git a/rt/share/html/Elements/MakeClicky b/rt/share/html/Elements/MakeClicky index 8efe78c4a..3564ee16f 100644 --- a/rt/share/html/Elements/MakeClicky +++ b/rt/share/html/Elements/MakeClicky @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -50,7 +50,7 @@ use Regexp::Common qw(URI); my $escaper = sub { my $content = shift; - RT::Interface::Web::EscapeUTF8( \$content ); + RT::Interface::Web::EscapeHTML( \$content ); return $content; }; @@ -61,15 +61,19 @@ my %actions = ( }, url => sub { my %args = @_; - $args{value} = $escaper->($args{value}); - my $result = qq{[}. loc('Open URL') .qq{]}; - return $args{value} . qq{ $result}; + my $post = ""; + $post = ")" if $args{value} !~ /\(/ and $args{value} =~ s/\)$//; + $args{value} = $escaper->($args{value}) unless $args{html}; + my $result = qq{[}. loc('Open URL') .qq{]}; + return $args{value} . qq{ $result$post}; }, url_overwrite => sub { my %args = @_; - $args{value} = $escaper->($args{value}); - my $result = qq{$args{value}}; - return qq{$result}; + my $post = ""; + $post = ")" if $args{value} !~ /\(/ and $args{value} =~ s/\)$//; + $args{value} = $escaper->($args{value}) unless $args{html}; + my $result = qq{$args{value}}; + return qq{$result$post}; }, ); @@ -144,14 +148,14 @@ if ( defined $cache ) { } unless ( $regexp ) { - RT::Interface::Web::EscapeUTF8( $content ) unless $html; + RT::Interface::Web::EscapeHTML( $content ) unless $html; return; } my $pos = 0; while ( $$content =~ /($regexp)/gsio ) { my $match = $1; - next if $` =~ /href=(?:"|")$/; + next if $` =~ /\w+=(?:"|")$/; my $skipped_len = pos($$content) - $pos - length($match); if ( $skipped_len > 0 ) { my $plain; @@ -165,7 +169,7 @@ while ( $$content =~ /($regexp)/gsio ) { $pos += length($plain); } my $plain = $handle->( - %ARGS, + %ARGS, value => $match, all_matches => [ $1, $2, $3, $4, $5, $6, $7, $8, $9 ], );