Skip to content

Commit

Permalink
Resolved error-full merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Riezebos committed Jan 11, 2022
1 parent e0639e3 commit 53b0604
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
18 changes: 0 additions & 18 deletions Plugin/Model/PagePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
5 changes: 4 additions & 1 deletion Resolver/RemotePageResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 53b0604

Please sign in to comment.