function _twig_escape_css_callback

1 string reference to '_twig_escape_css_callback'
twig_escape_filter in drupal/core/vendor/twig/twig/lib/Twig/Extension/Core.php
Escapes a string.

File

drupal/core/vendor/twig/twig/lib/Twig/Extension/Core.php, line 1008

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') . ' ';
}