From 34cf7dfe99cb6f3cdd1e52fad99f910db587f9c8 Mon Sep 17 00:00:00 2001 From: fabien Date: Mon, 12 Oct 2009 05:38:32 +0000 Subject: [PATCH] moved escape filter to core runtime (closes #4) git-svn-id: http://svn.twig-project.org/trunk@21 93ef8e89-cb99-4229-a87c-7fa0fa45744b --- lib/Twig/runtime.php | 10 ++++++++++ lib/Twig/runtime_escaper.php | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Twig/runtime.php b/lib/Twig/runtime.php index 0b5dd24..d4b02c1 100644 --- a/lib/Twig/runtime.php +++ b/lib/Twig/runtime.php @@ -99,6 +99,16 @@ function twig_sort_filter($array) return $array; } +function twig_escape_filter(Twig_TemplateInterface $template, $string) +{ + if (!is_string($string)) + { + return $string; + } + + return htmlspecialchars($string, ENT_QUOTES, $template->getEnvironment()->getCharset()); +} + // add multibyte extensions if possible if (function_exists('mb_get_info')) { diff --git a/lib/Twig/runtime_escaper.php b/lib/Twig/runtime_escaper.php index b62badd..1a40d48 100644 --- a/lib/Twig/runtime_escaper.php +++ b/lib/Twig/runtime_escaper.php @@ -14,13 +14,3 @@ function twig_safe_filter($string) { return $string; } - -function twig_escape_filter(Twig_TemplateInterface $template, $string) -{ - if (!is_string($string)) - { - return $string; - } - - return htmlspecialchars($string, ENT_QUOTES, $template->getEnvironment()->getCharset()); -} -- 1.7.2.5