wp_kses_normalize_entities

Converts and fixes HTML entities.

Description

(string) wp_kses_normalize_entities( (string) $string ); 

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

Returns (string)

Content with normalized entities

Parameters (1)

0. $string (string)
Content to normalize entities

Usage

  1. if ( !function_exists( 'wp_kses_normalize_entities' ) ) { 
  2. require_once ABSPATH . WPINC . '/kses.php'; 
  3.  
  4. // Content to normalize entities 
  5. $string = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_kses_normalize_entities($string); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/kses.php  
  1. function wp_kses_normalize_entities($string) { 
  2. // Disarm all entities by converting & to & 
  3. $string = str_replace('&', '&', $string); 
  4.  
  5. // Change back the allowed entities in our entity whitelist 
  6. $string = preg_replace_callback('/&([A-Za-z]{2, 8}[0-9]{0, 2});/', 'wp_kses_named_entities', $string); 
  7. $string = preg_replace_callback('/&#(0*[0-9]{1, 7});/', 'wp_kses_normalize_entities2', $string); 
  8. $string = preg_replace_callback('/&#[Xx](0*[0-9A-Fa-f]{1, 6});/', 'wp_kses_normalize_entities3', $string); 
  9.  
  10. return $string;