<!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>[31079] trunk/src: Perl-style comments should not be used</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 { 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/31079">31079</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/31079","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>wonderboymusic</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-01-08 05:51:39 +0000 (Thu, 08 Jan 2015)</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'>Perl-style comments should not be used
See <a href="https://core.trac.wordpress.org/ticket/30799">#30799</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesmsphp">trunk/src/wp-admin/includes/ms.php</a></li>
<li><a href="#trunksrcwpincludesclasswpxmlrpcserverphp">trunk/src/wp-includes/class-wp-xmlrpc-server.php</a></li>
<li><a href="#trunksrcwpincludesformattingphp">trunk/src/wp-includes/formatting.php</a></li>
<li><a href="#trunksrcwpincludesksesphp">trunk/src/wp-includes/kses.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesmsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/ms.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/ms.php 2015-01-08 05:43:54 UTC (rev 31078)
+++ trunk/src/wp-admin/includes/ms.php 2015-01-08 05:51:39 UTC (rev 31079)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -136,7 +136,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $index = 0;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> while ( $index < count( $stack ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Get indexed directory from stack
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Get indexed directory from stack
</ins><span class="cx" style="display: block; padding: 0 10px"> $dir = $stack[$index];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $dh = @opendir( $dir );
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpxmlrpcserverphp"></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/class-wp-xmlrpc-server.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-xmlrpc-server.php 2015-01-08 05:43:54 UTC (rev 31078)
+++ trunk/src/wp-includes/class-wp-xmlrpc-server.php 2015-01-08 05:51:39 UTC (rev 31079)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3634,7 +3634,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $formats = get_post_format_strings();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # find out if they want a list of currently supports formats
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // find out if they want a list of currently supports formats
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $args[3] ) && is_array( $args[3] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $args[3]['show-supported'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( current_theme_supports( 'post-formats' ) ) {
</span></span></pre></div>
<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 2015-01-08 05:43:54 UTC (rev 31078)
+++ trunk/src/wp-includes/formatting.php 2015-01-08 05:51:39 UTC (rev 31079)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -550,14 +550,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> reset_mbstring_encoding();
</span><span class="cx" style="display: block; padding: 0 10px"> for ($i=0; $i < $length; $i++) {
</span><span class="cx" style="display: block; padding: 0 10px"> $c = ord($str[$i]);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ($c < 0x80) $n = 0; # 0bbbbbbb
- elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb
- elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb
- elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb
- elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb
- elseif (($c & 0xFE) == 0xFC) $n=5; # 1111110b
- else return false; # Does not match any model
- for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($c < 0x80) $n = 0; // 0bbbbbbb
+ elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
+ elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
+ elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
+ elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
+ elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
+ else return false; // Does not match any model
+ for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
</ins><span class="cx" style="display: block; padding: 0 10px"> if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<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 2015-01-08 05:43:54 UTC (rev 31078)
+++ trunk/src/wp-includes/kses.php 2015-01-08 05:51:39 UTC (rev 31079)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -672,7 +672,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (substr($string, 0, 1) != '<')
</span><span class="cx" style="display: block; padding: 0 10px"> return '>';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # It matched a ">" character
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // It matched a ">" character
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( '<!--' == substr( $string, 0, 4 ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $string = str_replace( array('<!--', '-->'), '', $string );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -686,11 +686,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $string = preg_replace('/-$/', '', $string);
</span><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">- # Allow HTML comments
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Allow HTML comments
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
</span><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # It's seriously malformed
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // It's seriously malformed
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $slash = trim($matches[1]);
</span><span class="cx" style="display: block; padding: 0 10px"> $elem = $matches[2];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -701,11 +701,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset($allowed_html[strtolower($elem)]) )
</span><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # They are using a not allowed HTML element
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // They are using a not allowed HTML element
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ($slash != '')
</span><span class="cx" style="display: block; padding: 0 10px"> return "</$elem>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # No attributes are allowed for closing elements
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // No attributes are allowed for closing elements
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -728,7 +728,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Sanitized HTML element
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Is there a closing XHTML slash at the end of the attributes?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Is there a closing XHTML slash at the end of the attributes?
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_array( $allowed_html ) )
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed_html = wp_kses_allowed_html( $allowed_html );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -737,25 +737,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (preg_match('%\s*/\s*$%', $attr))
</span><span class="cx" style="display: block; padding: 0 10px"> $xhtml_slash = ' /';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Are any attributes allowed at all for this element?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Are any attributes allowed at all for this element?
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset($allowed_html[strtolower($element)]) || count($allowed_html[strtolower($element)]) == 0 )
</span><span class="cx" style="display: block; padding: 0 10px"> return "<$element$xhtml_slash>";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Split it
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Split it
</ins><span class="cx" style="display: block; padding: 0 10px"> $attrarr = wp_kses_hair($attr, $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">- # Go through $attrarr, and save the allowed attributes for this element
- # in $attr2
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Go through $attrarr, and save the allowed attributes for this element
+ // in $attr2
</ins><span class="cx" style="display: block; padding: 0 10px"> $attr2 = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed_attr = $allowed_html[strtolower($element)];
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ($attrarr as $arreach) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $allowed_attr[strtolower($arreach['name'])] ) )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- continue; # the attribute is not allowed
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ continue; // the attribute is not allowed
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $current = $allowed_attr[strtolower($arreach['name'])];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $current == '' )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- continue; # the attribute is not allowed
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ continue; // the attribute is not allowed
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( strtolower( $arreach['name'] ) == 'style' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $orig_value = $arreach['value'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -770,10 +770,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_array($current) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $attr2 .= ' '.$arreach['whole'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # there are no checks
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // there are no checks
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # there are some checks
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // there are some checks
</ins><span class="cx" style="display: block; padding: 0 10px"> $ok = true;
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ($current as $currkey => $currval) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -783,11 +783,11 @@
</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 ( $ok )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attr2 .= ' '.$arreach['whole']; # it passed them
- } # if !is_array($current)
- } # foreach
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attr2 .= ' '.$arreach['whole']; // it passed them
+ } // if !is_array($current)
+ } // foreach
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Remove any "<" or ">" characters
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Remove any "<" or ">" characters
</ins><span class="cx" style="display: block; padding: 0 10px"> $attr2 = preg_replace('/[<>]/', '', $attr2);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return "<$element$attr2$xhtml_slash>";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -816,13 +816,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $attrname = '';
</span><span class="cx" style="display: block; padding: 0 10px"> $uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Loop through the whole attribute list
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Loop through the whole attribute list
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> while (strlen($attr) != 0) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $working = 0; # Was the last operation successful?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $working = 0; // Was the last operation successful?
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch ($mode) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 0 : # attribute name, href for instance
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 0 : // attribute name, href for instance
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( preg_match('/^([-a-zA-Z:]+)/', $attr, $match ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $attrname = $match[1];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -832,9 +832,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 1 : # equals sign or valueless ("selected")
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 1 : // equals sign or valueless ("selected")
</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 (preg_match('/^\s*=\s*/', $attr)) # equals sign
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (preg_match('/^\s*=\s*/', $attr)) // equals sign
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $working = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> $mode = 2;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -842,7 +842,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</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 (preg_match('/^\s+/', $attr)) # valueless
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (preg_match('/^\s+/', $attr)) // valueless
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $working = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> $mode = 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -854,10 +854,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 2 : # attribute value, a URL after href= for instance
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 2 : // attribute value, a URL after href= for instance
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match))
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # "value"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // "value"
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $thisval = $match[1];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( in_array(strtolower($attrname), $uris) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -873,7 +873,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 (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match))
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # 'value'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // 'value'
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $thisval = $match[1];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( in_array(strtolower($attrname), $uris) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -889,7 +889,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 (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match))
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // value
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $thisval = $match[1];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( in_array(strtolower($attrname), $uris) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -898,25 +898,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if(false === array_key_exists($attrname, $attrarr)) {
</span><span class="cx" style="display: block; padding: 0 10px"> $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # We add quotes to conform to W3C's HTML spec.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // We add quotes to conform to W3C's HTML spec.
</ins><span class="cx" style="display: block; padding: 0 10px"> $working = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> $mode = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> $attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
</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"> break;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } # switch
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } // switch
</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 ($working == 0) # not well formed, remove and try again
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($working == 0) // not well formed, remove and try again
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $attr = wp_kses_html_error($attr);
</span><span class="cx" style="display: block; padding: 0 10px"> $mode = 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">- } # while
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } // while
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ($mode == 1 && false === array_key_exists($attrname, $attrarr))
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # special case, for when the attribute list ends with a valueless
- # attribute like "selected"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // special case, for when the attribute list ends with a valueless
+ // attribute like "selected"
</ins><span class="cx" style="display: block; padding: 0 10px"> $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $attrarr;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -941,28 +941,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch (strtolower($checkname)) {
</span><span class="cx" style="display: block; padding: 0 10px"> case 'maxlen' :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # The maxlen check makes sure that the attribute value has a length not
- # greater than the given value. This can be used to avoid Buffer Overflows
- # in WWW clients and various Internet servers.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The maxlen check makes sure that the attribute value has a length not
+ // greater than the given value. This can be used to avoid Buffer Overflows
+ // in WWW clients and various Internet servers.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (strlen($value) > $checkvalue)
</span><span class="cx" style="display: block; padding: 0 10px"> $ok = false;
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> case 'minlen' :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # The minlen check makes sure that the attribute value has a length not
- # smaller than the given value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The minlen check makes sure that the attribute value has a length not
+ // smaller than the given value.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (strlen($value) < $checkvalue)
</span><span class="cx" style="display: block; padding: 0 10px"> $ok = false;
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> case 'maxval' :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # The maxval check does two things: it checks that the attribute value is
- # an integer from 0 and up, without an excessive amount of zeroes or
- # whitespace (to avoid Buffer Overflows). It also checks that the attribute
- # value is not greater than the given value.
- # This check can be used to avoid Denial of Service attacks.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The maxval check does two things: it checks that the attribute value is
+ // an integer from 0 and up, without an excessive amount of zeroes or
+ // whitespace (to avoid Buffer Overflows). It also checks that the attribute
+ // value is not greater than the given value.
+ // This check can be used to avoid Denial of Service attacks.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
</span><span class="cx" style="display: block; padding: 0 10px"> $ok = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -971,8 +971,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> case 'minval' :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # The minval check makes sure that the attribute value is a positive integer,
- # and that it is not smaller than the given value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The minval check makes sure that the attribute value is a positive integer,
+ // and that it is not smaller than the given value.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
</span><span class="cx" style="display: block; padding: 0 10px"> $ok = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -981,15 +981,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> case 'valueless' :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # The valueless check makes sure if the attribute has a value
- # (like <a href="blah">) or not (<option selected>). If the given value
- # is a "y" or a "Y", the attribute must not have a value.
- # If the given value is an "n" or an "N", the attribute must have one.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The valueless check makes sure if the attribute has a value
+ // (like <a href="blah">) or not (<option selected>). If the given value
+ // is a "y" or a "Y", the attribute must not have a value.
+ // If the given value is an "n" or an "N", the attribute must have one.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (strtolower($checkvalue) != $vless)
</span><span class="cx" style="display: block; padding: 0 10px"> $ok = false;
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } # switch
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } // switch
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $ok;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1074,8 +1074,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $inval as $inkey2 => $inval2) {
</span><span class="cx" style="display: block; padding: 0 10px"> $outkey2 = strtolower($inkey2);
</span><span class="cx" style="display: block; padding: 0 10px"> $outarray[$outkey][$outkey2] = $inval2;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } # foreach $inval
- } # foreach $inarray
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } // foreach $inval
+ } // foreach $inarray
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $outarray;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1181,11 +1181,11 @@
</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><span class="cx" style="display: block; padding: 0 10px"> function wp_kses_normalize_entities($string) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Disarm all entities by converting & to &
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Disarm all entities by converting & to &
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $string = str_replace('&', '&', $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">- # Change back the allowed entities in our entity whitelist
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Change back the allowed entities in our entity whitelist
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $string = preg_replace_callback('/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string);
</span><span class="cx" style="display: block; padding: 0 10px"> $string = preg_replace_callback('/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string);
</span></span></pre>
</div>
</div>
</body>
</html>