From 2a40eb87c8c679a25ddb42587a1934e02312cb4a Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Thu, 4 Oct 2012 16:04:55 +0200 Subject: improved and fixed docu. * can now also convert line breaks to
, if parameter lines is true. * now uses PHP's htmlspecialchars instead of htmlentities since it only escapes the minimal neccessary chars which should work, if encoding is handled correctly. * Fixed 2 markup bugs in docu/language_definition.html --- stupid_template_engine.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'stupid_template_engine.php') diff --git a/stupid_template_engine.php b/stupid_template_engine.php index b231e12..81a7688 100644 --- a/stupid_template_engine.php +++ b/stupid_template_engine.php @@ -1360,7 +1360,10 @@ class STEStandardLibrary static public function escape($ste, $params, $sub) { - return htmlentities($sub($ste), ENT_QUOTES, "UTF-8"); + if($ste->evalbool($params["lines"])) + return nl2br(htmlspecialchars(str_replace("\r\n", "\n", $sub($ste)))); + else + return htmlspecialchars($sub($ste)); } static public function strlen($ste, $params, $sub) -- cgit v1.2.3-70-g09d2