public static function kintParser::escape in Devel 8        
                          
                  
                        Same name and namespace in other branches
- 8.2 kint/kint/inc/kintParser.class.php \kintParser::escape()
7 calls to kintParser::escape()
  - kintParser::_parse_array in kint/kint/inc/kintParser.class.php
- kintParser::_parse_object in kint/kint/inc/kintParser.class.php
- kintParser::_parse_string in kint/kint/inc/kintParser.class.php
- Kint_Decorators_Plain::_drawHeader in kint/kint/decorators/plain.php
- Kint_Decorators_Plain::_title in kint/kint/decorators/plain.php
... See full list
File
 
   - kint/kint/inc/kintParser.class.php, line 237
Class
  
  - kintParser 
Code
public static function escape($value, $encoding = null) {
  if (empty($value)) {
    return $value;
  }
  if (Kint::enabled() === Kint::MODE_CLI) {
    $value = str_replace("\33", "\\x1b", $value);
  }
  if (Kint::enabled() === Kint::MODE_CLI || Kint::enabled() === Kint::MODE_WHITESPACE) {
    return $value;
  }
  $encoding or $encoding = self::_detectEncoding($value);
  $value = htmlspecialchars($value, ENT_NOQUOTES, $encoding === 'ASCII' ? 'UTF-8' : $encoding);
  if ($encoding === 'UTF-8') {
    
    
    $value = preg_replace('/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x80-\\x9F]/u', '?', $value);
  }
  
  if (function_exists('mb_encode_numericentity')) {
    $value = mb_encode_numericentity($value, array(
      0x80,
      0xffff,
      0,
      0xffff,
    ), $encoding);
  }
  return $value;
}