wp_kses_normalize_entities example

$quote_style  = ENT_COMPAT;
        $_quote_style = ENT_COMPAT;
    } elseif ( 'single' === $quote_style ) {
        $quote_style = ENT_NOQUOTES;
    }

    if ( ! $double_encode ) {
        /* * Guarantee every &entity; is valid, convert &garbage; into &amp;garbage; * This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable. */
        $text = wp_kses_normalize_entities( $text( $quote_style & ENT_XML1 ) ? 'xml' : 'html' );
    }

    $text = htmlspecialchars( $text$quote_style$charset$double_encode );

    // Back-compat.     if ( 'single' === $_quote_style ) {
        $text = str_replace( "'", '&#039;', $text );
    }

    return $text;
}


function wp_kses( $content$allowed_html$allowed_protocols = array() ) {
    if ( empty( $allowed_protocols ) ) {
        $allowed_protocols = wp_allowed_protocols();
    }

    $content = wp_kses_no_null( $content, array( 'slash_zero' => 'keep' ) );
    $content = wp_kses_normalize_entities( $content );
    $content = wp_kses_hook( $content$allowed_html$allowed_protocols );

    return wp_kses_split( $content$allowed_html$allowed_protocols );
}

/** * Filters one HTML attribute and ensures its value is allowed. * * This function can escape data in some situations where `wp_kses()` must strip the whole attribute. * * @since 4.2.3 * * @param string $attr The 'whole' attribute, including name and value. * @param string $element The HTML element name to which the attribute belongs. * @return string Filtered attribute. */
Home | Imprint | This part of the site doesn't use cookies.