function _twig_escape_css_callback in Translation template extractor 7.3
Same name and namespace in other branches
- 6.3 vendor/Twig/Extension/Core.php \_twig_escape_css_callback()
1 string reference to '_twig_escape_css_callback'
- twig_escape_filter in vendor/
Twig/ Extension/ Core.php - Escapes a string.
File
- vendor/
Twig/ Extension/ Core.php, line 1175
Code
function _twig_escape_css_callback($matches) {
$char = $matches[0];
// \xHH
if (!isset($char[1])) {
$hex = ltrim(strtoupper(bin2hex($char)), '0');
if (0 === strlen($hex)) {
$hex = '0';
}
return '\\' . $hex . ' ';
}
// \uHHHH
$char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
return '\\' . ltrim(strtoupper(bin2hex($char)), '0') . ' ';
}