diff options
author | Kevin Chabowski <kevin@kch42.de> | 2012-10-04 16:04:55 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2012-10-04 16:04:55 +0200 |
commit | 2a40eb87c8c679a25ddb42587a1934e02312cb4a (patch) | |
tree | 59ba98a0fe56e50905c62a19ca150d1cc1e4cf98 /stupid_template_engine.php | |
parent | 07bac0bf75aa598e63f68949eabbd621c552466a (diff) | |
download | ste-2a40eb87c8c679a25ddb42587a1934e02312cb4a.tar.gz ste-2a40eb87c8c679a25ddb42587a1934e02312cb4a.tar.bz2 ste-2a40eb87c8c679a25ddb42587a1934e02312cb4a.zip |
improved <ste:escape> and fixed docu.
* <ste:escape> can now also convert line breaks to <br />, if parameter
lines is true.
* <ste:escape> 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
Diffstat (limited to 'stupid_template_engine.php')
-rw-r--r-- | stupid_template_engine.php | 5 |
1 files changed, 4 insertions, 1 deletions
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) |