Docs: Move inline comments in `wp_kses_split2()` before the blocks they apply to.

See #42505.
Built from https://develop.svn.wordpress.org/trunk@42712


git-svn-id: http://core.svn.wordpress.org/trunk@42540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-02-14 11:46:33 +00:00
parent d9f222f740
commit 5d1e06f939
2 changed files with 6 additions and 6 deletions

View File

@ -971,11 +971,12 @@ function _wp_kses_split_callback( $match ) {
function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) {
$string = wp_kses_stripslashes( $string );
// It matched a ">" character.
if ( substr( $string, 0, 1 ) != '<' ) {
return '&gt;';
}
// It matched a ">" character
// Allow HTML comments.
if ( '<!--' == substr( $string, 0, 4 ) ) {
$string = str_replace( array( '<!--', '-->' ), '', $string );
while ( $string != ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) ) {
@ -990,12 +991,11 @@ function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) {
$string = preg_replace( '/-$/', '', $string );
return "<!--{$string}-->";
}
// Allow HTML comments
// It's seriously malformed.
if ( ! preg_match( '%^<\s*(/\s*)?([a-zA-Z0-9-]+)([^>]*)>?$%', $string, $matches ) ) {
return '';
}
// It's seriously malformed
$slash = trim( $matches[1] );
$elem = $matches[2];
@ -1005,15 +1005,15 @@ function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) {
$allowed_html = wp_kses_allowed_html( $allowed_html );
}
// They are using a not allowed HTML element.
if ( ! isset( $allowed_html[ strtolower( $elem ) ] ) ) {
return '';
}
// They are using a not allowed HTML element
// No attributes are allowed for closing elements.
if ( $slash != '' ) {
return "</$elem>";
}
// No attributes are allowed for closing elements
return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols );
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42711';
$wp_version = '5.0-alpha-42712';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.