发布时间:2020-09-17
WordPress 常用函数 / wp_kses_bad_protocol,
清理字符串,删除错误的 URL 协议。
这个函数删除 $string 开头的不允许的协议,它会忽略空格和字符的大小写,和能够处理 HTML 实体。并且它是在一个 While 循环中运行,所以不会被 ‘javascript:javascript:alert(57)’ 这样的字符串给欺骗了。
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
<?php wp_kses_bad_protocol( $string, $allowed_protocols ); ?>
$string
(string) (required) 需要过滤错误 URL 协议的字符串
Default: None
$allowed_protocols
(array) (required) 允许的协议
Default: None
(string)
过滤之后的字符串
Since: 1.0.0
wp-includes/kses.php
全站搜索