~katiekitty/+junk/wordpress-byet

« back to all changes in this revision

Viewing changes to wp-admin/import/blogger.php

  • Committer: kserver
  • Date: 2010-05-15 01:16:36 UTC
  • Revision ID: kserver@kserver-desktop-20100515011636-mnr1j7t637suptdq
Wordpress 2.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
                $loadauth = esc_js( __('Preparing author mapping form...') );
198
198
                $authhead = esc_js( __('Final Step: Author Mapping') );
199
199
                $nothing  = esc_js( __('Nothing was imported. Had you already imported this blog?') );
 
200
                $stopping = ''; //Missing String used below.
200
201
                $title    = __('Blogger Blogs');
201
202
                $name     = __('Blog Name');
202
203
                $url      = __('Blog URL');
529
530
                return preg_replace( '|\s+|', ' ', $string );
530
531
        }
531
532
 
 
533
        function _normalize_tag( $matches ) {
 
534
                return '<' . strtolower( $matches[1] );
 
535
        }
 
536
 
532
537
        function import_post( $entry ) {
533
538
                global $importing_blog;
534
539
 
551
556
                $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
552
557
 
553
558
                // Clean up content
554
 
                $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
 
559
                $post_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content);
555
560
                $post_content = str_replace('<br>', '<br />', $post_content);
556
561
                $post_content = str_replace('<hr>', '<hr />', $post_content);
557
562
 
604
609
                $comment_content = addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) );
605
610
 
606
611
                // Clean up content
607
 
                $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
 
612
                $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $comment_content);
608
613
                $comment_content = str_replace('<br>', '<br />', $comment_content);
609
614
                $comment_content = str_replace('<hr>', '<hr />', $comment_content);
610
615
 
617
622
                } else {
618
623
                        $comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content');
619
624
 
 
625
                        $comment = wp_filter_comment($comment);
620
626
                        $comment_id = wp_insert_comment($comment);
621
627
 
622
628
                        $this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id;
905
911
        var $entry;
906
912
 
907
913
        function AtomParser() {
908
 
 
909
914
                $this->entry = new AtomEntry();
910
 
                $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";');
911
 
                $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";');
 
915
        }
 
916
 
 
917
        function _map_attrs_func( $k, $v ) {
 
918
                return "$k=\"$v\"";
 
919
        }
 
920
 
 
921
        function _map_xmlns_func( $p, $n ) {
 
922
                $xd = "xmlns";
 
923
                if ( strlen( $n[0] ) > 0 )
 
924
                        $xd .= ":{$n[0]}";
 
925
 
 
926
                return "{$xd}=\"{$n[1]}\"";
912
927
        }
913
928
 
914
929
        function parse($xml) {
950
965
                        foreach($attrs as $key => $value) {
951
966
                                $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value);
952
967
                        }
953
 
                        $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix)));
 
968
                        $attrs_str = join(' ', array_map( array( &$this, '_map_attrs_func' ), array_keys($attrs_prefix), array_values($attrs_prefix)));
954
969
                        if(strlen($attrs_str) > 0) {
955
970
                                $attrs_str = " " . $attrs_str;
956
971
                        }
957
972
 
958
 
                        $xmlns_str = join(' ', array_map($this->map_xmlns_func, array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));
 
973
                        $xmlns_str = join(' ', array_map( array( &$this, '_map_xmlns_func' ), array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));
959
974
                        if(strlen($xmlns_str) > 0) {
960
975
                                $xmlns_str = " " . $xmlns_str;
961
976
                        }