<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[54933] trunk/src/wp-includes/kses.php: Code Modernization: Rename parameters that use reserved keywords in `wp-includes/kses.php`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/54933">54933</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/54933","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-12-05 13:55:20 +0000 (Mon, 05 Dec 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Code Modernization: Rename parameters that use reserved keywords in `wp-includes/kses.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$string` parameter to `$content` in:
* `wp_kses()`
* `wp_kses_hook()`
* `wp_kses_split()`
* `wp_kses_split2()`
* `wp_kses_bad_protocol()`
* `wp_kses_no_null()`
* `wp_kses_stripslashes()`
* `wp_kses_bad_protocol_once()`
* `wp_kses_normalize_entities()`
* `wp_kses_decode_entities()`
* Renames the `$string` parameter to `$attr` in:
* `wp_kses_one_attr()`
* `wp_kses_html_error()`
* Renames the `$match` parameter to `$matches` in:
* `_wp_kses_split_callback()`
* `_wp_kses_decode_entities_chr()`
* `_wp_kses_decode_entities_chr_hexdec()`
* Renames the `$string` parameter to `$scheme` in `wp_kses_bad_protocol_once2()`.
Follow-up to <a href="https://core.trac.wordpress.org/changeset/52946">[52946]</a>, <a href="https://core.trac.wordpress.org/changeset/52996">[52996]</a>, <a href="https://core.trac.wordpress.org/changeset/52997">[52997]</a>, <a href="https://core.trac.wordpress.org/changeset/52998">[52998]</a>, <a href="https://core.trac.wordpress.org/changeset/53003">[53003]</a>, <a href="https://core.trac.wordpress.org/changeset/53014">[53014]</a>, <a href="https://core.trac.wordpress.org/changeset/53029">[53029]</a>, <a href="https://core.trac.wordpress.org/changeset/53039">[53039]</a>, <a href="https://core.trac.wordpress.org/changeset/53116">[53116]</a>, <a href="https://core.trac.wordpress.org/changeset/53117">[53117]</a>, <a href="https://core.trac.wordpress.org/changeset/53137">[53137]</a>, <a href="https://core.trac.wordpress.org/changeset/53174">[53174]</a>, <a href="https://core.trac.wordpress.org/changeset/53184">[53184]</a>, <a href="https://core.trac.wordpress.org/changeset/53185">[531
85]</a>, <a href="https://core.trac.wordpress.org/changeset/53192">[53192]</a>, <a href="https://core.trac.wordpress.org/changeset/53193">[53193]</a>, <a href="https://core.trac.wordpress.org/changeset/53198">[53198]</a>, <a href="https://core.trac.wordpress.org/changeset/53203">[53203]</a>, <a href="https://core.trac.wordpress.org/changeset/53207">[53207]</a>, <a href="https://core.trac.wordpress.org/changeset/53215">[53215]</a>, <a href="https://core.trac.wordpress.org/changeset/53216">[53216]</a>, <a href="https://core.trac.wordpress.org/changeset/53220">[53220]</a>, <a href="https://core.trac.wordpress.org/changeset/53230">[53230]</a>, <a href="https://core.trac.wordpress.org/changeset/53232">[53232]</a>, <a href="https://core.trac.wordpress.org/changeset/53236">[53236]</a>, <a href="https://core.trac.wordpress.org/changeset/53239">[53239]</a>, <a href="https://core.trac.wordpress.org/changeset/53240">[53240]</a>, <a href="https://core.trac.wordpress.org/changeset/53242">[53242]
</a>, <a href="https://core.trac.wordpress.org/changeset/53243">[53243]</a>, <a href="https://core.trac.wordpress.org/changeset/53245">[53245]</a>, <a href="https://core.trac.wordpress.org/changeset/53246">[53246]</a>, <a href="https://core.trac.wordpress.org/changeset/53257">[53257]</a>, <a href="https://core.trac.wordpress.org/changeset/53269">[53269]</a>, <a href="https://core.trac.wordpress.org/changeset/53270">[53270]</a>, <a href="https://core.trac.wordpress.org/changeset/53271">[53271]</a>, <a href="https://core.trac.wordpress.org/changeset/53272">[53272]</a>, <a href="https://core.trac.wordpress.org/changeset/53273">[53273]</a>, <a href="https://core.trac.wordpress.org/changeset/53274">[53274]</a>, <a href="https://core.trac.wordpress.org/changeset/53275">[53275]</a>, <a href="https://core.trac.wordpress.org/changeset/53276">[53276]</a>, <a href="https://core.trac.wordpress.org/changeset/53277">[53277]</a>, <a href="https://core.trac.wordpress.org/changeset/53281">[53281]</a
>, <a href="https://core.trac.wordpress.org/changeset/53283">[53283]</a>, <a href="https://core.trac.wordpress.org/changeset/53284">[53284]</a>, <a href="https://core.trac.wordpress.org/changeset/53285">[53285]</a>, <a href="https://core.trac.wordpress.org/changeset/53287">[53287]</a>, <a href="https://core.trac.wordpress.org/changeset/53364">[53364]</a>, <a href="https://core.trac.wordpress.org/changeset/53365">[53365]</a>, <a href="https://core.trac.wordpress.org/changeset/54927">[54927]</a>, <a href="https://core.trac.wordpress.org/changeset/54929">[54929]</a>, <a href="https://core.trac.wordpress.org/changeset/54930">[54930]</a>, <a href="https://core.trac.wordpress.org/changeset/54931">[54931]</a>, <a href="https://core.trac.wordpress.org/changeset/54932">[54932]</a>.
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See <a href="https://core.trac.wordpress.org/ticket/56788">#56788</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesksesphp">trunk/src/wp-includes/kses.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesksesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/kses.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/kses.php 2022-12-04 13:20:50 UTC (rev 54932)
+++ trunk/src/wp-includes/kses.php 2022-12-05 13:55:20 UTC (rev 54933)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -736,7 +736,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Text content to filter.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Text content to filter.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
</span><span class="cx" style="display: block; padding: 0 10px"> * or a context name such as 'post'. See wp_kses_allowed_html()
</span><span class="cx" style="display: block; padding: 0 10px"> * for the list of accepted context names.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -744,16 +744,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Defaults to the result of wp_allowed_protocols().
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Filtered content containing only the allowed HTML.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses( $content, $allowed_html, $allowed_protocols = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $allowed_protocols ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed_protocols = wp_allowed_protocols();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
- $string = wp_kses_normalize_entities( $string );
- $string = wp_kses_hook( $string, $allowed_html, $allowed_protocols );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = wp_kses_no_null( $content, array( 'slash_zero' => 'keep' ) );
+ $content = wp_kses_normalize_entities( $content );
+ $content = wp_kses_hook( $content, $allowed_html, $allowed_protocols );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return wp_kses_split( $string, $allowed_html, $allowed_protocols );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return wp_kses_split( $content, $allowed_html, $allowed_protocols );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -763,36 +763,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.3
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string The 'whole' attribute, including name and value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $attr The 'whole' attribute, including name and value.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $element The HTML element name to which the attribute belongs.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Filtered attribute.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_one_attr( $string, $element ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_one_attr( $attr, $element ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $uris = wp_kses_uri_attributes();
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed_html = wp_kses_allowed_html( 'post' );
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed_protocols = wp_allowed_protocols();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attr = wp_kses_no_null( $attr, array( 'slash_zero' => 'keep' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Preserve leading and trailing whitespace.
</span><span class="cx" style="display: block; padding: 0 10px"> $matches = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- preg_match( '/^\s*/', $string, $matches );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ preg_match( '/^\s*/', $attr, $matches );
</ins><span class="cx" style="display: block; padding: 0 10px"> $lead = $matches[0];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- preg_match( '/\s*$/', $string, $matches );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ preg_match( '/\s*$/', $attr, $matches );
</ins><span class="cx" style="display: block; padding: 0 10px"> $trail = $matches[0];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $trail ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = substr( $string, strlen( $lead ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attr = substr( $attr, strlen( $lead ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = substr( $string, strlen( $lead ), -strlen( $trail ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attr = substr( $attr, strlen( $lead ), -strlen( $trail ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Parse attribute name and value from input.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $split = preg_split( '/\s*=\s*/', $string, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $split = preg_split( '/\s*=\s*/', $attr, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px"> $name = $split[0];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( count( $split ) == 2 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $value = $split[1];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove quotes surrounding $value.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Also guarantee correct quoting in $string for this one attribute.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Also guarantee correct quoting in $attr for this one attribute.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( '' === $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $quote = '';
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -815,8 +815,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $value = wp_kses_bad_protocol( $value, $allowed_protocols );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = "$name=$quote$value$quote";
- $vless = 'n';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attr = "$name=$quote$value$quote";
+ $vless = 'n';
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $value = '';
</span><span class="cx" style="display: block; padding: 0 10px"> $vless = 'y';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -823,10 +823,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Sanitize attribute by name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_kses_attr_check( $name, $value, $attr, $vless, $element, $allowed_html );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Restore whitespace.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $lead . $string . $trail;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $lead . $attr . $trail;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -922,7 +922,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to filter through KSES.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to filter through KSES.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
</span><span class="cx" style="display: block; padding: 0 10px"> * or a context name such as 'post'. See wp_kses_allowed_html()
</span><span class="cx" style="display: block; padding: 0 10px"> * for the list of accepted context names.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -929,19 +929,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Filtered content through {@see 'pre_kses'} hook.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_hook( $content, $allowed_html, $allowed_protocols ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters content to be run through KSES.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to filter through KSES.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to filter through KSES.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
</span><span class="cx" style="display: block; padding: 0 10px"> * or a context name such as 'post'. See wp_kses_allowed_html()
</span><span class="cx" style="display: block; padding: 0 10px"> * for the list of accepted context names.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return apply_filters( 'pre_kses', $content, $allowed_html, $allowed_protocols );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -966,7 +966,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * or a context name such as 'post'.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $pass_allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to filter.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to filter.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
</span><span class="cx" style="display: block; padding: 0 10px"> * or a context name such as 'post'. See wp_kses_allowed_html()
</span><span class="cx" style="display: block; padding: 0 10px"> * for the list of accepted context names.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -973,13 +973,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Content with fixed HTML tags
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_split( $content, $allowed_html, $allowed_protocols ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $pass_allowed_html, $pass_allowed_protocols;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $pass_allowed_html = $allowed_html;
</span><span class="cx" style="display: block; padding: 0 10px"> $pass_allowed_protocols = $allowed_protocols;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1043,13 +1043,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * or a context name such as 'post'.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $pass_allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $match preg_replace regexp matches
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $matches preg_replace regexp matches
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function _wp_kses_split_callback( $match ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _wp_kses_split_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $pass_allowed_html, $pass_allowed_protocols;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return wp_kses_split2( $match[0], $pass_allowed_html, $pass_allowed_protocols );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return wp_kses_split2( $matches[0], $pass_allowed_html, $pass_allowed_protocols );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1068,7 +1068,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ignore
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to filter.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to filter.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array[]|string $allowed_html An array of allowed HTML elements and attributes,
</span><span class="cx" style="display: block; padding: 0 10px"> * or a context name such as 'post'. See wp_kses_allowed_html()
</span><span class="cx" style="display: block; padding: 0 10px"> * for the list of accepted context names.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1075,32 +1075,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Fixed HTML element
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) {
- $string = wp_kses_stripslashes( $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_split2( $content, $allowed_html, $allowed_protocols ) {
+ $content = wp_kses_stripslashes( $content );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // It matched a ">" character.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( '<' !== substr( $string, 0, 1 ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '<' !== substr( $content, 0, 1 ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return '>';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Allow HTML comments.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( '<!--' === substr( $string, 0, 4 ) ) {
- $string = str_replace( array( '<!--', '-->' ), '', $string );
- while ( ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) != $string ) {
- $string = $newstring;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '<!--' === substr( $content, 0, 4 ) ) {
+ $content = str_replace( array( '<!--', '-->' ), '', $content );
+ while ( ( $newstring = wp_kses( $content, $allowed_html, $allowed_protocols ) ) != $content ) {
+ $content = $newstring;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( '' === $string ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '' === $content ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> // Prevent multiple dashes in comments.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace( '/--+/', '-', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = preg_replace( '/--+/', '-', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> // Prevent three dashes closing a comment.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace( '/-$/', '', $string );
- return "<!--{$string}-->";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = preg_replace( '/-$/', '', $content );
+ return "<!--{$content}-->";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // It's seriously malformed.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! preg_match( '%^<\s*(/\s*)?([a-zA-Z0-9-]+)([^>]*)>?$%', $string, $matches ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! preg_match( '%^<\s*(/\s*)?([a-zA-Z0-9-]+)([^>]*)>?$%', $content, $matches ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1681,24 +1681,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to filter bad protocols from.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to filter bad protocols from.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Filtered content.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_bad_protocol( $string, $allowed_protocols ) {
- $string = wp_kses_no_null( $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_bad_protocol( $content, $allowed_protocols ) {
+ $content = wp_kses_no_null( $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> $iterations = 0;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> do {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $original_string = $string;
- $string = wp_kses_bad_protocol_once( $string, $allowed_protocols );
- } while ( $original_string != $string && ++$iterations < 6 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $original_content = $content;
+ $content = wp_kses_bad_protocol_once( $content, $allowed_protocols );
+ } while ( $original_content != $content && ++$iterations < 6 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $original_string != $string ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $original_content != $content ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1708,21 +1708,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to filter null characters from.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to filter null characters from.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $options Set 'slash_zero' => 'keep' when '\0' is allowed. Default is 'remove'.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Filtered content.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_no_null( $string, $options = null ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_no_null( $content, $options = null ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $options['slash_zero'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $options = array( 'slash_zero' => 'remove' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'remove' === $options['slash_zero'] ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace( '/\\\\+0+/', '', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = preg_replace( '/\\\\+0+/', '', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1733,11 +1733,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string String to strip slashes from.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content String to strip slashes from.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Fixed string with quoted slashes.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_stripslashes( $string ) {
- return preg_replace( '%\\\\"%', '"', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_stripslashes( $content ) {
+ return preg_replace( '%\\\\"%', '"', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1772,11 +1772,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $attr
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_html_error( $string ) {
- return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_html_error( $attr ) {
+ return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $attr );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1787,30 +1787,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to check for bad protocols.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to check for bad protocols.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $count Depth of call recursion to this function.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Sanitized content.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_bad_protocol_once( $string, $allowed_protocols, $count = 1 ) {
- $string = preg_replace( '/(�*58(?![;0-9])|�*3a(?![;a-f0-9]))/i', '$1;', $string );
- $string2 = preg_split( '/:|�*58;|�*3a;|:/i', $string, 2 );
- if ( isset( $string2[1] ) && ! preg_match( '%/\?%', $string2[0] ) ) {
- $string = trim( $string2[1] );
- $protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_bad_protocol_once( $content, $allowed_protocols, $count = 1 ) {
+ $content = preg_replace( '/(�*58(?![;0-9])|�*3a(?![;a-f0-9]))/i', '$1;', $content );
+ $content2 = preg_split( '/:|�*58;|�*3a;|:/i', $content, 2 );
+
+ if ( isset( $content2[1] ) && ! preg_match( '%/\?%', $content2[0] ) ) {
+ $content = trim( $content2[1] );
+ $protocol = wp_kses_bad_protocol_once2( $content2[0], $allowed_protocols );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'feed:' === $protocol ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $count > 2 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count );
- if ( empty( $string ) ) {
- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = wp_kses_bad_protocol_once( $content, $allowed_protocols, ++$count );
+ if ( empty( $content ) ) {
+ return $content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = $protocol . $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = $protocol . $content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1824,19 +1825,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ignore
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string URI scheme to check against the list of allowed protocols.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $scheme URI scheme to check against the list of allowed protocols.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $allowed_protocols Array of allowed URL protocols.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Sanitized content.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) {
- $string2 = wp_kses_decode_entities( $string );
- $string2 = preg_replace( '/\s/', '', $string2 );
- $string2 = wp_kses_no_null( $string2 );
- $string2 = strtolower( $string2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_bad_protocol_once2( $scheme, $allowed_protocols ) {
+ $scheme = wp_kses_decode_entities( $scheme );
+ $scheme = preg_replace( '/\s/', '', $scheme );
+ $scheme = wp_kses_no_null( $scheme );
+ $scheme = strtolower( $scheme );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed = false;
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $allowed_protocols as $one_protocol ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strtolower( $one_protocol ) == $string2 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( strtolower( $one_protocol ) == $scheme ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $allowed = true;
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1843,7 +1844,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $allowed ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return "$string2:";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return "$scheme:";
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1861,25 +1862,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.5.0 Added `$context` parameter.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to normalize entities.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to normalize entities.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $context Context for normalization. Can be either 'html' or 'xml'.
</span><span class="cx" style="display: block; padding: 0 10px"> * Default 'html'.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Content with normalized entities.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_normalize_entities( $string, $context = 'html' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_normalize_entities( $content, $context = 'html' ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Disarm all entities by converting & to &
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = str_replace( '&', '&', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = str_replace( '&', '&', $content );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Change back the allowed entities in our list of allowed entities.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'xml' === $context ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_xml_named_entities', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_xml_named_entities', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace_callback( '/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string );
- $string = preg_replace_callback( '/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = preg_replace_callback( '/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $content );
+ $content = preg_replace_callback( '/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $content );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2014,14 +2015,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $string Content to change entities.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to change entities.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Content after decoded entities.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_kses_decode_entities( $string ) {
- $string = preg_replace_callback( '/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string );
- $string = preg_replace_callback( '/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_kses_decode_entities( $content ) {
+ $content = preg_replace_callback( '/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $content );
+ $content = preg_replace_callback( '/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $content );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2031,11 +2032,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> * @ignore
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $match preg match
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $matches preg match
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function _wp_kses_decode_entities_chr( $match ) {
- return chr( $match[1] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _wp_kses_decode_entities_chr( $matches ) {
+ return chr( $matches[1] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2045,11 +2046,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> * @ignore
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $match preg match
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $matches preg match
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function _wp_kses_decode_entities_chr_hexdec( $match ) {
- return chr( hexdec( $match[1] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _wp_kses_decode_entities_chr_hexdec( $matches ) {
+ return chr( hexdec( $matches[1] ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre>
</div>
</div>
</body>
</html>