wp_kses_normalize_entities2
Callback for wp_kses_normalize_entities() regular expression.
Description
(string) wp_kses_normalize_entities2( (array) $matches );
This function helps wp_kses_normalize_entities(…)
to only accept 16-bit values and nothing more for number; entities.
Returns (string)
Correctly encoded entity
Parameters (1)
- 0. $matches (array)
- Preg_replace_callback(…) matches array
Usage
if ( !function_exists( 'wp_kses_normalize_entities2' ) ) { require_once ABSPATH . WPINC . '/kses.php'; } // preg_replace_callback() matches array $matches = array(); // NOTICE! Understand what this does before running. $result = wp_kses_normalize_entities2($matches);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/kses.php
- function wp_kses_normalize_entities2($matches) {
- if ( empty($matches[1]) )
- return '';
- $i = $matches[1];
- if (valid_unicode($i)) {
- $i = str_pad(ltrim($i, '0'), 3, '0', STR_PAD_LEFT);
- $i = "$i;";
- } else {
- $i = "&#$i;";
- }
- return $i;
- }