// formatting filters
'date' => new Twig_Filter_Function('twig_date_format_filter'),
'format' => new Twig_Filter_Function('sprintf'),
- 'replace' => new Twig_Filter_Function('twig_strtr'),
+ 'replace' => new Twig_Filter_Function('strtr'),
// encoding
'url_encode' => new Twig_Filter_Function('twig_urlencode_filter'),
}
/**
- * Replaces placeholders in a string.
- *
- * <pre>
- * {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }}
- * </pre>
- *
- * @param string $pattern A string
- * @param string $replacements The values for the placeholders
- *
- * @return string The string where the placeholders have been replaced
- */
-function twig_strtr($pattern, $replacements)
-{
- return str_replace(array_keys($replacements), array_values($replacements), $pattern);
-}
-
-/**
* Escapes a string.
*
* @param Twig_Environment $env A Twig_Environment instance