Skip to content

Commit 08aa0e7

Browse files
committed
Update WordPress Importer plugin from 0.9.3 to 0.9.4
1 parent 9f8e9ba commit 08aa0e7

4 files changed

Lines changed: 22 additions & 11 deletions

File tree

wp-content/plugins/wordpress-importer/parsers/class-wxr-parser-regex.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,29 @@ public function parse( $file ) {
4343
$importline = rtrim( $this->fgets( $fp ) );
4444

4545
if ( ! $wxr_version && preg_match( '|<wp:wxr_version>(\d+\.\d+)</wp:wxr_version>|', $importline, $version ) ) {
46-
$wxr_version = $version[1];
46+
$wxr_version = isset( $version[1] ) ? $version[1] : '';
4747
}
4848

4949
if ( false !== strpos( $importline, '<wp:base_site_url>' ) ) {
5050
preg_match( '|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url );
51-
$this->base_url = $url[1];
51+
$this->base_url = isset( $url[1] ) ? $url[1] : '';
5252
continue;
5353
}
5454

5555
if ( false !== strpos( $importline, '<wp:base_blog_url>' ) ) {
5656
preg_match( '|<wp:base_blog_url>(.*?)</wp:base_blog_url>|is', $importline, $blog_url );
57-
$this->base_blog_url = $blog_url[1];
57+
$this->base_blog_url = isset( $blog_url[1] ) ? $blog_url[1] : '';
5858
continue;
5959
} elseif ( empty( $this->base_blog_url ) ) {
6060
$this->base_blog_url = $this->base_url;
6161
}
6262

6363
if ( false !== strpos( $importline, '<wp:author>' ) ) {
6464
preg_match( '|<wp:author>(.*?)</wp:author>|is', $importline, $author );
65-
$a = $this->process_author( $author[1] );
66-
$this->authors[ $a['author_login'] ] = $a;
65+
if ( isset( $author[1] ) ) {
66+
$a = $this->process_author( $author[1] );
67+
$this->authors[ $a['author_login'] ] = $a;
68+
}
6769
continue;
6870
}
6971

@@ -72,7 +74,7 @@ public function parse( $file ) {
7274
$pos = strpos( $importline, "<$tag>" );
7375
$pos_closing = strpos( $importline, "</$tag>" );
7476
if ( preg_match( '|<' . $tag . '>(.*?)</' . $tag . '>|is', $importline, $matches ) ) {
75-
$this->{$handler[0]}[] = call_user_func( $handler[1], $matches[1] );
77+
$this->{$handler[0]}[] = call_user_func( $handler[1], isset( $matches[1] ) ? $matches[1] : '' );
7678

7779
} elseif ( false !== $pos ) {
7880
// Take note of any content after the opening tag
@@ -115,14 +117,19 @@ public function parse( $file ) {
115117
}
116118

117119
public function get_tag( $text, $tag ) {
120+
if ( null === $text ) {
121+
return '';
122+
}
118123
preg_match( "|<$tag.*?>(.*?)</$tag>|is", $text, $return );
119124
if ( isset( $return[1] ) ) {
120125
if ( substr( $return[1], 0, 9 ) == '<![CDATA[' ) {
121126
if ( strpos( $return[1], ']]]]><![CDATA[>' ) !== false ) {
122127
preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches );
123128
$return = '';
124-
foreach ( $matches[1] as $match ) {
125-
$return .= $match;
129+
if ( isset( $matches[1] ) ) {
130+
foreach ( $matches[1] as $match ) {
131+
$return .= $match;
132+
}
126133
}
127134
} else {
128135
$return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] );

wp-content/plugins/wordpress-importer/php-toolkit/DataLiberation/BlockMarkup/class-blockmarkupprocessor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ private function block_attribute_updates_to_modifiable_text_updates() {
496496
' ' .
497497
$this->block_name .
498498
' ' .
499-
$encoded_attributes
499+
$encoded_attributes .
500+
( $this->is_self_closing_block() ? '/' : '' )
500501
);
501502

502503
return true;

wp-content/plugins/wordpress-importer/readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: importer, wordpress
55
Requires at least: 5.2
66
Tested up to: 6.8
77
Requires PHP: 7.2
8-
Stable tag: 0.9.3
8+
Stable tag: 0.9.4
99
License: GPLv2 or later
1010
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -40,6 +40,9 @@ If you would prefer to do things manually then follow these instructions:
4040

4141
== Changelog ==
4242

43+
= 0.9.4 =
44+
* Fix a bug that caused self-closing blocks to be incorrectly serialized during URL rewriting.
45+
4346
= 0.9.3 =
4447
* Rewrite attachment URLs to the new URL structure
4548

wp-content/plugins/wordpress-importer/wordpress-importer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
77
* Author: wordpressdotorg
88
* Author URI: https://wordpress.org/
9-
* Version: 0.9.3
9+
* Version: 0.9.4
1010
* Requires at least: 5.2
1111
* Requires PHP: 7.2
1212
* Text Domain: wordpress-importer

0 commit comments

Comments
 (0)