Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-includes/kses.php

    r17172 r15384  
    671671                }
    672672
    673             if ( strtolower($arreach['name']) == 'style' ) {
     673            if ( $arreach['name'] == 'style' ) {
    674674                $orig_value = $arreach['value'];
    675675
     
    763763                    {
    764764                    $thisval = $match[1];
    765                     if ( in_array(strtolower($attrname), $uris) )
     765                    if ( in_array($attrname, $uris) )
    766766                        $thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
    767767
     
    779779                    {
    780780                    $thisval = $match[1];
    781                     if ( in_array(strtolower($attrname), $uris) )
     781                    if ( in_array($attrname, $uris) )
    782782                        $thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
    783783
     
    795795                    {
    796796                    $thisval = $match[1];
    797                     if ( in_array(strtolower($attrname), $uris) )
     797                    if ( in_array($attrname, $uris) )
    798798                        $thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
    799799
     
    10181018 */
    10191019function wp_kses_bad_protocol_once($string, $allowed_protocols) {
    1020     $string2 = preg_split( '/:|&#0*58;|&#x0*3a;/i', $string, 2 );
    1021     if ( isset($string2[1]) && ! preg_match('%/\?%', $string2[0]) )
    1022         $string = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols ) . trim( $string2[1] );
     1020    global $_kses_allowed_protocols;
     1021    $_kses_allowed_protocols = $allowed_protocols;
     1022
     1023    $string2 = preg_split('/:|:|:/i', $string, 2);
     1024    if ( isset($string2[1]) && !preg_match('%/\?%', $string2[0]) )
     1025        $string = wp_kses_bad_protocol_once2($string2[0]) . trim($string2[1]);
     1026    else
     1027        $string = preg_replace_callback('/^((&[^;]*;|[\sA-Za-z0-9])*)'.'(:|:|&#[Xx]3[Aa];)\s*/', 'wp_kses_bad_protocol_once2', $string);
    10231028
    10241029    return $string;
     
    10341039 * @since 1.0.0
    10351040 *
    1036  * @param string $string URI scheme to check against the whitelist
    1037  * @param string $allowed_protocols Allowed protocols
     1041 * @param mixed $matches string or preg_replace_callback() matches array to check for bad protocols
    10381042 * @return string Sanitized content
    10391043 */
    1040 function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) {
     1044function wp_kses_bad_protocol_once2($matches) {
     1045    global $_kses_allowed_protocols;
     1046
     1047    if ( is_array($matches) ) {
     1048        if ( empty($matches[1]) )
     1049            return '';
     1050
     1051        $string = $matches[1];
     1052    } else {
     1053        $string = $matches;
     1054    }
     1055
    10411056    $string2 = wp_kses_decode_entities($string);
    10421057    $string2 = preg_replace('/\s/', '', $string2);
     
    10451060
    10461061    $allowed = false;
    1047     foreach ( (array) $allowed_protocols as $one_protocol )
    1048         if ( strtolower($one_protocol) == $string2 ) {
     1062    foreach ( (array) $_kses_allowed_protocols as $one_protocol)
     1063        if (strtolower($one_protocol) == $string2) {
    10491064            $allowed = true;
    10501065            break;
Note: See TracChangeset for help on using the changeset viewer.