[Rt-commit] rt branch, 4.4/escape-functions-in-templates, created. rt-4.2.12-505-ge0a6939

Shawn Moore shawn at bestpractical.com
Mon Nov 16 15:15:20 EST 2015


The branch, 4.4/escape-functions-in-templates has been created
        at  e0a69398f6ede80c7e0cff1f8a97feca514fac3c (commit)

- Log -----------------------------------------------------------------
commit e0a69398f6ede80c7e0cff1f8a97feca514fac3c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Nov 6 04:24:31 2015 +0800

    export EscapeURI and EscapeHTML functions to templates
    
    we have them in RT::Interface::Web already, so we can just reuse them here.
    
    Fixes: I#31442

diff --git a/lib/RT/Template.pm b/lib/RT/Template.pm
index 4b55443..ecadc77 100644
--- a/lib/RT/Template.pm
+++ b/lib/RT/Template.pm
@@ -78,6 +78,7 @@ use Text::Template;
 use MIME::Entity;
 use MIME::Parser;
 use Scalar::Util 'blessed';
+use RT::Interface::Web;
 
 sub _Accessible {
     my $self = shift;
@@ -500,6 +501,18 @@ sub _ParseContent {
         $args{'loc'} = sub { $self->loc(@_) };
     }
 
+    $args{'EscapeURI'} = sub {
+        my $str = shift;
+        RT::Interface::Web::EscapeURI( \$str );
+        return $str;
+    };
+
+    $args{'EscapeHTML'} = sub {
+        my $str = shift;
+        RT::Interface::Web::EscapeHTML( \$str );
+        return $str;
+    };
+
     if ($self->Type eq 'Perl') {
         return $self->_ParseContentPerl(
             Content      => $content,

-----------------------------------------------------------------------


More information about the rt-commit mailing list