htmlentities2()WP 1.2.2

Converts entities, while preserving already-encoded entities.

Хуков нет.

Возвращает

Строку. Converted text.

Использование

htmlentities2( $text );
$text(строка) (обязательный)
The text to be converted.

Список изменений

С версии 1.2.2 Введена.

Код htmlentities2() WP 6.4.3

function htmlentities2( $text ) {
	$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );

	$translation_table[ chr( 38 ) ] = '&';

	return preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', strtr( $text, $translation_table ) );
}