WordPress函数文档ent2ncr()
将名称实体的字符集转为编号实体的字符集 描述 译文 将名称实体转换为数值型实体 原文 将名称实体(named …
将名称实体的字符集转为编号实体的字符集
描述
译文
将名称实体转换为数值型实体
原文
将名称实体(named entities)的字符集转换成编号实体(numbered entities)的字符集。
用法
<?php ent2ncr( $text ) ?>
参数
$text
(string) (必填) 将转换实体的文本
默认值: None
返回值
(string)
转换实体之后的文本
示例
1
2
3
4
5
6
7
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
<?php
echo ent2ncr(“C’est la fête!”);
// this will output: C’est la fête!
?>
|
看到的是:
1
2
3
4
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
C‘est la fête!
|
历史
添加于 版本: 1.5.1
源文件
ent2ncr() 函数的代码位于 wp-includes/formatting.php
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* Converts named entities into numbered entities.
*
* @since 1.5.1
*
* @param string $text The text within which entities will be converted.
* @return string Text with converted entities.
*/
function ent2ncr( $text ) {
/**
* Filter text before named entities are converted into numbered entities.
*
* A non-null string must be returned for the filter to be evaluated.
*
* @since 3.3.0
*
* @param null $converted_text The text to be converted. Default null.
* @param string $text The text prior to entity conversion.
*/
$filtered = apply_filters( ‘pre_ent2ncr’, null, $text );
if ( null !== $filtered )
return $filtered;
$to_ncr = array(
‘”‘ => ‘”‘,
‘&’ => ‘&’,
‘<‘ => ‘<‘,
‘>’ => ‘>’,
‘|’ => ‘|’,
‘ ‘ => ‘ ‘,
‘¡’ => ‘¡’,
‘¢’ => ‘¢’,
‘£’ => ‘£’,
‘¤’ => ‘¤’,
‘¥’ => ‘¥’,
‘¦’ => ‘¦’,
‘&brkbar;’ => ‘¦’,
‘§’ => ‘§’,
‘¨’ => ‘¨’,
‘¨’ => ‘¨’,
‘©’ => ‘©’,
‘ª’ => ‘ª’,
‘«’ => ‘«’,
‘¬’ => ‘¬’,
‘’ => ‘’,
‘®’ => ‘®’,
‘¯’ => ‘¯’,
‘&hibar;’ => ‘¯’,
‘°’ => ‘°’,
‘±’ => ‘±’,
‘²’ => ‘²’,
‘³’ => ‘³’,
‘´’ => ‘´’,
‘µ’ => ‘µ’,
‘¶’ => ‘¶’,
‘·’ => ‘·’,
‘¸’ => ‘¸’,
‘¹’ => ‘¹’,
‘º’ => ‘º’,
‘»’ => ‘»’,
‘¼’ => ‘¼’,
‘½’ => ‘½’,
‘¾’ => ‘¾’,
‘¿’ => ‘¿’,
‘À’ => ‘À’,
‘Á’ => ‘Á’,
‘Â’ => ‘Â’,
‘Ã’ => ‘Ã’,
‘Ä’ => ‘Ä’,
‘Å’ => ‘Å’,
‘Æ’ => ‘Æ’,
‘Ç’ => ‘Ç’,
‘È’ => ‘È’,
‘É’ => ‘É’,
‘Ê’ => ‘Ê’,
‘Ë’ => ‘Ë’,
‘Ì’ => ‘Ì’,
‘Í’ => ‘Í’,
‘Î’ => ‘Î’,
‘Ï’ => ‘Ï’,
‘Ð’ => ‘Ð’,
‘Ñ’ => ‘Ñ’,
‘Ò’ => ‘Ò’,
‘Ó’ => ‘Ó’,
‘Ô’ => ‘Ô’,
‘Õ’ => ‘Õ’,
‘Ö’ => ‘Ö’,
‘×’ => ‘×’,
‘Ø’ => ‘Ø’,
‘Ù’ => ‘Ù’,
‘Ú’ => ‘Ú’,
‘Û’ => ‘Û’,
‘Ü’ => ‘Ü’,
‘Ý’ => ‘Ý’,
‘Þ’ => ‘Þ’,
‘ß’ => ‘ß’,
‘à’ => ‘à’,
‘á’ => ‘á’,
‘â’ => ‘â’,
‘ã’ => ‘ã’,
‘ä’ => ‘ä’,
‘å’ => ‘å’,
‘æ’ => ‘æ’,
‘ç’ => ‘ç’,
‘è’ => ‘è’,
‘é’ => ‘é’,
‘ê’ => ‘ê’,
‘ë’ => ‘ë’,
‘ì’ => ‘ì’,
‘í’ => ‘í’,
‘î’ => ‘î’,
‘ï’ => ‘ï’,
‘ð’ => ‘ð’,
‘ñ’ => ‘ñ’,
‘ò’ => ‘ò’,
‘ó’ => ‘ó’,
‘ô’ => ‘ô’,
‘õ’ => ‘õ’,
‘ö’ => ‘ö’,
‘÷’ => ‘÷’,
‘ø’ => ‘ø’,
‘ù’ => ‘ù’,
‘ú’ => ‘ú’,
‘û’ => ‘û’,
‘ü’ => ‘ü’,
‘ý’ => ‘ý’,
‘þ’ => ‘þ’,
‘ÿ’ => ‘ÿ’,
‘Œ’ => ‘Œ’,
‘œ’ => ‘œ’,
‘Š’ => ‘Š’,
‘š’ => ‘š’,
‘Ÿ’ => ‘Ÿ’,
‘ƒ’ => ‘ƒ’,
‘ˆ’ => ‘ˆ’,
‘˜’ => ‘˜’,
‘Α’ => ‘Α’,
‘Β’ => ‘Β’,
‘Γ’ => ‘Γ’,
‘Δ’ => ‘Δ’,
‘Ε’ => ‘Ε’,
‘Ζ’ => ‘Ζ’,
‘Η’ => ‘Η’,
‘Θ’ => ‘Θ’,
‘Ι’ => ‘Ι’,
‘Κ’ => ‘Κ’,
‘Λ’ => ‘Λ’,
‘Μ’ => ‘Μ’,
‘Ν’ => ‘Ν’,
‘Ξ’ => ‘Ξ’,
‘Ο’ => ‘Ο’,
‘Π’ => ‘Π’,
‘Ρ’ => ‘Ρ’,
‘Σ’ => ‘Σ’,
‘Τ’ => ‘Τ’,
‘Υ’ => ‘Υ’,
‘Φ’ => ‘Φ’,
‘Χ’ => ‘Χ’,
‘Ψ’ => ‘Ψ’,
‘Ω’ => ‘Ω’,
‘α’ => ‘α’,
‘β’ => ‘β’,
‘γ’ => ‘γ’,
‘δ’ => ‘δ’,
‘ε’ => ‘ε’,
‘ζ’ => ‘ζ’,
‘η’ => ‘η’,
‘θ’ => ‘θ’,
‘ι’ => ‘ι’,
‘κ’ => ‘κ’,
‘λ’ => ‘λ’,
‘μ’ => ‘μ’,
‘ν’ => ‘ν’,
‘ξ’ => ‘ξ’,
‘ο’ => ‘ο’,
‘π’ => ‘π’,
‘ρ’ => ‘ρ’,
‘ς’ => ‘ς’,
‘σ’ => ‘σ’,
‘τ’ => ‘τ’,
‘υ’ => ‘υ’,
‘φ’ => ‘φ’,
‘χ’ => ‘χ’,
‘ψ’ => ‘ψ’,
‘ω’ => ‘ω’,
‘ϑ’ => ‘ϑ’,
‘ϒ’ => ‘ϒ’,
‘ϖ’ => ‘ϖ’,
‘ ’ => ‘ ’,
‘ ’ => ‘ ’,
‘ ’ => ‘ ’,
‘’ => ‘’,
‘’ => ‘’,
‘’ => ‘’,
‘’ => ‘’,
‘–’ => ‘–’,
‘—’ => ‘—’,
‘‘’ => ‘‘’,
‘’’ => ‘’’,
‘‚’ => ‘‚’,
‘“’ => ‘“’,
‘”’ => ‘”’,
‘„’ => ‘„’,
‘†’ => ‘†’,
‘‡’ => ‘‡’,
‘•’ => ‘•’,
‘…’ => ‘…’,
‘‰’ => ‘‰’,
‘′’ => ‘′’,
‘″’ => ‘″’,
‘‹’ => ‘‹’,
‘›’ => ‘›’,
‘‾’ => ‘‾’,
‘⁄’ => ‘⁄’,
‘€’ => ‘€’,
‘ℑ’ => ‘ℑ’,
‘℘’ => ‘℘’,
‘ℜ’ => ‘ℜ’,
‘™’ => ‘™’,
‘ℵ’ => ‘ℵ’,
‘↵’ => ‘↵’,
‘⇐’ => ‘⇐’,
‘⇑’ => ‘⇑’,
‘⇒’ => ‘⇒’,
‘⇓’ => ‘⇓’,
‘⇔’ => ‘⇔’,
‘∀’ => ‘∀’,
‘∂’ => ‘∂’,
‘∃’ => ‘∃’,
‘∅’ => ‘∅’,
‘∇’ => ‘∇’,
‘∈’ => ‘∈’,
‘∉’ => ‘∉’,
‘∋’ => ‘∋’,
‘∏’ => ‘∏’,
‘∑’ => ‘∑’,
‘−’ => ‘−’,
‘∗’ => ‘∗’,
‘√’ => ‘√’,
‘∝’ => ‘∝’,
‘∞’ => ‘∞’,
‘∠’ => ‘∠’,
‘∧’ => ‘∧’,
‘∨’ => ‘∨’,
‘∩’ => ‘∩’,
‘∪’ => ‘∪’,
‘∫’ => ‘∫’,
‘∴’ => ‘∴’,
‘∼’ => ‘∼’,
‘≅’ => ‘≅’,
‘≈’ => ‘≈’,
‘≠’ => ‘≠’,
‘≡’ => ‘≡’,
‘≤’ => ‘≤’,
‘≥’ => ‘≥’,
‘⊂’ => ‘⊂’,
‘⊃’ => ‘⊃’,
‘⊄’ => ‘⊄’,
‘⊆’ => ‘⊆’,
‘⊇’ => ‘⊇’,
‘⊕’ => ‘⊕’,
‘⊗’ => ‘⊗’,
‘⊥’ => ‘⊥’,
‘⋅’ => ‘⋅’,
‘⌈’ => ‘⌈’,
‘⌉’ => ‘⌉’,
‘⌊’ => ‘⌊’,
‘⌋’ => ‘⌋’,
‘〈’ => ‘〈’,
‘〉’ => ‘〉’,
‘←’ => ‘←’,
‘↑’ => ‘↑’,
‘→’ => ‘→’,
‘↓’ => ‘↓’,
‘↔’ => ‘↔’,
‘◊’ => ‘◊’,
‘♠’ => ‘♠’,
‘♣’ => ‘♣’,
‘♥’ => ‘♥’,
‘♦’ => ‘♦’
);
return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
}
|
- 原文:http://codex.wordpress.org/Function_Reference/ent2ncr
类别:WordPress函数文档、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!