WordPress:Function Reference/wp kses
来自站长百科
Description
描述
This function makes sure that only the allowed HTML element names, attribute names and attribute values plus only sane HTML entities will occur in $string. You have to remove any slashes from PHP's magic quotes before you call this function.
这个函数确定$string中只会出现允许的HTML元素名称,属性名称,属性参数值而且健全的HTML entities。你要将PHP引号中删除所有斜线,然后你才能够调用这个函数。
Usage
用法
%%% <?php wp_kses($string, $allowed_html, $allowed_protocols); ?> %%%
%%% <?php wp_kses($string, $allowed_html, $allowed_protocols); ?> %%%
Parameters
参数
- $string
- $string
- (string) Content to filter through kses
- (string) filter through kses的内容
- $allowed_html
- $allowed_html
- (array) List of allowed HTML elements
- (array) 允许的HTML元素的列表
- $allowed_protocols
- $allowed_protocols
- (array) (optional) Allow links in $string to these protocols.
- (array) (optional) Allow links in $string to these protocols.
- The default allowed protocols are http, https, ftp, mailto, news, irc, gopher, nntp, feed, and telnet. This covers all common link protocols, except for javascript, which should not be allowed for untrusted users.
- 默认允许的协议是http, https, ftp, mailto, news, irc, gopher, nntp, feed,和telnet。这包含了所有普通的链接协议,javascript除外,没有信任度的用户不能够使用javascript。
Return
返回
This function returns a filtered string of HTML. 这个函数返回HTML的filtered string。
Further Reading
深入阅读
For a comprehensive list of functions, take a look at the category Functions
关于完整的函数的列表,请看看category Functions
Also, see WordPress:Function_Reference
同时,也看看Function_Reference