You are here

protected function Escaper::cssMatcher in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-escaper/src/Escaper.php \Zend\Escaper\Escaper::cssMatcher()

Callback function for preg_replace_callback that applies CSS escaping to all matches.

Parameters

array $matches:

Return value

string

File

vendor/zendframework/zend-escaper/src/Escaper.php, line 294

Class

Escaper
Context specific methods for use in secure output escaping

Namespace

Zend\Escaper

Code

protected function cssMatcher($matches) {
  $chr = $matches[0];
  if (strlen($chr) == 1) {
    $ord = ord($chr);
  }
  else {
    $chr = $this
      ->convertEncoding($chr, 'UTF-16BE', 'UTF-8');
    $ord = hexdec(bin2hex($chr));
  }
  return sprintf('\\%X ', $ord);
}