Inline documentation for hooks in wp-includes/kses.php.
props siobhyb, DrewAPicture. fixes #25800. Built from https://develop.svn.wordpress.org/trunk@27739 git-svn-id: http://core.svn.wordpress.org/trunk@27576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f5999e5d50
commit
fbbc31f3c5
|
@ -501,27 +501,42 @@ function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {
|
||||||
function wp_kses_allowed_html( $context = '' ) {
|
function wp_kses_allowed_html( $context = '' ) {
|
||||||
global $allowedposttags, $allowedtags, $allowedentitynames;
|
global $allowedposttags, $allowedtags, $allowedentitynames;
|
||||||
|
|
||||||
if ( is_array( $context ) )
|
if ( is_array( $context ) ) {
|
||||||
|
/**
|
||||||
|
* Filter HTML elements allowed for a given context.
|
||||||
|
*
|
||||||
|
* @since 3.5.0
|
||||||
|
*
|
||||||
|
* @param string $tags Allowed tags, attributes, and/or entities.
|
||||||
|
* @param string $context Context to judge allowed tags by. Allowed values are 'post',
|
||||||
|
* 'data', 'strip', 'entities', 'explicit', or the name of a filter.
|
||||||
|
*/
|
||||||
return apply_filters( 'wp_kses_allowed_html', $context, 'explicit' );
|
return apply_filters( 'wp_kses_allowed_html', $context, 'explicit' );
|
||||||
|
}
|
||||||
|
|
||||||
switch ( $context ) {
|
switch ( $context ) {
|
||||||
case 'post':
|
case 'post':
|
||||||
|
/** This filter is documented in wp-includes/kses.php */
|
||||||
return apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
|
return apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
|
||||||
break;
|
break;
|
||||||
case 'user_description':
|
case 'user_description':
|
||||||
case 'pre_user_description':
|
case 'pre_user_description':
|
||||||
$tags = $allowedtags;
|
$tags = $allowedtags;
|
||||||
$tags['a']['rel'] = true;
|
$tags['a']['rel'] = true;
|
||||||
|
/** This filter is documented in wp-includes/kses.php */
|
||||||
return apply_filters( 'wp_kses_allowed_html', $tags, $context );
|
return apply_filters( 'wp_kses_allowed_html', $tags, $context );
|
||||||
break;
|
break;
|
||||||
case 'strip':
|
case 'strip':
|
||||||
|
/** This filter is documented in wp-includes/kses.php */
|
||||||
return apply_filters( 'wp_kses_allowed_html', array(), $context );
|
return apply_filters( 'wp_kses_allowed_html', array(), $context );
|
||||||
break;
|
break;
|
||||||
case 'entities':
|
case 'entities':
|
||||||
|
/** This filter is documented in wp-includes/kses.php */
|
||||||
return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context);
|
return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context);
|
||||||
break;
|
break;
|
||||||
case 'data':
|
case 'data':
|
||||||
default:
|
default:
|
||||||
|
/** This filter is documented in wp-includes/kses.php */
|
||||||
return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
|
return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +555,16 @@ function wp_kses_allowed_html( $context = '' ) {
|
||||||
* @return string Filtered content through 'pre_kses' hook
|
* @return string Filtered content through 'pre_kses' hook
|
||||||
*/
|
*/
|
||||||
function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) {
|
function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) {
|
||||||
$string = apply_filters('pre_kses', $string, $allowed_html, $allowed_protocols);
|
/**
|
||||||
|
* Filter content to be run through kses.
|
||||||
|
*
|
||||||
|
* @since 2.3.0
|
||||||
|
*
|
||||||
|
* @param string $string Content to run through kses.
|
||||||
|
* @param array $allowed_html Allowed HTML elements.
|
||||||
|
* @param array $allowed_protocols Allowed protocol in links.
|
||||||
|
*/
|
||||||
|
$string = apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols );
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,6 +1438,14 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
$css_array = explode( ';', trim( $css ) );
|
$css_array = explode( ';', trim( $css ) );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter list of allowed CSS attributes.
|
||||||
|
*
|
||||||
|
* @since 2.8.1
|
||||||
|
*
|
||||||
|
* @param array $attr List of allowed CSS attributes.
|
||||||
|
*/
|
||||||
$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
|
$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
|
||||||
'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
|
'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
|
||||||
'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
|
'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
|
||||||
|
|
Loading…
Reference in New Issue