Ticket #1162: wordpress_importer_get_tag_fix.patch

File wordpress_importer_get_tag_fix.patch, 694 bytes (added by snarfed, 22 months ago)
  • trunk/wordpress-importer.php

     
    6969 
    7070        function get_tag( $string, $tag ) { 
    7171                global $wpdb; 
    72                 preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return); 
    73                 if ( isset($return[1]) ) { 
    74                         $return = preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1]); 
     72                preg_match("|<$tag( +.*)?>(.*?)</$tag>|is", $string, $return); 
     73                if ( isset($return[2]) ) { 
     74                        $return = preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[2]); 
    7575                        $return = $wpdb->escape( trim( $return ) ); 
    7676                } else { 
    7777                        $return = '';