回调wp_kses_bad_protocol_once()正则表达式。
原型
wp_kses_bad_protocol_once2( string $string, string $allowed_protocols )
描述
此功能处理URL协议,检查它们是否在白名单中,并根据答案返回不同的数据。
参数
$string
(string)
(Required)
用于检查白名单的URI方案
$allowed_protocols
(string)
(Required)
允许的协议
返回值
(string)
消毒内容
源文件
路径:wp-includes/kses.php
<?php
...
function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) {
$string2 = wp_kses_decode_entities($string);
$string2 = preg_replace('/s/', '', $string2);
$string2 = wp_kses_no_null($string2);
$string2 = strtolower($string2);
$allowed = false;
foreach ( (array) $allowed_protocols as $one_protocol )
if ( strtolower($one_protocol) == $string2 ) {
$allowed = true;
break;
}
if ($allowed)
return "$string2:";
else
return '';
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_kses_bad_protocol_once2/