@@ -18,6 +18,11 @@ class TemplatePlugin
18
18
19
19
const HTML_CONTENT_TYPE_PATTERN = '/data-content-type="html"/si ' ;
20
20
21
+ /**
22
+ * @var \Magento\Framework\Escaper
23
+ */
24
+ private $ escaper ;
25
+
21
26
/**
22
27
* @var \Magento\Framework\View\ConfigInterface
23
28
*/
@@ -42,15 +47,20 @@ class TemplatePlugin
42
47
* @param \Psr\Log\LoggerInterface $logger
43
48
* @param \Magento\Framework\View\ConfigInterface $viewConfig
44
49
* @param \Magento\Framework\Math\Random $mathRandom
50
+ * @param \Magento\Framework\Escaper|null $escaper
45
51
*/
46
52
public function __construct (
47
53
\Psr \Log \LoggerInterface $ logger ,
48
54
\Magento \Framework \View \ConfigInterface $ viewConfig ,
49
- \Magento \Framework \Math \Random $ mathRandom
55
+ \Magento \Framework \Math \Random $ mathRandom ,
56
+ \Magento \Framework \Escaper $ escaper = null
50
57
) {
51
58
$ this ->logger = $ logger ;
52
59
$ this ->viewConfig = $ viewConfig ;
53
60
$ this ->mathRandom = $ mathRandom ;
61
+ $ this ->escaper = $ escaper ?? \Magento \Framework \App \ObjectManager::getInstance ()->get (
62
+ \Magento \Framework \Escaper::class
63
+ );
54
64
}
55
65
56
66
/**
@@ -130,7 +140,7 @@ public function aroundCustomvarDirective(
130
140
131
141
$ result = $ proceed ($ construction );
132
142
133
- return htmlspecialchars ($ result );
143
+ return $ this -> escaper -> escapeHtml ($ result );
134
144
}
135
145
136
146
/**
0 commit comments