From d580b866861be5ec5d52596f9e2b5e95b3255067 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 22 Aug 2024 17:51:40 +0200 Subject: [PATCH] wait #7048 @3 --- app/Models/ToolWebflow.php | 4 +++- app/Services/Webflow.php | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Models/ToolWebflow.php b/app/Models/ToolWebflow.php index 133f9d7a5..69f8102ba 100644 --- a/app/Models/ToolWebflow.php +++ b/app/Models/ToolWebflow.php @@ -533,7 +533,9 @@ class ToolWebflow extends ToolboxTranslatableModel // Texts foreach ($texts as $text => $translation) { - $html = str_replace('>' . $text . '<', '>' . $translation . '<', $html); + $pattern = '/>(\s*)(' . addcslashes($text, './()[]{}') . ')(\s*)${1}' . $translation . '${3}<', $html); } // Images diff --git a/app/Services/Webflow.php b/app/Services/Webflow.php index 5b1c4beb9..15c57f80b 100644 --- a/app/Services/Webflow.php +++ b/app/Services/Webflow.php @@ -382,8 +382,7 @@ class Webflow protected static function addTexts($texts, &$array) { foreach ($texts as $t) { - $t = trim($t); - if (!$t) { + if (!trim($t)) { continue; } $paragraphs = preg_split('/\v{2,}/', $t); -- 2.39.5