summaryrefslogtreecommitdiff
path: root/stupid_template_engine.php
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2012-10-04 16:04:55 +0200
committerKevin Chabowski <kevin@kch42.de>2012-10-04 16:04:55 +0200
commit2a40eb87c8c679a25ddb42587a1934e02312cb4a (patch)
tree59ba98a0fe56e50905c62a19ca150d1cc1e4cf98 /stupid_template_engine.php
parent07bac0bf75aa598e63f68949eabbd621c552466a (diff)
downloadste-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.php5
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)