Ticket #7595: wordpress-wxr-import-file-import.patch
File wordpress-wxr-import-file-import.patch, 1.5 KB (added by , 17 years ago) |
---|
-
wp-admin/import/wordpress.php
105 105 // this doesn't check that the file is perfectly valid but will at least confirm that it's not the wrong format altogether 106 106 if ( !$is_wxr_file && preg_match('|xmlns:wp="http://wordpress[.]org/export/\d+[.]\d+/"|', $importline) ) 107 107 $is_wxr_file = true; 108 108 109 if ( false !== strpos($importline, '<wp:base_site_url>') ) { 110 preg_match('|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url); 111 $this->base_url = $url[1]; 112 continue; 113 } 109 114 if ( false !== strpos($importline, '<wp:category>') ) { 110 115 preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category); 111 116 $this->categories[] = $category[1]; … … 539 544 function process_attachment($postdata, $remote_url) { 540 545 if ($this->fetch_attachments and $remote_url) { 541 546 printf( __('Importing attachment <em>%s</em>... '), htmlspecialchars($remote_url) ); 547 548 //If the URL is absolute, but does not contain http, upload it assuming the base_site_url variable 549 if(preg_match('/^\/[\w\W]+$/', $remote_url)) 550 $remote_url = rtrim($this->base_url,'/').$remote_url; 551 542 552 $upload = $this->fetch_remote_file($postdata, $remote_url); 543 553 if ( is_wp_error($upload) ) { 544 554 printf( __('Remote file error: %s'), htmlspecialchars($upload->get_error_message()) );