wp_kses_bad_protocol_once2()
wp_kses_bad_protocol_once2( string $string, string $all…
wp_kses_bad_protocol_once2( string $string, string $allowed_protocols )
wp_kses_bad_protocol_once()正则表达式的回调。
Callback for wp_kses_bad_protocol_once() regular expression.
目录锚点:#说明#参数#源码
说明(Description)
这个函数处理URL协议,检查它们是否在白名单中,并根据答案返回不同的数据。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $string | (string) | 检查白名单的URI方案 |
| $allowed_protocols | (string) | 允许的协议 |
源码(Source)
/**
* Callback for wp_kses_bad_protocol_once() regular expression.
*
* This function processes URL protocols, checks to see if they're in the
* whitelist or not, and returns different data depending on the answer.
*
* @access private
* @since 1.0.0
*
* @param string $string URI scheme to check against the whitelist
* @param string $allowed_protocols Allowed protocols
* @return string Sanitized content
*/
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 '';
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.0.0 | wp-includes/kses.php | 7 | 10 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

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