Outil de recherche WordPress pour les développeurs et auteurs de thèmes



convert_invalid_entities ›

Depuis4.3.0
Dépréciéen/a
convert_invalid_entities ( $content )
Paramètres:
  • (string) $content String with entities that need converting.
    Requis: Oui
Retourne:
  • (string) Converted string.
Défini(e) dans:
Codex:

Converts invalid Unicode references range to valid range.



Source

function convert_invalid_entities( $content ) {
	$wp_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, $wp_htmltranswinuni );
	}

	return $content;
}