diff --git a/Plugin/Model/PagePlugin.php b/Plugin/Model/PagePlugin.php index 1dce364..0d8d551 100644 --- a/Plugin/Model/PagePlugin.php +++ b/Plugin/Model/PagePlugin.php @@ -6,7 +6,6 @@ use Magento\Cms\Model\Page; use Magento\Framework\Exception\LocalizedException; -use Mooore\WordpressIntegrationCms\Model\RemotePageRepository; use Mooore\WordpressIntegrationCms\Resolver\RemotePageResolver; class PagePlugin @@ -38,23 +37,6 @@ public function aroundGetContent(Page $subject, callable $proceed) return $proceed(); } - $html = $remotePage['content']['rendered']; - - $html = preg_replace_callback("{{{(.*)}}}", function ($matches) { - $match = $matches[0]; - - // Solve wierd encoding from Wordpress API regarding double-dashes - $match = preg_replace('/([^\s])–([^\s])/m', '$1--$2', $match); - - $match = html_entity_decode($match); - $match = str_replace('”', '"', $match); // Opening quote - $match = str_replace('″', '"', $match); // Ending quote - $match = str_replace('“', '``', $match); // Double quotes - return $match; - }, $html); - - $this->remotePageContentCache[$remotePageId] = $html; - return $html; } } diff --git a/Resolver/RemotePageResolver.php b/Resolver/RemotePageResolver.php index 96fa721..6f9b861 100644 --- a/Resolver/RemotePageResolver.php +++ b/Resolver/RemotePageResolver.php @@ -43,9 +43,12 @@ public function resolve(int $siteId, int $pageId): ?string /** @var string $html */ $html = $remotePage['content']['rendered']; - $html = preg_replace_callback("{{(.*)}}", function ($matches) { + $html = preg_replace_callback("{{{(.*)}}}", function ($matches) { $match = $matches[0]; + // Solve wierd encoding from Wordpress API regarding double-dashes + $match = preg_replace('/([^\s])–([^\s])/m', '$1--$2', $match); + $match = html_entity_decode($match); $match = str_replace('”', '"', $match); // Opening quote $match = str_replace('″', '"', $match); // Ending quote