wp_kses_no_null

Definition:
function wp_kses_no_null($string) {}

Removes any NULL characters in $string.

Parameters

  • string $string

Source code

function wp_kses_no_null($string) {

	$string = preg_replace('/\0+/', '', $string);

	$string = preg_replace('/(\\\\0)+/', '', $string);



	return $string;

}

3839

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

wp_kses_named_entities

Definition:
function wp_kses_named_entities($matches) {}

Callback for wp_kses_normalize_entities() regular expression.
This function only accepts valid named entity references, which are finite, case-sensitive, and highly scrutinized by HTML and XML validators.

Parameters

  • array $matches: preg_replace_callback() matches array

Return values

returns:Correctly encoded entity

Source code

function wp_kses_named_entities($matches) {

	global $allowedentitynames;



	if ( empty($matches[1]) )

		return '';



	$i = $matches[1];

	return ( ( ! in_array($i, $allowedentitynames) ) ? "&$i;" : "&$i;" );

}

3835

wp_kses_js_entities

Definition:
function wp_kses_js_entities($string) {}

Removes the HTML JavaScript entities found in early versions of Netscape 4.

Parameters

  • string $string

Source code

function wp_kses_js_entities($string) {

	return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);

}

3833

wp_kses_html_error

Definition:
function wp_kses_html_error($string) {}

Handles parsing errors in wp_kses_hair().
The general plan is to remove everything to and including some whitespace, but it deals with quotes and apostrophes as well.

Parameters

  • string $string

Source code

function wp_kses_html_error($string) {

	return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);

}

3831