]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/import/blogger.php
Wordpress 2.9.2-scripts
[autoinstalls/wordpress.git] / wp-admin / import / blogger.php
index 57fc06657e2db010d8b66f1fbe41796fc8ed6ef5..58aa684bc2b88be1fbff82003bbf2c53dfc0c064 100644 (file)
@@ -197,6 +197,7 @@ class Blogger_Import {
                $loadauth = esc_js( __('Preparing author mapping form...') );
                $authhead = esc_js( __('Final Step: Author Mapping') );
                $nothing  = esc_js( __('Nothing was imported. Had you already imported this blog?') );
+               $stopping = ''; //Missing String used below.
                $title    = __('Blogger Blogs');
                $name     = __('Blog Name');
                $url      = __('Blog URL');
@@ -529,6 +530,10 @@ class Blogger_Import {
                return preg_replace( '|\s+|', ' ', $string );
        }
 
+       function _normalize_tag( $matches ) {
+               return '<' . strtolower( $matches[1] );
+       }
+
        function import_post( $entry ) {
                global $importing_blog;
 
@@ -551,7 +556,7 @@ class Blogger_Import {
                $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
 
                // Clean up content
-               $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
+               $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content);
                $post_content = str_replace('<br>', '<br />', $post_content);
                $post_content = str_replace('<hr>', '<hr />', $post_content);
 
@@ -604,7 +609,7 @@ class Blogger_Import {
                $comment_content = addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) );
 
                // Clean up content
-               $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
+               $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content);
                $comment_content = str_replace('<br>', '<br />', $comment_content);
                $comment_content = str_replace('<hr>', '<hr />', $comment_content);
 
@@ -617,6 +622,7 @@ class Blogger_Import {
                } else {
                        $comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content');
 
+                       $comment = wp_filter_comment($comment);
                        $comment_id = wp_insert_comment($comment);
 
                        $this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id;
@@ -905,10 +911,19 @@ class AtomParser {
        var $entry;
 
        function AtomParser() {
-
                $this->entry = new AtomEntry();
-               $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";');
-               $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";');
+       }
+
+       function _map_attrs_func( $k, $v ) {
+               return "$k=\"$v\"";
+       }
+
+       function _map_xmlns_func( $p, $n ) {
+               $xd = "xmlns";
+               if ( strlen( $n[0] ) > 0 )
+                       $xd .= ":{$n[0]}";
+
+               return "{$xd}=\"{$n[1]}\"";
        }
 
        function parse($xml) {
@@ -950,12 +965,12 @@ class AtomParser {
                        foreach($attrs as $key => $value) {
                                $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value);
                        }
-                       $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix)));
+                       $attrs_str = join(' ', array_map( array( &$this, '_map_attrs_func' ), array_keys($attrs_prefix), array_values($attrs_prefix)));
                        if(strlen($attrs_str) > 0) {
                                $attrs_str = " " . $attrs_str;
                        }
 
-                       $xmlns_str = join(' ', array_map($this->map_xmlns_func, array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));
+                       $xmlns_str = join(' ', array_map( array( &$this, '_map_xmlns_func' ), array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));
                        if(strlen($xmlns_str) > 0) {
                                $xmlns_str = " " . $xmlns_str;
                        }