Make WordPress Core

Ticket #15203: 15203.importer.diff

File 15203.importer.diff, 697 bytes (added by duck_, 12 years ago)

Regex parser need to understand escaped ]]>

  • parsers.php

     
    465465                global $wpdb;
    466466                preg_match( "|<$tag.*?>(.*?)</$tag>|is", $string, $return );
    467467                if ( isset( $return[1] ) ) {
    468                         $return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] );
     468                        if ( substr( $return[1], 0, 9 ) == '<![CDATA[' ) {
     469                                preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches );
     470                                $return = '';
     471                                foreach( $matches[1] as $match )
     472                                        $return .= $match;
     473                        } else {
     474                                $return = $return[1];
     475                        }
    469476                        $return = $wpdb->escape( trim( $return ) );
    470477                } else {
    471478                        $return = '';