ent2ncr

Definition:
function ent2ncr($text) {}

Converts named entities into numbered entities.

Parameters

  • string $text: The text within which entities will be converted.

Return values

returns:Text with converted entities.

Defined filters

  • pre_ent2ncr
    apply_filters( 'pre_ent2ncr', null, $text )

Source code

function ent2ncr($text) {



	// Allow a plugin to short-circuit and override the mappings.

	$filtered = apply_filters( 'pre_ent2ncr', null, $text );

	if( null !== $filtered )

		return $filtered;



	$to_ncr = array(

		'"' => '"',

		'&' => '&',

		'⁄' => '/',

		'&lt;' => '<',

		'&gt;' => '>',

		'|' => '|',

		'&nbsp;' => ' ',

		'&iexcl;' => '¡',

		'&cent;' => '¢',

		'&pound;' => '£',

		'&curren;' => '¤',

		'&yen;' => '¥',

		'&brvbar;' => '¦',

		'&brkbar;' => '¦',

		'&sect;' => '§',

		'&uml;' => '¨',

		'&die;' => '¨',

		'&copy;' => '©',

		'&ordf;' => 'ª',

		'&laquo;' => '«',

		'&not;' => '¬',

		'&shy;' => '­',

		'&reg;' => '®',

		'&macr;' => '¯',

		'&hibar;' => '¯',

		'&deg;' => '°',

		'&plusmn;' => '±',

		'&sup2;' => '²',

		'&sup3;' => '³',

		'&acute;' => '´',

		'&micro;' => 'µ',

		'&para;' => '¶',

		'&middot;' => '·',

		'&cedil;' => '¸',

		'&sup1;' => '¹',

		'&ordm;' => 'º',

		'&raquo;' => '»',

		'&frac14;' => '¼',

		'&frac12;' => '½',

		'&frac34;' => '¾',

		'&iquest;' => '¿',

		'&Agrave;' => 'À',

		'&Aacute;' => 'Á',

		'&Acirc;' => 'Â',

		'&Atilde;' => 'Ã',

		'&Auml;' => 'Ä',

		'&Aring;' => 'Å',

		'&AElig;' => 'Æ',

		'&Ccedil;' => 'Ç',

		'&Egrave;' => 'È',

		'&Eacute;' => 'É',

		'&Ecirc;' => 'Ê',

		'&Euml;' => 'Ë',

		'&Igrave;' => 'Ì',

		'&Iacute;' => 'Í',

		'&Icirc;' => 'Î',

		'&Iuml;' => 'Ï',

		'&ETH;' => 'Ð',

		'&Ntilde;' => 'Ñ',

		'&Ograve;' => 'Ò',

		'&Oacute;' => 'Ó',

		'&Ocirc;' => 'Ô',

		'&Otilde;' => 'Õ',

		'&Ouml;' => 'Ö',

		'&times;' => '×',

		'&Oslash;' => 'Ø',

		'&Ugrave;' => 'Ù',

		'&Uacute;' => 'Ú',

		'&Ucirc;' => 'Û',

		'&Uuml;' => 'Ü',

		'&Yacute;' => 'Ý',

		'&THORN;' => 'Þ',

		'&szlig;' => 'ß',

		'&agrave;' => 'à',

		'&aacute;' => 'á',

		'&acirc;' => 'â',

		'&atilde;' => 'ã',

		'&auml;' => 'ä',

		'&aring;' => 'å',

		'&aelig;' => 'æ',

		'&ccedil;' => 'ç',

		'&egrave;' => 'è',

		'&eacute;' => 'é',

		'&ecirc;' => 'ê',

		'&euml;' => 'ë',

		'&igrave;' => 'ì',

		'&iacute;' => 'í',

		'&icirc;' => 'î',

		'&iuml;' => 'ï',

		'&eth;' => 'ð',

		'&ntilde;' => 'ñ',

		'&ograve;' => 'ò',

		'&oacute;' => 'ó',

		'&ocirc;' => 'ô',

		'&otilde;' => 'õ',

		'&ouml;' => 'ö',

		'&divide;' => '÷',

		'&oslash;' => 'ø',

		'&ugrave;' => 'ù',

		'&uacute;' => 'ú',

		'&ucirc;' => 'û',

		'&uuml;' => 'ü',

		'&yacute;' => 'ý',

		'&thorn;' => 'þ',

		'&yuml;' => 'ÿ',

		'&OElig;' => 'Œ',

		'&oelig;' => 'œ',

		'&Scaron;' => 'Š',

		'&scaron;' => 'š',

		'&Yuml;' => 'Ÿ',

		'&fnof;' => 'ƒ',

		'&circ;' => 'ˆ',

		'&tilde;' => '˜',

		'&Alpha;' => 'Α',

		'&Beta;' => 'Β',

		'&Gamma;' => 'Γ',

		'&Delta;' => 'Δ',

		'&Epsilon;' => 'Ε',

		'&Zeta;' => 'Ζ',

		'&Eta;' => 'Η',

		'&Theta;' => 'Θ',

		'&Iota;' => 'Ι',

		'&Kappa;' => 'Κ',

		'&Lambda;' => 'Λ',

		'&Mu;' => 'Μ',

		'&Nu;' => 'Ν',

		'&Xi;' => 'Ξ',

		'&Omicron;' => 'Ο',

		'&Pi;' => 'Π',

		'&Rho;' => 'Ρ',

		'&Sigma;' => 'Σ',

		'&Tau;' => 'Τ',

		'&Upsilon;' => 'Υ',

		'&Phi;' => 'Φ',

		'&Chi;' => 'Χ',

		'&Psi;' => 'Ψ',

		'&Omega;' => 'Ω',

		'&alpha;' => 'α',

		'&beta;' => 'β',

		'&gamma;' => 'γ',

		'&delta;' => 'δ',

		'&epsilon;' => 'ε',

		'&zeta;' => 'ζ',

		'&eta;' => 'η',

		'&theta;' => 'θ',

		'&iota;' => 'ι',

		'&kappa;' => 'κ',

		'&lambda;' => 'λ',

		'&mu;' => 'μ',

		'&nu;' => 'ν',

		'&xi;' => 'ξ',

		'&omicron;' => 'ο',

		'&pi;' => 'π',

		'&rho;' => 'ρ',

		'&sigmaf;' => 'ς',

		'&sigma;' => 'σ',

		'&tau;' => 'τ',

		'&upsilon;' => 'υ',

		'&phi;' => 'φ',

		'&chi;' => 'χ',

		'&psi;' => 'ψ',

		'&omega;' => 'ω',

		'&thetasym;' => 'ϑ',

		'&upsih;' => 'ϒ',

		'&piv;' => 'ϖ',

		'&ensp;' => ' ',

		'&emsp;' => ' ',

		'&thinsp;' => ' ',

		'&zwnj;' => '‌',

		'&zwj;' => '‍',

		'&lrm;' => '‎',

		'&rlm;' => '‏',

		'&ndash;' => '–',

		'&mdash;' => '—',

		'&lsquo;' => '‘',

		'&rsquo;' => '’',

		'&sbquo;' => '‚',

		'&ldquo;' => '“',

		'&rdquo;' => '”',

		'&bdquo;' => '„',

		'&dagger;' => '†',

		'&Dagger;' => '‡',

		'&bull;' => '•',

		'&hellip;' => '…',

		'&permil;' => '‰',

		'&prime;' => '′',

		'&Prime;' => '″',

		'&lsaquo;' => '‹',

		'&rsaquo;' => '›',

		'&oline;' => '‾',

		'&frasl;' => '⁄',

		'&euro;' => '€',

		'&image;' => 'ℑ',

		'&weierp;' => '℘',

		'&real;' => 'ℜ',

		'&trade;' => '™',

		'&alefsym;' => 'ℵ',

		'&crarr;' => '↵',

		'&lArr;' => '⇐',

		'&uArr;' => '⇑',

		'&rArr;' => '⇒',

		'&dArr;' => '⇓',

		'&hArr;' => '⇔',

		'&forall;' => '∀',

		'&part;' => '∂',

		'&exist;' => '∃',

		'&empty;' => '∅',

		'&nabla;' => '∇',

		'&isin;' => '∈',

		'&notin;' => '∉',

		'&ni;' => '∋',

		'&prod;' => '∏',

		'&sum;' => '∑',

		'&minus;' => '−',

		'&lowast;' => '∗',

		'&radic;' => '√',

		'&prop;' => '∝',

		'&infin;' => '∞',

		'&ang;' => '∠',

		'&and;' => '∧',

		'&or;' => '∨',

		'&cap;' => '∩',

		'&cup;' => '∪',

		'&int;' => '∫',

		'&there4;' => '∴',

		'&sim;' => '∼',

		'&cong;' => '≅',

		'&asymp;' => '≈',

		'&ne;' => '≠',

		'&equiv;' => '≡',

		'&le;' => '≤',

		'&ge;' => '≥',

		'&sub;' => '⊂',

		'&sup;' => '⊃',

		'&nsub;' => '⊄',

		'&sube;' => '⊆',

		'&supe;' => '⊇',

		'&oplus;' => '⊕',

		'&otimes;' => '⊗',

		'&perp;' => '⊥',

		'&sdot;' => '⋅',

		'&lceil;' => '⌈',

		'&rceil;' => '⌉',

		'&lfloor;' => '⌊',

		'&rfloor;' => '⌋',

		'&lang;' => '〈',

		'&rang;' => '〉',

		'&larr;' => '←',

		'&uarr;' => '↑',

		'&rarr;' => '→',

		'&darr;' => '↓',

		'&harr;' => '↔',

		'&loz;' => '◊',

		'&spades;' => '♠',

		'&clubs;' => '♣',

		'&hearts;' => '♥',

		'&diams;' => '♦'

	);



	return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );

}

1014

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: