wp_kses_decode_entities()
wp_kses_decode_entities( string $string ) 将所有数值HTML实体转换…
wp_kses_decode_entities( string $string )
将所有数值HTML实体转换为其命名对应实体。
Converts all numeric HTML entities to their named counterparts.
将所有数值HTML实体转换为其命名对应实体。
Converts all numeric HTML entities to their named counterparts.
目录锚点:#说明#参数#源码
说明(Description)
此函数用于解码数字HTML实体(A和A)。它对命名实体(如ä;)没有任何作用,但我们在URL协议白名单系统中也不需要它们。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $string | (string) | 更改实体的内容。 |
源码(Source)
/**
* Convert all entities to their character counterparts.
*
* This function decodes numeric HTML entities (`A` and `A`).
* It doesn't do anything with other entities like ä, but we don't
* need them in the URL protocol whitelisting system anyway.
*
* @since 1.0.0
*
* @param string $string Content to change entities
* @return string Content after decoded entities
*/
function wp_kses_decode_entities($string) {
$string = preg_replace_callback('/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string);
$string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string);
return $string;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.0.0 | wp-includes/kses.php | 11 | 13 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!