Make WordPress Core

Changeset 31079


Ignore:
Timestamp:
01/08/2015 05:51:39 AM (9 years ago)
Author:
wonderboymusic
Message:

Perl-style comments should not be used

See #30799.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ms.php

    r31034 r31079  
    137137
    138138        while ( $index < count( $stack ) ) {
    139             # Get indexed directory from stack
     139            // Get indexed directory from stack
    140140            $dir = $stack[$index];
    141141
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r30681 r31079  
    36353635        $formats = get_post_format_strings();
    36363636
    3637         # find out if they want a list of currently supports formats
     3637        // find out if they want a list of currently supports formats
    36383638        if ( isset( $args[3] ) && is_array( $args[3] ) ) {
    36393639            if ( $args[3]['show-supported'] ) {
  • trunk/src/wp-includes/formatting.php

    r31064 r31079  
    551551    for ($i=0; $i < $length; $i++) {
    552552        $c = ord($str[$i]);
    553         if ($c < 0x80) $n = 0; # 0bbbbbbb
    554         elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb
    555         elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb
    556         elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb
    557         elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb
    558         elseif (($c & 0xFE) == 0xFC) $n=5; # 1111110b
    559         else return false; # Does not match any model
    560         for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
     553        if ($c < 0x80) $n = 0; // 0bbbbbbb
     554        elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
     555        elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
     556        elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
     557        elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
     558        elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
     559        else return false; // Does not match any model
     560        for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
    561561            if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
    562562                return false;
  • trunk/src/wp-includes/kses.php

    r30726 r31079  
    673673    if (substr($string, 0, 1) != '<')
    674674        return '&gt;';
    675     # It matched a ">" character
     675    // It matched a ">" character
    676676
    677677    if ( '<!--' == substr( $string, 0, 4 ) ) {
     
    687687        return "<!--{$string}-->";
    688688    }
    689     # Allow HTML comments
     689    // Allow HTML comments
    690690
    691691    if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
    692692        return '';
    693     # It's seriously malformed
     693    // It's seriously malformed
    694694
    695695    $slash = trim($matches[1]);
     
    702702    if ( ! isset($allowed_html[strtolower($elem)]) )
    703703        return '';
    704     # They are using a not allowed HTML element
     704    // They are using a not allowed HTML element
    705705
    706706    if ($slash != '')
    707707        return "</$elem>";
    708     # No attributes are allowed for closing elements
     708    // No attributes are allowed for closing elements
    709709
    710710    return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols );
     
    729729 */
    730730function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
    731     # Is there a closing XHTML slash at the end of the attributes?
     731    // Is there a closing XHTML slash at the end of the attributes?
    732732
    733733    if ( ! is_array( $allowed_html ) )
     
    738738        $xhtml_slash = ' /';
    739739
    740     # Are any attributes allowed at all for this element?
     740    // Are any attributes allowed at all for this element?
    741741    if ( ! isset($allowed_html[strtolower($element)]) || count($allowed_html[strtolower($element)]) == 0 )
    742742        return "<$element$xhtml_slash>";
    743743
    744     # Split it
     744    // Split it
    745745    $attrarr = wp_kses_hair($attr, $allowed_protocols);
    746746
    747     # Go through $attrarr, and save the allowed attributes for this element
    748     # in $attr2
     747    // Go through $attrarr, and save the allowed attributes for this element
     748    // in $attr2
    749749    $attr2 = '';
    750750
     
    752752    foreach ($attrarr as $arreach) {
    753753        if ( ! isset( $allowed_attr[strtolower($arreach['name'])] ) )
    754             continue; # the attribute is not allowed
     754            continue; // the attribute is not allowed
    755755
    756756        $current = $allowed_attr[strtolower($arreach['name'])];
    757757        if ( $current == '' )
    758             continue; # the attribute is not allowed
     758            continue; // the attribute is not allowed
    759759
    760760        if ( strtolower( $arreach['name'] ) == 'style' ) {
     
    771771        if ( ! is_array($current) ) {
    772772            $attr2 .= ' '.$arreach['whole'];
    773         # there are no checks
     773        // there are no checks
    774774
    775775        } else {
    776             # there are some checks
     776            // there are some checks
    777777            $ok = true;
    778778            foreach ($current as $currkey => $currval) {
     
    784784
    785785            if ( $ok )
    786                 $attr2 .= ' '.$arreach['whole']; # it passed them
    787         } # if !is_array($current)
    788     } # foreach
    789 
    790     # Remove any "<" or ">" characters
     786                $attr2 .= ' '.$arreach['whole']; // it passed them
     787        } // if !is_array($current)
     788    } // foreach
     789
     790    // Remove any "<" or ">" characters
    791791    $attr2 = preg_replace('/[<>]/', '', $attr2);
    792792
     
    817817    $uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
    818818
    819     # Loop through the whole attribute list
     819    // Loop through the whole attribute list
    820820
    821821    while (strlen($attr) != 0) {
    822         $working = 0; # Was the last operation successful?
     822        $working = 0; // Was the last operation successful?
    823823
    824824        switch ($mode) {
    825             case 0 : # attribute name, href for instance
     825            case 0 : // attribute name, href for instance
    826826
    827827                if ( preg_match('/^([-a-zA-Z:]+)/', $attr, $match ) ) {
     
    833833                break;
    834834
    835             case 1 : # equals sign or valueless ("selected")
    836 
    837                 if (preg_match('/^\s*=\s*/', $attr)) # equals sign
     835            case 1 : // equals sign or valueless ("selected")
     836
     837                if (preg_match('/^\s*=\s*/', $attr)) // equals sign
    838838                    {
    839839                    $working = 1;
     
    843843                }
    844844
    845                 if (preg_match('/^\s+/', $attr)) # valueless
     845                if (preg_match('/^\s+/', $attr)) // valueless
    846846                    {
    847847                    $working = 1;
     
    855855                break;
    856856
    857             case 2 : # attribute value, a URL after href= for instance
     857            case 2 : // attribute value, a URL after href= for instance
    858858
    859859                if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match))
    860                     # "value"
     860                    // "value"
    861861                    {
    862862                    $thisval = $match[1];
     
    874874
    875875                if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match))
    876                     # 'value'
     876                    // 'value'
    877877                    {
    878878                    $thisval = $match[1];
     
    890890
    891891                if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match))
    892                     # value
     892                    // value
    893893                    {
    894894                    $thisval = $match[1];
     
    899899                        $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
    900900                    }
    901                     # We add quotes to conform to W3C's HTML spec.
     901                    // We add quotes to conform to W3C's HTML spec.
    902902                    $working = 1;
    903903                    $mode = 0;
     
    906906
    907907                break;
    908         } # switch
    909 
    910         if ($working == 0) # not well formed, remove and try again
     908        } // switch
     909
     910        if ($working == 0) // not well formed, remove and try again
    911911        {
    912912            $attr = wp_kses_html_error($attr);
    913913            $mode = 0;
    914914        }
    915     } # while
     915    } // while
    916916
    917917    if ($mode == 1 && false === array_key_exists($attrname, $attrarr))
    918         # special case, for when the attribute list ends with a valueless
    919         # attribute like "selected"
     918        // special case, for when the attribute list ends with a valueless
     919        // attribute like "selected"
    920920        $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
    921921
     
    942942    switch (strtolower($checkname)) {
    943943        case 'maxlen' :
    944             # The maxlen check makes sure that the attribute value has a length not
    945             # greater than the given value. This can be used to avoid Buffer Overflows
    946             # in WWW clients and various Internet servers.
     944            // The maxlen check makes sure that the attribute value has a length not
     945            // greater than the given value. This can be used to avoid Buffer Overflows
     946            // in WWW clients and various Internet servers.
    947947
    948948            if (strlen($value) > $checkvalue)
     
    951951
    952952        case 'minlen' :
    953             # The minlen check makes sure that the attribute value has a length not
    954             # smaller than the given value.
     953            // The minlen check makes sure that the attribute value has a length not
     954            // smaller than the given value.
    955955
    956956            if (strlen($value) < $checkvalue)
     
    959959
    960960        case 'maxval' :
    961             # The maxval check does two things: it checks that the attribute value is
    962             # an integer from 0 and up, without an excessive amount of zeroes or
    963             # whitespace (to avoid Buffer Overflows). It also checks that the attribute
    964             # value is not greater than the given value.
    965             # This check can be used to avoid Denial of Service attacks.
     961            // The maxval check does two things: it checks that the attribute value is
     962            // an integer from 0 and up, without an excessive amount of zeroes or
     963            // whitespace (to avoid Buffer Overflows). It also checks that the attribute
     964            // value is not greater than the given value.
     965            // This check can be used to avoid Denial of Service attacks.
    966966
    967967            if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
     
    972972
    973973        case 'minval' :
    974             # The minval check makes sure that the attribute value is a positive integer,
    975             # and that it is not smaller than the given value.
     974            // The minval check makes sure that the attribute value is a positive integer,
     975            // and that it is not smaller than the given value.
    976976
    977977            if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
     
    982982
    983983        case 'valueless' :
    984             # The valueless check makes sure if the attribute has a value
    985             # (like <a href="blah">) or not (<option selected>). If the given value
    986             # is a "y" or a "Y", the attribute must not have a value.
    987             # If the given value is an "n" or an "N", the attribute must have one.
     984            // The valueless check makes sure if the attribute has a value
     985            // (like <a href="blah">) or not (<option selected>). If the given value
     986            // is a "y" or a "Y", the attribute must not have a value.
     987            // If the given value is an "n" or an "N", the attribute must have one.
    988988
    989989            if (strtolower($checkvalue) != $vless)
    990990                $ok = false;
    991991            break;
    992     } # switch
     992    } // switch
    993993
    994994    return $ok;
     
    10751075            $outkey2 = strtolower($inkey2);
    10761076            $outarray[$outkey][$outkey2] = $inval2;
    1077         } # foreach $inval
    1078     } # foreach $inarray
     1077        } // foreach $inval
     1078    } // foreach $inarray
    10791079
    10801080    return $outarray;
     
    11821182 */
    11831183function wp_kses_normalize_entities($string) {
    1184     # Disarm all entities by converting & to &amp;
     1184    // Disarm all entities by converting & to &amp;
    11851185
    11861186    $string = str_replace('&', '&amp;', $string);
    11871187
    1188     # Change back the allowed entities in our entity whitelist
     1188    // Change back the allowed entities in our entity whitelist
    11891189
    11901190    $string = preg_replace_callback('/&amp;([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string);
Note: See TracChangeset for help on using the changeset viewer.