Introduce wp_kses_post() and wp_kses_data() for filtering unescaped data. Fixes slashing of displayed fields. fixes #10949

git-svn-id: https://develop.svn.wordpress.org/trunk@12125 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-10-29 17:15:58 +00:00
parent 049955e49b
commit 486efbd69f
2 changed files with 40 additions and 4 deletions
+33 -2
View File
@@ -1059,7 +1059,7 @@ function _wp_kses_decode_entities_chr_hexdec( $match ) {
* @since 1.0.0
* @uses $allowedtags
*
* @param string $data Content to filter
* @param string $data Content to filter, expected to be escaped with slashes
* @return string Filtered content
*/
function wp_filter_kses($data) {
@@ -1067,6 +1067,20 @@ function wp_filter_kses($data) {
return addslashes( wp_kses(stripslashes( $data ), $allowedtags) );
}
/**
* Sanitize content with allowed HTML Kses rules.
*
* @since 2.9.0
* @uses $allowedtags
*
* @param string $data Content to filter, expected to not be escaped
* @return string Filtered content
*/
function wp_kses_data($data) {
global $allowedtags;
return wp_kses( $data , $allowedtags );
}
/**
* Sanitize content for allowed HTML tags for post content.
*
@@ -1076,7 +1090,7 @@ function wp_filter_kses($data) {
* @since 2.0.0
* @uses $allowedposttags
*
* @param string $data Post content to filter
* @param string $data Post content to filter, expected to be escaped with slashes
* @return string Filtered post content with allowed HTML tags and attributes intact.
*/
function wp_filter_post_kses($data) {
@@ -1084,6 +1098,23 @@ function wp_filter_post_kses($data) {
return addslashes ( wp_kses(stripslashes( $data ), $allowedposttags) );
}
/**
* Sanitize content for allowed HTML tags for post content.
*
* Post content refers to the page contents of the 'post' type and not $_POST
* data from forms.
*
* @since 2.9.0
* @uses $allowedposttags
*
* @param string $data Post content to filter
* @return string Filtered post content with allowed HTML tags and attributes intact.
*/
function wp_kses_post($data) {
global $allowedposttags;
return wp_kses( $data , $allowedposttags );
}
/**
* Strips all of the HTML in the content.
*