Permalink
Browse files

Clean up new batch functionality in escaping functions.

  • Loading branch information...
1 parent 10ce61b commit c39d8fbcbeb07a0948d5e1cf8d78c6e1ef3e81a8 @reinink reinink committed Oct 21, 2014
Showing with 9 additions and 9 deletions.
  1. +8 −8 src/Template/Template.php
  2. +1 −1 tests/Template/TemplateTest.php
@@ -263,28 +263,28 @@ protected function batch($var, $functions)
/**
* Escape string.
- * @param string $string
+ * @param string $string
+ * @param null|string $functions
* @return string
*/
- protected function escape($string)
+ protected function escape($string, $functions = null)
{
- $functions = array_slice(func_get_args(), 1);
-
if ($functions) {
- $string = $this->batch($string, implode('|', $functions));
+ $string = $this->batch($string, $functions);
}
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}
/**
* Alias to escape function.
- * @param string $string
+ * @param string $string
+ * @param null|string $functions
* @return string
*/
- protected function e($string)
+ protected function e($string, $functions = null)
{
- return call_user_func_array(array($this, 'escape'), func_get_args());
+ return $this->escape($string, $functions);
}
}
@@ -229,7 +229,7 @@ public function testEscapeFunctionBatch()
{
vfsStream::create(
array(
- 'template.php' => '<?php echo $this->escape("<strong>Jonathan</strong>", "strtoupper", "strrev") ?>'
+ 'template.php' => '<?php echo $this->escape("<strong>Jonathan</strong>", "strtoupper|strrev") ?>'
)
);

0 comments on commit c39d8fb

Please sign in to comment.