<!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>[54927] trunk/src/wp-includes/formatting.php: Code Modernization: Rename parameters that use reserved keywords in `wp-includes/formatting.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/54927">54927</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/54927","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-02 18:51:56 +0000 (Fri, 02 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/formatting.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 `$text` in:
* `_wp_specialchars()`
* `wp_specialchars_decode()`
* `wp_check_invalid_utf8()`
* `remove_accents()`
* `_split_str_by_whitespace()`
* `wp_strip_all_tags()`
* Renames the `$string` parameter to `$value` in:
* `backslashit()`
* `trailingslashit()`
* `untrailingslashit()`
* Renames the `$string` parameter to `$subject` in `wp_iso_descrambler()`.
* Renames the `$match` parameter to `$matches` in `_wp_iso_convert()`.
* Renames the `$string` parameter to `$date_string` in:
* `get_gmt_from_date()`
* `get_date_from_gmt()`
* Renames the `$string` parameter to`$input` in `wp_parse_str()`.
* Renames the `$string` parameter to `$content` in `wp_pre_kses_block_attributes()`.
* Amends the `$text` parameter in `wp_pre_kses_less_than()` for consistency.
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>.
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="#trunksrcwpincludesformattingphp">trunk/src/wp-includes/formatting.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesformattingphp"></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/formatting.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/formatting.php 2022-12-01 22:18:50 UTC (rev 54926)
+++ trunk/src/wp-includes/formatting.php 2022-12-02 18:51:56 UTC (rev 54927)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -918,7 +918,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.5.0 `$quote_style` also accepts `ENT_XML1`.
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</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 text which is to be encoded.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text The text which is to be encoded.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int|string $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
</span><span class="cx" style="display: block; padding: 0 10px"> * both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES.
</span><span class="cx" style="display: block; padding: 0 10px"> * Converts single and double quotes, as well as converting HTML
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -931,16 +931,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param bool $double_encode Optional. Whether to encode existing HTML entities. Default false.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string The encoded text with HTML 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_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
- $string = (string) $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
+ $text = (string) $text;
</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 ( 0 === strlen( $string ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 0 === strlen( $text ) ) {
</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"> // Don't bother if there are no specialchars - saves some processing.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! preg_match( '/[&<>"\']/', $string ) ) {
- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! preg_match( '/[&<>"\']/', $text ) ) {
+ return $text;
</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"> // Account for the previous behavior of the function when the $quote_style is not an accepted value.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -978,17 +978,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $double_encode ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Guarantee every &entity; is valid, convert &garbage; into &garbage;
</span><span class="cx" style="display: block; padding: 0 10px"> // This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = wp_kses_normalize_entities( $string, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $text = wp_kses_normalize_entities( $text, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' );
</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 = htmlspecialchars( $string, $quote_style, $charset, $double_encode );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $text = htmlspecialchars( $text, $quote_style, $charset, $double_encode );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Back-compat.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'single' === $_quote_style ) {
</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">+ $text = str_replace( "'", ''', $text );
</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 $text;
</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">@@ -1001,7 +1001,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.8.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 The text which is to be decoded.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text The text which is to be decoded.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
</span><span class="cx" style="display: block; padding: 0 10px"> * both single and double if set to ENT_QUOTES or
</span><span class="cx" style="display: block; padding: 0 10px"> * none if set to ENT_NOQUOTES.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1011,16 +1011,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Default is ENT_NOQUOTES.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string The decoded text without HTML 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_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
- $string = (string) $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_specialchars_decode( $text, $quote_style = ENT_NOQUOTES ) {
+ $text = (string) $text;
</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 ( 0 === strlen( $string ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 0 === strlen( $text ) ) {
</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"> // Don't bother if there are no entities - saves a lot of processing.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $string, '&' ) === false ) {
- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( strpos( $text, '&' ) === false ) {
+ return $text;
</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"> // Match the previous behavior of _wp_specialchars() when the $quote_style is not an accepted value.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1079,10 +1079,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"> // Remove zero padding on numeric entities.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $text = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Replace characters according to translation table.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return strtr( $string, $translation );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return strtr( $text, $translation );
</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">@@ -1090,14 +1090,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.8.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 The text which is to be checked.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text The text which is to be checked.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param bool $strip Optional. Whether to attempt to strip out invalid UTF8. Default false.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string The checked text.
</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_check_invalid_utf8( $string, $strip = false ) {
- $string = (string) $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_check_invalid_utf8( $text, $strip = false ) {
+ $text = (string) $text;
</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 ( 0 === strlen( $string ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 0 === strlen( $text ) ) {
</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">@@ -1107,7 +1107,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $is_utf8 ) {
</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 $text;
</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"> // Check for support for utf8 in the installed PCRE library once and store the result in a static.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1118,17 +1118,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> // We can't demand utf8 in the PCRE installation, so just return the string in those cases.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $utf8_pcre ) {
</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 $text;
</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">- // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- preg_match fails when it encounters invalid UTF8 in $string.
- if ( 1 === @preg_match( '/^./us', $string ) ) {
- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- preg_match fails when it encounters invalid UTF8 in $text.
+ if ( 1 === @preg_match( '/^./us', $text ) ) {
+ return $text;
</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"> // Attempt to strip the bad chars if requested (not recommended).
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $strip && function_exists( 'iconv' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return iconv( 'utf-8', 'utf-8', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return iconv( 'utf-8', 'utf-8', $text );
</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"> return '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1586,18 +1586,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.0.0 Added the `$locale` parameter.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0 Added Unicode NFC encoding normalization support.
</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 that might have accent characters.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text Text that might have accent characters.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $locale Optional. The locale to use for accent removal. Some character
</span><span class="cx" style="display: block; padding: 0 10px"> * replacements depend on the locale being used (e.g. 'de_DE').
</span><span class="cx" style="display: block; padding: 0 10px"> * Defaults to the current locale.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Filtered string with replaced "nice" characters.
</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 remove_accents( $string, $locale = '' ) {
- if ( ! preg_match( '/[\x80-\xff]/', $string ) ) {
- return $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function remove_accents( $text, $locale = '' ) {
+ if ( ! preg_match( '/[\x80-\xff]/', $text ) ) {
+ return $text;
</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">- if ( seems_utf8( $string ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( seems_utf8( $text ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Unicode sequence normalization from NFD (Normalization Form Decomposed)
</span><span class="cx" style="display: block; padding: 0 10px"> // to NFC (Normalization Form [Pre]Composed), the encoding used in this function.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1604,8 +1604,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( function_exists( 'normalizer_is_normalized' )
</span><span class="cx" style="display: block; padding: 0 10px"> && function_exists( 'normalizer_normalize' )
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! normalizer_is_normalized( $string ) ) {
- $string = normalizer_normalize( $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! normalizer_is_normalized( $text ) ) {
+ $text = normalizer_normalize( $text );
</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">@@ -1970,7 +1970,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $chars['đ'] = 'dj';
</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 = strtr( $string, $chars );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $text = strtr( $text, $chars );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $chars = array();
</span><span class="cx" style="display: block; padding: 0 10px"> // Assume ISO-8859-1 if not UTF-8.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1987,14 +1987,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy';
</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 = strtr( $string, $chars['in'], $chars['out'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $text = strtr( $text, $chars['in'], $chars['out'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> $double_chars = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $double_chars['in'] = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" );
</span><span class="cx" style="display: block; padding: 0 10px"> $double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = str_replace( $double_chars['in'], $double_chars['out'], $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $text = str_replace( $double_chars['in'], $double_chars['out'], $text );
</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 $text;
</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">@@ -2742,14 +2742,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</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 Value to which backslashes will be added.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $value Value to which backslashes will be added.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string String with backslashes inserted.
</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 backslashit( $string ) {
- if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
- $string = '\\\\' . $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function backslashit( $value ) {
+ if ( isset( $value[0] ) && $value[0] >= '0' && $value[0] <= '9' ) {
+ $value = '\\\\' . $value;
</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 addcslashes( $string, 'A..Za..z' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return addcslashes( $value, 'A..Za..z' );
</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">@@ -2763,11 +2763,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.2.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 What to add the trailing slash to.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $value Value to which trailing slash will be added.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string String with trailing slash added.
</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 trailingslashit( $string ) {
- return untrailingslashit( $string ) . '/';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function trailingslashit( $value ) {
+ return untrailingslashit( $value ) . '/';
</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">@@ -2778,11 +2778,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.2.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 What to remove the trailing slashes from.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text Value from which trailing slashes will be removed.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string String without the trailing 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 untrailingslashit( $string ) {
- return rtrim( $string, '/\\' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function untrailingslashit( $value ) {
+ return rtrim( $value, '/\\' );
</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">@@ -3084,20 +3084,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * 4 => '123456789 ', // 10 characters: '123456789 1234567890a' was too long.
</span><span class="cx" style="display: block; padding: 0 10px"> * 5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split.
</span><span class="cx" style="display: block; padding: 0 10px"> * 6 => ' 45678 ', // 11 characters: Perfect split.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * 7 => '1 3 5 7 90 ', // 11 characters: End of $string.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * 7 => '1 3 5 7 90 ', // 11 characters: End of $text.
</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"> * @since 3.4.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</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 string to split.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text The string to split.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $goal The desired chunk length.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array Numeric array of chunks.
</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 _split_str_by_whitespace( $string, $goal ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _split_str_by_whitespace( $text, $goal ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $chunks = array();
</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_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $string_nullspace = strtr( $text, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> while ( $goal < strlen( $string_nullspace ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3109,13 +3109,13 @@
</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">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $chunks[] = substr( $string, 0, $pos + 1 );
- $string = substr( $string, $pos + 1 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $chunks[] = substr( $text, 0, $pos + 1 );
+ $text = substr( $text, $pos + 1 );
</ins><span class="cx" style="display: block; padding: 0 10px"> $string_nullspace = substr( $string_nullspace, $pos + 1 );
</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">- if ( $string ) {
- $chunks[] = $string;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $text ) {
+ $chunks[] = $text;
</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"> return $chunks;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3552,17 +3552,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.2.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 Subject line.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $subject Subject line.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Converted string to ASCII.
</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_iso_descrambler( $string ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_iso_descrambler( $subject ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> /* this may only work with iso-8859-1, I'm afraid */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! preg_match( '#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches ) ) {
- return $string;
- } else {
- $subject = str_replace( '_', ' ', $matches[2] );
- return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! preg_match( '#\=\?(.+)\?Q\?(.+)\?\=#i', $subject, $matches ) ) {
+ return $subject;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $subject = str_replace( '_', ' ', $matches[2] );
+ return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
</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">@@ -3571,11 +3571,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</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 The preg_replace_callback matches array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $matches The preg_replace_callback matches array.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Converted chars.
</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_iso_convert( $match ) {
- return chr( hexdec( strtolower( $match[1] ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _wp_iso_convert( $matches ) {
+ return chr( hexdec( strtolower( $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">@@ -3586,12 +3586,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.2.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 The date to be converted, in the timezone of the site.
- * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $date_string The date to be converted, in the timezone of the site.
+ * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Formatted version of the date, in UTC.
</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 get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
- $datetime = date_create( $string, wp_timezone() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function get_gmt_from_date( $date_string, $format = 'Y-m-d H:i:s' ) {
+ $datetime = date_create( $date_string, wp_timezone() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( false === $datetime ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return gmdate( $format, 0 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3608,12 +3608,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.2.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 The date to be converted, in UTC or GMT timezone.
- * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $date_string The date to be converted, in UTC or GMT timezone.
+ * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Formatted version of the date, in the site's timezone.
</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 get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
- $datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function get_date_from_gmt( $date_string, $format = 'Y-m-d H:i:s' ) {
+ $datetime = date_create( $date_string, new DateTimeZone( 'UTC' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( false === $datetime ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return gmdate( $format, 0 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5033,11 +5033,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.2.1
</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 string to be parsed.
- * @param array $array Variables will be stored in this array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $input The string to be parsed.
+ * @param array $result Variables will be stored in this array.
</ins><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_parse_str( $string, &$array ) {
- parse_str( (string) $string, $array );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_parse_str( $input, &$result ) {
+ parse_str( (string) $input, $result );
</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"> * Filters the array of variables derived from a parsed string.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5044,9 +5044,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.2.1
</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 $array The array populated with variables.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $result The array populated with variables.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $array = apply_filters( 'wp_parse_str', $array );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = apply_filters( 'wp_parse_str', $result );
</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">@@ -5056,11 +5056,11 @@
</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 $text Text to be converted.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Text to be converted.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Converted text.
</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_pre_kses_less_than( $text ) {
- return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_pre_kses_less_than( $content ) {
+ return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_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">@@ -5084,7 +5084,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.1
</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 be run through KSES.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $content Content to be run through KSES.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array[]|string $allowed_html An array of allowed HTML elements
</span><span class="cx" style="display: block; padding: 0 10px"> * and attributes, or a context name
</span><span class="cx" style="display: block; padding: 0 10px"> * such as 'post'.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5091,16 +5091,16 @@
</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 text to run through KSES.
</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_pre_kses_block_attributes( $string, $allowed_html, $allowed_protocols ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_pre_kses_block_attributes( $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"> * `filter_block_content` is expected to call `wp_kses`. Temporarily remove
</span><span class="cx" style="display: block; padding: 0 10px"> * the filter to avoid recursion.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = filter_block_content( $string, $allowed_html, $allowed_protocols );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = filter_block_content( $content, $allowed_html, $allowed_protocols );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 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">- 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">@@ -5389,19 +5389,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.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 containing HTML tags
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text String containing HTML tags
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param bool $remove_breaks Optional. Whether to remove left over line breaks and white space chars
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string The processed 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_strip_all_tags( $string, $remove_breaks = false ) {
- $string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
- $string = strip_tags( $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_strip_all_tags( $text, $remove_breaks = false ) {
+ $text = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $text );
+ $text = strip_tags( $text );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $remove_breaks ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $string = preg_replace( '/[\r\n\t ]+/', ' ', $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $text = preg_replace( '/[\r\n\t ]+/', ' ', $text );
</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 trim( $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return trim( $text );
</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>