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 r...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== 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.
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 ==
== Usage ==
== 用法 ==
%%% <?php wp_kses($string, $allowed_html, $allowed_protocols); ?> %%%
%%% <?php wp_kses($string, $allowed_html, $allowed_protocols); ?> %%%
%%% <?php wp_kses($string, $allowed_html, $allowed_protocols); ?> %%%


== Parameters ==
== Parameters ==
== 参数 ==
; <tt>$string</tt>
; <tt>$string</tt>
; <tt>$string</tt>
: (''string'') Content to filter through kses
: (''string'') Content to filter through kses
: (''string'') filter through kses的内容
; <tt>$allowed_html</tt>
; <tt>$allowed_html</tt>
; <tt>$allowed_html</tt>
: (''array'') List of allowed HTML elements
: (''array'') List of allowed HTML elements
: (''array'') 允许的HTML元素的列表
; <tt>$allowed_protocols</tt>
; <tt>$allowed_protocols</tt>
; <tt>$allowed_protocols</tt>
: (''array'') (''optional'') Allow links in <tt>$string</tt> to these protocols.
: (''array'') (''optional'') Allow links in <tt>$string</tt> to these protocols.
: (''array'') (''optional'') Allow links in <tt>$string</tt> 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.  
:: 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 ==
== Return ==
== 返回==
This function returns a filtered string of HTML.
This function returns a filtered string of HTML.
这个函数返回HTML的filtered string。
== Further Reading ==


== Further Reading ==
== 深入阅读 ==


For a comprehensive list of functions, take a look at the [http://codex.wordpress.org/Category:Functions category Functions]
For a comprehensive list of functions, take a look at the [http://codex.wordpress.org/Category:Functions category Functions]
关于完整的函数的列表,请看看[http://codex.wordpress.org/Category:Functions category Functions]


Also, see [[WordPress:Function_Reference]]
Also, see [[WordPress:Function_Reference]]
同时,也看看[[WordPress:Function_Reference|Function_Reference]]

2008年7月22日 (二) 10:36的版本

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