From b52413dbb4d8333d5fe2a351780e20b04c4525a2 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Tue, 14 Apr 2015 22:37:15 +0200 Subject: Trim whitespace --- src/ste/STEStandardLibrary.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/ste/STEStandardLibrary.php') diff --git a/src/ste/STEStandardLibrary.php b/src/ste/STEStandardLibrary.php index 68ba06a..753ffd1 100644 --- a/src/ste/STEStandardLibrary.php +++ b/src/ste/STEStandardLibrary.php @@ -10,33 +10,33 @@ class STEStandardLibrary { } } } - + static public function escape($ste, $params, $sub) { $content = $ste->eval_sub_with_escaping($sub, STECore::ESCAPE_NONE); - + if($ste->evalbool(@$params["lines"])) { return nl2br(htmlspecialchars(str_replace("\r\n", "\n", $content))); } else { return htmlspecialchars($content); } } - + static public function raw($ste, $params, $sub) { return $ste->eval_sub_with_escaping($sub, STECore::ESCAPE_NONE); } - + static public function autoescape($ste, $params, $sub) { if(empty($params["mode"])) { throw new RuntimeError("Missing mode parameter in ."); } - + return $content = $ste->eval_sub_with_escaping($sub, $params['mode']); } - + static public function strlen($ste, $params, $sub) { return strlen($sub($ste)); } - + static public function arraylen($ste, $params, $sub) { if(empty($params["array"])) { throw new RuntimeError("Missing array parameter in ."); @@ -44,7 +44,7 @@ class STEStandardLibrary { $a = $ste->get_var_by_name($params["array"], false); return (is_array($a)) ? count($a) : ""; } - + static public function inc($ste, $params, $sub) { if(empty($params["var"])) { throw new RuntimeError("Missing var parameter in ."); @@ -52,7 +52,7 @@ class STEStandardLibrary { $ref = &$ste->get_var_reference($params["var"], true); $ref++; } - + static public function dec($ste, $params, $sub) { if(empty($params["var"])) { throw new RuntimeError("Missing var parameter in ."); @@ -60,11 +60,11 @@ class STEStandardLibrary { $ref = &$ste->get_var_reference($params["var"], true); $ref--; } - + static public function date($ste, $params, $sub) { return @strftime($sub($ste), empty($params["timestamp"]) ? @time() : (int) $params["timestamp"]); } - + static public function in_array($ste, $params, $sub) { if(empty($params["array"])) { throw new RuntimeError("Missing array parameter in ."); @@ -75,14 +75,14 @@ class STEStandardLibrary { } return in_array($sub($ste), $ar) ? "y" : ""; } - + static public function join($ste, $params, $sub) { if(empty($params["array"])) { throw new RuntimeError("Missing array parameter in ."); } return implode($sub($ste), $ste->get_var_by_name($params["array"])); } - + static public function split($ste, $params, $sub) { if(empty($params["array"])) { throw new RuntimeError("Missing array parameter in ."); @@ -92,12 +92,12 @@ class STEStandardLibrary { } $ste->set_var_by_name($params["array"], explode($params["delim"], $sub($ste))); } - + static public function array_add($ste, $params, $sub) { if(empty($params["array"])) { throw new RuntimeError("Missing array parameter in ."); } - + $ar = &$ste->get_var_reference($params["array"], true); if(empty($params["key"])) { $ar[] = $sub($ste); @@ -105,20 +105,20 @@ class STEStandardLibrary { $ar[$params["key"]] = $sub($ste); } } - + static public function array_filter($ste, $params, $sub) { if(empty($params["array"])) { throw new RuntimeError("Missing array parameter in ."); } - + $ar = $ste->get_var_by_name($params["array"]); if(!is_array($ar)) { throw new RuntimeError("Variable at 'array' is not an array."); } - + $keys = array_keys($ar); - + if(!empty($params["keep_by_keys"])) { $keep_by_keys = &$ste->get_var_reference($params["keep_by_keys"], false); if(!is_array($keep_by_keys)) { @@ -157,7 +157,7 @@ class STEStandardLibrary { $ar = array_filter($ar, function($v) use ($delete_by_values) { return !in_array($v, $delete_by_values); }); $keys = array_keys($ar); } - + $ste->set_var_by_name($params["array"], $ar); } } -- cgit v1.2.3-54-g00ecf