WordPress.org

Plugin Directory

Changeset 501867


Ignore:
Timestamp:
02/07/12 22:00:03 (2 years ago)
Author:
duck_
Message:

Add support for escaped closing CDATA sequences "]]]]><![CDATA[>" (WXR_VERSION 1.2) to the regex parser. See http://core.trac.wordpress.org/ticket/15203.

Location:
wordpress-importer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wordpress-importer/trunk/parsers.php

    r380920 r501867  
    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                if ( strpos( $return[1], ']]]]><![CDATA[>' ) !== false ) { 
     470                    preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches ); 
     471                    $return = ''; 
     472                    foreach( $matches[1] as $match ) 
     473                        $return .= $match; 
     474                } else { 
     475                    $return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] ); 
     476                } 
     477            } else { 
     478                $return = $return[1]; 
     479            } 
    469480            $return = $wpdb->escape( trim( $return ) ); 
    470481        } else { 
  • wordpress-importer/trunk/wordpress-importer.php

    r485059 r501867  
    66Author: wordpressdotorg 
    77Author URI: http://wordpress.org/ 
    8 Version: 0.5 
     8Version: 0.5.1 
    99Text Domain: wordpress-importer 
    1010License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     
    3737if ( class_exists( 'WP_Importer' ) ) { 
    3838class WP_Import extends WP_Importer { 
    39     var $max_wxr_version = 1.1; // max. supported WXR version 
     39    var $max_wxr_version = 1.2; // max. supported WXR version 
    4040 
    4141    var $id; // WXR attachment ID 
Note: See TracChangeset for help on using the changeset viewer.