Skip to content

Commit 9379b1d

Browse files
committed
MAGETWO-99479: Use Escaper methods
- update to escaper methods
1 parent 52aa959 commit 9379b1d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

app/code/Magento/PageBuilder/Plugin/Filter/TemplatePlugin.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class TemplatePlugin
1818

1919
const HTML_CONTENT_TYPE_PATTERN = '/data-content-type="html"/si';
2020

21+
/**
22+
* @var \Magento\Framework\Escaper
23+
*/
24+
private $escaper;
25+
2126
/**
2227
* @var \Magento\Framework\View\ConfigInterface
2328
*/
@@ -42,15 +47,20 @@ class TemplatePlugin
4247
* @param \Psr\Log\LoggerInterface $logger
4348
* @param \Magento\Framework\View\ConfigInterface $viewConfig
4449
* @param \Magento\Framework\Math\Random $mathRandom
50+
* @param \Magento\Framework\Escaper|null $escaper
4551
*/
4652
public function __construct(
4753
\Psr\Log\LoggerInterface $logger,
4854
\Magento\Framework\View\ConfigInterface $viewConfig,
49-
\Magento\Framework\Math\Random $mathRandom
55+
\Magento\Framework\Math\Random $mathRandom,
56+
\Magento\Framework\Escaper $escaper = null
5057
) {
5158
$this->logger = $logger;
5259
$this->viewConfig = $viewConfig;
5360
$this->mathRandom = $mathRandom;
61+
$this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
62+
\Magento\Framework\Escaper::class
63+
);
5464
}
5565

5666
/**
@@ -130,7 +140,7 @@ public function aroundCustomvarDirective(
130140

131141
$result = $proceed($construction);
132142

133-
return htmlspecialchars($result);
143+
return $this->escaper->escapeHtml($result);
134144
}
135145

136146
/**

0 commit comments

Comments
 (0)