diff options
author | Struan Donald <struan@exo.org.uk> | 2011-08-22 11:22:33 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-08-22 11:22:33 +0100 |
commit | 44c31ab8efbd97086e17d26c819b1d5b4946ce43 (patch) | |
tree | 5a509a5006afd50f4c48f52fdf45ac9ac86ac054 /perllib/FixMyStreet/App/View/Web.pm | |
parent | f93ff062c986847f97aef76673c2ca7742f1f125 (diff) | |
parent | a9a4fed583d7467c9c1f1fa56d42bcb75b4b488c (diff) |
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into open311-consumer
Conflicts:
t/app/model/problem.t
templates/web/default/report/new/fill_in_details.html
web/css/core.css
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r-- | perllib/FixMyStreet/App/View/Web.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index 44f80e375..5579d0d53 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -23,6 +23,7 @@ __PACKAGE__->config( ], FILTERS => { escape_js => \&escape_js, + html => \&html_filter, }, COMPILE_EXT => '.ttc', STAT_TTL => FixMyStreet->config('STAGING_SITE') ? 1 : 86400, @@ -144,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/&/&/g; + s/</</g; + s/>/>/g; + s/"/"/g; + s/'/'/g; + } + return $text; +} + 1; |