function wp_kses_normalize_entities3($matches) { if (empty($matches[1])) { return ''; } $hexchars = $matches[1]; return !valid_unicode(hexdec($hexchars)) ? "&#x{$hexchars};" : '&#x' . ltrim($hexchars, '0') . ';'; }
/** * Callback for wp_kses_normalize_entities() for regular expression. * * This function helps wp_kses_normalize_entities() to only accept valid Unicode * numeric entities in hex form. * * @access private * * @param array $matches preg_replace_callback() matches array * @return string Correctly encoded entity */ function wp_kses_normalize_entities3($matches) { if (!isset($matches[2]) || empty($matches[2])) { return ''; } $hexchars = $matches[2]; return !valid_unicode(hexdec($hexchars)) ? "&#x{$hexchars};" : "&#x{$hexchars};"; }
/** * Callback for wp_kses_normalize_entities() for regular expression. * * This function helps wp_kses_normalize_entities() to only accept valid Unicode * numeric entities in hex form. * * @access private * * @param array $matches preg_replace_callback() matches array * @return string Correctly encoded entity */ function wp_kses_normalize_entities3($matches) { if ( ! isset($matches[2]) || empty($matches[2]) ) return ''; $hexchars = $matches[2]; return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&#x$hexchars;" : "&#x$hexchars;" ); }