valid_unicode example


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;
}

/** * 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. * * @since 2.7.0 * @access private * @ignore * * @param array $matches `preg_replace_callback()` matches array. * @return string Correctly encoded entity. */
Home | Imprint | This part of the site doesn't use cookies.