wp_kses_normalize_entities

Definition:
function wp_kses_normalize_entities($string) {}

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.

Parameters

  • string $string: Content to normalize entities

Return values

returns:Content with normalized entities

Source code

function wp_kses_normalize_entities($string) {

	# Disarm all entities by converting & to &



	$string = str_replace('&', '&', $string);



	# Change back the allowed entities in our entity whitelist



	$string = preg_replace_callback('/&([A-Za-z]{2,8});/', 'wp_kses_named_entities', $string);

	$string = preg_replace_callback('/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string);

	$string = preg_replace_callback('/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string);



	return $string;

}

3837

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: