function _twig_escape_js_callback in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Extension/Core.php \_twig_escape_js_callback()
1 string reference to '_twig_escape_js_callback'
- twig_escape_filter in vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php - Escapes a string.
File
- vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php, line 1160
Code
function _twig_escape_js_callback($matches) {
$char = $matches[0];
// \xHH
if (!isset($char[1])) {
return '\\x' . strtoupper(substr('00' . bin2hex($char), -2));
}
// \uHHHH
$char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
return '\\u' . strtoupper(substr('0000' . bin2hex($char), -4));
}