wp_kses_split()
wp_kses_split( string $string, array $allowed_html, str…
wp_kses_split( string $string, array $allowed_html, string[] $allowed_protocols )
搜索HTML标记,无论其格式如何错误。
Searches for HTML tags, no matter how malformed.
搜索HTML标记,无论其格式如何错误。
Searches for HTML tags, no matter how malformed.
目录锚点:#说明#参数#源码#笔记
说明(Description)
它也匹配流浪>字符。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $string | (string) | 要筛选的内容。 |
| $allowed_html | (array) | 允许的HTML元素。 |
| $allowed_protocols | (string[]) | 允许的URL协议数组。 |
源码(Source)
/**
* Searches for HTML tags, no matter how malformed.
*
* It also matches stray ">" characters.
*
* @since 1.0.0
*
* @global array $pass_allowed_html
* @global array $pass_allowed_protocols
*
* @param string $string Content to filter
* @param array $allowed_html Allowed HTML elements
* @param array $allowed_protocols Allowed protocols to keep
* @return string Content with fixed HTML tags
*/
function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
global $pass_allowed_html, $pass_allowed_protocols;
$pass_allowed_html = $allowed_html;
$pass_allowed_protocols = $allowed_protocols;
return preg_replace_callback( '%(|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.0.0 | wp-includes/kses.php | 9 | 13 |
笔记(Notes)
使用
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!