Skip to content

Commit

Permalink
Merge pull request #64 from mooore-digital/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DanielRiezebos authored Jan 11, 2022
2 parents e19a66a + 3ba8ed1 commit c7c1cbd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.7] - 2022-01-11
### Fixed
- Resolved wrongly fixed merge conflict

## [0.8.6] - 2022-01-10
### Fixed
- Sometimes double-dashes gets encoded to one from API
Expand Down
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 c7c1cbd

Please sign in to comment.