From 423c827093e6d2843adb1a8183beea1359d9513b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 25 Apr 2012 07:00:14 +0200 Subject: [PATCH] tweaked an error message --- lib/Twig/Extension/Core.php | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 813261f..301c4bb 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -735,11 +735,11 @@ function twig_in_filter($value, $compare) * * @param Twig_Environment $env A Twig_Environment instance * @param string $string The value to be escaped - * @param string $type The escaping strategy + * @param string $strategy The escaping strategy * @param string $charset The charset * @param Boolean $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) */ -function twig_escape_filter(Twig_Environment $env, $string, $type = 'html', $charset = null, $autoescape = false) +function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) { if ($autoescape && is_object($string) && $string instanceof Twig_Markup) { return $string; @@ -755,7 +755,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $type = 'html', $cha $string = (string) $string; - switch ($type) { + switch ($strategy) { case 'js': // escape all non-alphanumeric characters // into their \xHH or \uHHHH representations @@ -778,7 +778,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $type = 'html', $cha // Using a static variable to avoid initializing the array // each time the function is called. Moving the declaration on the - // top of the function slow downs other escaping types. + // top of the function slow downs other escaping strategies. static $htmlspecialcharsCharsets = array( 'iso-8859-1' => true, 'iso8859-1' => true, 'iso-8859-15' => true, 'iso8859-15' => true, @@ -806,7 +806,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $type = 'html', $cha return twig_convert_encoding($string, $charset, 'UTF-8'); default: - throw new Twig_Error_Runtime(sprintf('Invalid escape type "%s".', $type)); + throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: html, js).', $strategy)); } } -- 1.7.2.5