Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_kses_normalize_entities [ WordPress Function ]

wp_kses_normalize_entities ( $string )
Parameters:
  • (string) $string Content to normalize entities
Returns:
  • (string) Content with normalized entities
Defined at:



Converts and fixes HTML entities.

This function normalizes HTML entities. It will convert "AT&T" to the correct "AT&T", ":" to ":", "&#XYZZY;" to "&#XYZZY;" and so on.

Source


<?php
function wp_kses_normalize_entities($string) {
    
# Disarm all entities by converting & to &amp;

    
$string str_replace('&''&amp;'$string);

    
# Change back the allowed entities in our entity whitelist

    
$string preg_replace_callback('/&amp;([A-Za-z]{2,8});/''wp_kses_named_entities'$string);
    
$string preg_replace_callback('/&amp;#(0*[0-9]{1,7});/''wp_kses_normalize_entities2'$string);
    
$string preg_replace_callback('/&amp;#[Xx](0*[0-9A-Fa-f]{1,6});/''wp_kses_normalize_entities3'$string);

    return 
$string;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics