Make WordPress Core

Ticket #1297: entities-patch

File entities-patch, 8.2 KB (added by nimbustier, 21 years ago)
Line 
1--- default-filters.php.~1.2.~  2005-02-15 01:21:21.000000000 +0100
2+++ default-filters.php 2005-04-28 17:09:13.665652487 +0200
3@@ -63,6 +63,11 @@
4 
5 add_filter('the_title_rss', 'strip_tags');
6 
7+// Deals with named entities for RSS feeds
8+add_filter('the_title_rss', 'filter_named_entities');
9+add_filter('the_content', 'filter_named_entities');
10+add_filter('the_excerpt_rss', 'filter_named_entities');
11+
12 add_filter('the_content', 'convert_smilies');
13 add_filter('the_content', 'convert_chars');
14 add_filter('the_content', 'wpautop');
15--- functions-formatting.php    2005-04-28 17:12:55.842827850 +0200
16+++ functions-formatting.php.old        2005-04-28 17:06:17.388907217 +0200
17@@ -294,288 +294,6 @@
18        return $content;
19 }
20 
21-
22-/*
23- filter_named_entities
24-
25- Turns HTML named entities into numeric entities (useful for output that doesn't support named entities, e.g. RSS)
26-
27- @param text      Text to be converted to numeric entities
28- @return          Returns converted text
29- @author          Dominique Hazael-Massieux (dom@w3.org)
30- @version         v1.0
31- @date            April 28, 2006
32- @license         GPL v2.0
33- @notes           See also http://wordpress.org/support/topic.php?id=19421
34- @changelog       
35- ---         1.0  First Version
36-*/
37-
38-function filter_named_entities($content) {
39-  $html_named_entities_mapping =
40-    array (
41-           // Obtained with:
42-           // less /usr/share/xml/entities/xhtml/*.ent|grep '^<!ENTITY'|sed -e 's/^<\!ENTITY[ \t]*\([A-Za-z0-9]*\)[ \t]*"&#\([0-9]*\);".*$/"\1"=>\2,/' > /home/dom/data/2005/04/entities-table
43-           "nbsp"=>160,
44-           "iexcl"=>161,
45-           "cent"=>162,
46-           "pound"=>163,
47-           "curren"=>164,
48-           "yen"=>165,
49-           "brvbar"=>166,
50-           "sect"=>167,
51-           "uml"=>168,
52-           "copy"=>169,
53-           "ordf"=>170,
54-           "laquo"=>171,
55-           "not"=>172,
56-           "shy"=>173,
57-           "reg"=>174,
58-           "macr"=>175,
59-           "deg"=>176,
60-           "plusmn"=>177,
61-           "sup2"=>178,
62-           "sup3"=>179,
63-           "acute"=>180,
64-           "micro"=>181,
65-           "para"=>182,
66-           "middot"=>183,
67-           "cedil"=>184,
68-           "sup1"=>185,
69-           "ordm"=>186,
70-           "raquo"=>187,
71-           "frac14"=>188,
72-           "frac12"=>189,
73-           "frac34"=>190,
74-           "iquest"=>191,
75-           "Agrave"=>192,
76-           "Aacute"=>193,
77-           "Acirc"=>194,
78-           "Atilde"=>195,
79-           "Auml"=>196,
80-           "Aring"=>197,
81-           "AElig"=>198,
82-           "Ccedil"=>199,
83-           "Egrave"=>200,
84-           "Eacute"=>201,
85-           "Ecirc"=>202,
86-           "Euml"=>203,
87-           "Igrave"=>204,
88-           "Iacute"=>205,
89-           "Icirc"=>206,
90-           "Iuml"=>207,
91-           "ETH"=>208,
92-           "Ntilde"=>209,
93-           "Ograve"=>210,
94-           "Oacute"=>211,
95-           "Ocirc"=>212,
96-           "Otilde"=>213,
97-           "Ouml"=>214,
98-           "times"=>215,
99-           "Oslash"=>216,
100-           "Ugrave"=>217,
101-           "Uacute"=>218,
102-           "Ucirc"=>219,
103-           "Uuml"=>220,
104-           "Yacute"=>221,
105-           "THORN"=>222,
106-           "szlig"=>223,
107-           "agrave"=>224,
108-           "aacute"=>225,
109-           "acirc"=>226,
110-           "atilde"=>227,
111-           "auml"=>228,
112-           "aring"=>229,
113-"aelig"=>230,
114-           "ccedil"=>231,
115-           "egrave"=>232,
116-           "eacute"=>233,
117-           "ecirc"=>234,
118-           "euml"=>235,
119-           "igrave"=>236,
120-           "iacute"=>237,
121-           "icirc"=>238,
122-           "iuml"=>239,
123-           "eth"=>240,
124-           "ntilde"=>241,
125-           "ograve"=>242,
126-           "oacute"=>243,
127-           "ocirc"=>244,
128-           "otilde"=>245,
129-           "ouml"=>246,
130-           "divide"=>247,
131-           "oslash"=>248,
132-           "ugrave"=>249,
133-           "uacute"=>250,
134-           "ucirc"=>251,
135-           "uuml"=>252,
136-           "yacute"=>253,
137-           "thorn"=>254,
138-           "yuml"=>255,
139-           "quot"=>34,
140-           "amp"=>38,
141-           "lt"=>60,
142-           "gt"=>62,
143-           "OElig"=>338,
144-           "oelig"=>339,
145-           "Scaron"=>352,
146-           "scaron"=>353,
147-           "Yuml"=>376,
148-           "circ"=>710,
149-           "tilde"=>732,
150-           "ensp"=>8194,
151-           "emsp"=>8195,
152-           "thinsp"=>8201,
153-           "zwnj"=>8204,
154-           "zwj"=>8205,
155-           "lrm"=>8206,
156-           "rlm"=>8207,
157-           "ndash"=>8211,
158-           "mdash"=>8212,
159-           "lsquo"=>8216,
160-           "rsquo"=>8217,
161-           "sbquo"=>8218,
162-           "ldquo"=>8220,
163-           "rdquo"=>8221,
164-           "bdquo"=>8222,
165-           "dagger"=>8224,
166-           "Dagger"=>8225,
167-           "permil"=>8240,
168-           "lsaquo"=>8249,
169-           "rsaquo"=>8250,
170-           "euro"=>8364,
171-           "fnof"=>402,
172-           "Alpha"=>913,
173-           "Beta"=>914,
174-           "Gamma"=>915,
175-           "Delta"=>916,
176-           "Epsilon"=>917,
177-           "Zeta"=>918,
178-           "Eta"=>919,
179-           "Theta"=>920,
180-           "Iota"=>921,
181-           "Kappa"=>922,
182-           "Lambda"=>923,
183-           "Mu"=>924,
184-           "Nu"=>925,
185-           "Xi"=>926,
186-           "Omicron"=>927,
187-           "Pi"=>928,
188-           "Rho"=>929,
189-           "Sigma"=>931,
190-           "Tau"=>932,
191-           "Upsilon"=>933,
192-           "Phi"=>934,
193-           "Chi"=>935,
194-           "Psi"=>936,
195-           "Omega"=>937,
196-           "alpha"=>945,
197-           "beta"=>946,
198-           "gamma"=>947,
199-           "delta"=>948,
200-           "epsilon"=>949,
201-           "zeta"=>950,
202-           "eta"=>951,
203-           "theta"=>952,
204-           "iota"=>953,
205-           "kappa"=>954,
206-           "lambda"=>955,
207-           "mu"=>956,
208-           "nu"=>957,
209-           "xi"=>958,
210-           "omicron"=>959,
211-           "pi"=>960,
212-           "rho"=>961,
213-           "sigmaf"=>962,
214-           "sigma"=>963,
215-           "tau"=>964,
216-           "upsilon"=>965,
217-           "phi"=>966,
218-           "chi"=>967,
219-           "psi"=>968,
220-           "omega"=>969,
221-           "thetasym"=>977,
222-           "upsih"=>978,
223-           "piv"=>982,
224-           "bull"=>8226,
225-           "hellip"=>8230,
226-           "prime"=>8242,
227-           "Prime"=>8243,
228-           "oline"=>8254,
229-           "frasl"=>8260,
230-           "weierp"=>8472,
231-           "image"=>8465,
232-           "real"=>8476,
233-           "trade"=>8482,
234-           "alefsym"=>8501,
235-           "larr"=>8592,
236-           "uarr"=>8593,
237-           "rarr"=>8594,
238-           "darr"=>8595,
239-           "harr"=>8596,
240-           "crarr"=>8629,
241-           "lArr"=>8656,
242-           "uArr"=>8657,
243-           "rArr"=>8658,
244-           "dArr"=>8659,
245-           "hArr"=>8660,
246-           "forall"=>8704,
247-           "part"=>8706,
248-           "exist"=>8707,
249-           "empty"=>8709,
250-           "nabla"=>8711,
251-           "isin"=>8712,
252-           "notin"=>8713,
253-           "ni"=>8715,
254-           "prod"=>8719,
255-           "sum"=>8721,
256-           "minus"=>8722,
257-           "lowast"=>8727,
258-           "radic"=>8730,
259-           "prop"=>8733,
260-           "infin"=>8734,
261-           "ang"=>8736,
262-           "and"=>8743,
263-           "or"=>8744,
264-           "cap"=>8745,
265-           "cup"=>8746,
266-           "int"=>8747,
267-           "there4"=>8756,
268-           "sim"=>8764,
269-           "cong"=>8773,
270-           "asymp"=>8776,
271-           "ne"=>8800,
272-           "equiv"=>8801,
273-           "le"=>8804,
274-           "ge"=>8805,
275-           "sub"=>8834,
276-           "sup"=>8835,
277-           "nsub"=>8836,
278-           "sube"=>8838,
279-           "supe"=>8839,
280-           "oplus"=>8853,
281-           "otimes"=>8855,
282-           "perp"=>8869,
283-           "sdot"=>8901,
284-           "lceil"=>8968,
285-           "rceil"=>8969,
286-           "lfloor"=>8970,
287-           "rfloor"=>8971,
288-           "lang"=>9001,
289-           "rang"=>9002,
290-           "loz"=>9674,
291-           "spades"=>9824,
292-           "clubs"=>9827,
293-           "hearts"=>9829,
294-           "diams"=>9830,
295-           );
296-  foreach($html_named_entities_mapping as $name => $value) {
297-    $content=str_replace('&'.$name.';','&#'.$value.';',$content);
298-  } 
299-  return $content;
300-
301-}
302-
303 function funky_javascript_fix($text) {
304        // Fixes for browsers' javascript bugs
305        global $is_macIE, $is_winIE;