convert_invalid_entities()

最后更新于:2021-11-25 21:55:31

convert_invalid_entities( string$content)

Converts invalid Unicode references range to valid range.

参数

$content

(string) (Required) String with entities that need converting.

响应

(string) Converted string.

源文件

文件: gc-includes/formatting.php

function convert_invalid_entities( $content ) {
	$gc_htmltranswinuni = array(
		'€' => '€', // The Euro sign.
		'' => '',
		'‚' => '‚', // These are Windows CP1252 specific characters.
		'ƒ' => 'ƒ',  // They would look weird on non-Windows browsers.
		'„' => '„',
		'…' => '…',
		'†' => '†',
		'‡' => '‡',
		'ˆ' => 'ˆ',
		'‰' => '‰',
		'Š' => 'Š',
		'‹' => '‹',
		'Œ' => 'Œ',
		'' => '',
		'Ž' => 'Ž',
		'' => '',
		'' => '',
		'‘' => '‘',
		'’' => '’',
		'“' => '“',
		'”' => '”',
		'•' => '•',
		'–' => '–',
		'—' => '—',
		'˜' => '˜',
		'™' => '™',
		'š' => 'š',
		'›' => '›',
		'œ' => 'œ',
		'' => '',
		'ž' => 'ž',
		'Ÿ' => 'Ÿ',
	);

	if ( strpos( $content, '&#1' ) !== false ) {
		$content = strtr( $content, $gc_htmltranswinuni );
	}

	return $content;
}