From 10b34530a89368f689f66951d4552d346769b888 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 20 Jul 2022 13:44:29 +0200 Subject: [PATCH] Fix converting of Wordpress messages Improved converting of paragraphs and quotes. --- .../system/exporter/WordPress3xExporter.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/files/lib/system/exporter/WordPress3xExporter.class.php b/files/lib/system/exporter/WordPress3xExporter.class.php index cc2cea5..8b72302 100644 --- a/files/lib/system/exporter/WordPress3xExporter.class.php +++ b/files/lib/system/exporter/WordPress3xExporter.class.php @@ -4,6 +4,7 @@ namespace wcf\system\exporter; use wcf\data\article\Article; use wcf\system\database\util\PreparedStatementConditionBuilder; +use wcf\system\html\input\HtmlInputProcessor; use wcf\system\importer\ImportHandler; use wcf\system\WCF; use wcf\util\StringUtil; @@ -665,8 +666,6 @@ class WordPress3xExporter extends AbstractExporter */ private static function fixMessage($string) { - $string = \str_replace("\n", "
\n", StringUtil::unifyNewlines($string)); - // replace media $string = \preg_replace_callback( '~~is', @@ -702,6 +701,17 @@ class WordPress3xExporter extends AbstractExporter $string ); + $processor = new HtmlInputProcessor(); + $processor->process($string, 'com.woltlab.wcf.article.content'); + $string = $processor->getHtml(); + + $string = \str_replace("

", "


", $string); + /* Remove trailing linebreak in quotes */ + $string = \preg_replace("~


(?=\s*)~", '', $string); + + $string = \str_replace("
", "", $string); + $string = \str_replace("
", "", $string); + return $string; } } -- 2.20.1