From: Marcel Werk Date: Wed, 20 Jul 2022 11:44:29 +0000 (+0200) Subject: Fix converting of Wordpress messages X-Git-Tag: 5.4.22~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=10b34530a89368f689f66951d4552d346769b888;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.exporter.git Fix converting of Wordpress messages Improved converting of paragraphs and quotes. --- 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; } }