aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/View/Web.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-08-17 22:56:37 +0100
committerStruan Donald <struan@exo.org.uk>2011-08-17 22:56:37 +0100
commit3b5d561700b184c20e63111d4cbc1daab78e16c6 (patch)
treef0c53c6bf8d4ebf12e5388053ad856fb0d0e7b86 /perllib/FixMyStreet/App/View/Web.pm
parent390f8e8ad1e10f832c4323c39bed2c883744a03f (diff)
parentf38b8e985697c35a62374a2f02dce2d681ef58cd (diff)
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Conflicts: db/schema.sql perllib/FixMyStreet/App/Controller/Admin.pm perllib/FixMyStreet/DB/Result/User.pm t/app/controller/admin.t templates/web/default/admin/update_edit.html web/css/core.css
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index df2d0ac20..5579d0d53 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -23,7 +23,10 @@ __PACKAGE__->config(
],
FILTERS => {
escape_js => \&escape_js,
+ html => \&html_filter,
},
+ COMPILE_EXT => '.ttc',
+ STAT_TTL => FixMyStreet->config('STAGING_SITE') ? 1 : 86400,
);
=head1 NAME
@@ -142,5 +145,25 @@ sub escape_js {
return $text;
}
+=head2 html_filter
+
+Same as Template Toolkit's html_filter, but escapes ' too, as we don't (and
+shouldn't have to) know whether we'll be used inbetween single or double
+quotes.
+
+=cut
+
+sub html_filter {
+ my $text = shift;
+ for ($text) {
+ s/&/&amp;/g;
+ s/</&lt;/g;
+ s/>/&gt;/g;
+ s/"/&quot;/g;
+ s/'/&#39;/g;
+ }
+ return $text;
+}
+
1;