Ticket #13458: blogger.diff
| File blogger.diff, 5.5 KB (added by ampt, 3 years ago) |
|---|
-
wp-admin/import/blogger.php
162 162 if ( $tag['tag'] == 'TITLE' ) { 163 163 $blog['title'] = $tag['value']; 164 164 } elseif ( $tag['tag'] == 'SUMMARY' ) { 165 $blog['summary'] = $tag['value'];165 $blog['summary'] = ( isset( $tag['value'] ) ) ? $tag['value'] : ''; 166 166 } elseif ( $tag['tag'] == 'LINK' ) { 167 167 if ( $tag['attributes']['REL'] == 'alternate' && $tag['attributes']['TYPE'] == 'text/html' ) { 168 168 $parts = parse_url( $tag['attributes']['HREF'] ); … … 205 205 $posts = __('Posts'); 206 206 $comments = __('Comments'); 207 207 $noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don’t worry, you can turn it back off when you’re done.'); 208 $init = ''; 209 $rows = ''; 208 210 209 211 $interval = STATUS_INTERVAL * 1000; 210 212 … … 499 501 if ( preg_match('/rel=.previous./', $match) ) 500 502 $query = @html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match), ENT_COMPAT, get_option('blog_charset') ); 501 503 502 parse_str($query, $q); 503 504 $this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index']; 504 if ( $query ) { 505 parse_str($query, $q); 506 $this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index']; 507 } else 508 $this->blogs[$importing_blog]['comments_start_index'] = 0; 505 509 $this->save_vars(); 506 510 } while ( !empty( $query ) && $this->have_time() ); 507 511 } … … 582 586 add_post_meta( $post_id, 'blogger_permalink', $entry->old_permalink, true ); 583 587 584 588 $this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id; 589 if( !isset( $this->blogs[$importing_blog]['posts_done'] ) ) { 590 $this->blogs[$importing_blog]['posts_done'] = 0; 591 } 585 592 ++$this->blogs[$importing_blog]['posts_done']; 586 593 } 587 594 $this->save_vars(); … … 602 609 } 603 610 604 611 $comment_post_ID = (int) $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink]; 605 preg_match('#<name>(.+?)</name>.* (?:\<uri>(.+?)</uri>)?#', $entry->author, $matches);612 preg_match('#<name>(.+?)</name>.*?(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches); 606 613 $comment_author = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) ); 607 614 $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) ); 608 615 $comment_date = $this->convert_date( $entry->updated ); … … 627 634 628 635 $this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id; 629 636 637 if( !isset( $this->blogs[$importing_blog]['comments_done'] ) ) { 638 $this->blogs[$importing_blog]['comments_done'] = 0; 639 } 640 630 641 ++$this->blogs[$importing_blog]['comments_done']; 631 642 } 632 643 $this->save_vars(); … … 665 676 $mapthis = __('Blogger username'); 666 677 $tothis = __('WordPress login'); 667 678 $submit = esc_js( __('Save Changes') ); 679 $rows = ''; 668 680 669 681 foreach ( $blog['authors'] as $i => $author ) 670 682 $rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>"; … … 674 686 675 687 function get_user_options($current) { 676 688 global $importer_users; 689 $options = ''; 677 690 if ( ! isset( $importer_users ) ) 678 691 $importer_users = (array) get_users_of_blog(); 679 692 … … 743 756 } 744 757 745 758 function _txrx( $sock, $request ) { 759 $response = ''; 746 760 fwrite( $sock, $request ); 747 761 while ( ! feof( $sock ) ) 748 762 $response .= @ fread ( $sock, 8192 ); … … 787 801 $response_header_array = array(); 788 802 foreach($response_header_lines as $header_line) { 789 803 list($header,$value) = explode(': ', $header_line, 2); 790 $response_header_array[$header] .= $value."\n";804 $response_header_array[$header] = $value."\n"; 791 805 } 792 806 793 807 $cookie_array = array(); 794 $cookies = explode("\n", $response_header_array["Set-Cookie"]); 808 $cookies = array(); 809 if( isset($response_header_array["Set-Cookie"]) ) { 810 $cookies = explode("\n", $response_header_array["Set-Cookie"]); 811 } 795 812 foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); } 796 813 797 814 return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body); … … 983 1000 array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}"); 984 1001 } else if (in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { 985 1002 $this->in_content = array(); 986 $this->is_xhtml = $attrs['type'] == 'xhtml'; 1003 1004 if( isset( $attrs['type'] ) ) { 1005 $this->is_xhtml = $attrs['type'] == 'xhtml'; 1006 } else { 1007 $this->is_xhtml = false; 1008 } 1009 987 1010 array_push($this->in_content, array($tag,$this->depth)); 988 1011 } else if ($tag == 'link') { 989 1012 array_push($this->entry->links, $attrs); … … 1036 1059 function cdata($parser, $data) { 1037 1060 #print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n"; 1038 1061 if (!empty($this->in_content)) { 1062 $in_content = $this->in_content[count($this->in_content)-1]; 1063 if( is_array( $in_content ) ) { 1064 $in_content = $in_content[0]; 1065 } 1066 1039 1067 // handle self-closing tags (case: text node found, need to close element started) 1040 if (strpos($ this->in_content[count($this->in_content)-1], '<') !== false) {1068 if (strpos($in_content, '<') !== false) { 1041 1069 array_push($this->in_content, ">"); 1042 1070 } 1043 1071 array_push($this->in_content, $this->xml_escape($data));
