清除坏协议和其他角色的内容。
原型
wp_kses_bad_protocol_once( string $string, string $allowed_protocols, $count = 1 )
描述
此函数在$ string的开头搜索URL协议,同时处理空白和HTML实体。
参数
$string
(string)
(Required)
用于检查错误协议的内容
$allowed_protocols
(string)
(Required)
允许的协议
返回值
(string)
消毒内容
源文件
路径:wp-includes/kses.php
<?php
...
function wp_kses_bad_protocol_once($string, $allowed_protocols, $count = 1 ) {
$string2 = preg_split( '/:|�*58;|�*3a;/i', $string, 2 );
if ( isset($string2[1]) && ! preg_match('%/?%', $string2[0]) ) {
$string = trim( $string2[1] );
$protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols );
if ( 'feed:' == $protocol ) {
if ( $count > 2 )
return '';
$string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count );
if ( empty( $string ) )
return $string;
}
$string = $protocol . $string;
}
return $string;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_kses_bad_protocol_once/