File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph
lib/internal/Magento/Framework/View Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 10
10
?>
11
11
12
12
<meta property="og:type" content="og:product" />
13
- <meta property="og:title" content="<?php /* @escapeNotVerified */ echo $ block ->stripTags ($ block ->getProduct ()->getName ()); ?> " />
14
- <meta property="og:image" content="<?php /* @escapeNotVerified */ echo $ block ->stripTags ($ block ->getImage ($ block ->getProduct (), 'product_base_image ' )->getImageUrl ()); ?> " />
15
- <meta property="og:description" content="<?php /* @escapeNotVerified */ echo $ block ->stripTags ($ block ->getProduct ()->getShortDescription ()); ?> " />
16
- <meta property="og:url" content="<?php /* @escapeNotVerified */ echo $ block ->stripTags ($ block ->getProduct ()->getProductUrl ()); ?> " />
13
+ <meta property="og:title" content="<?php echo $ block ->escapeHtml ($ block ->getProduct ()->getName ()); ?> " />
14
+ <meta property="og:image" content="<?php echo $ block ->escapeHtml ($ block ->getImage ($ block ->getProduct (), 'product_base_image ' )->getImageUrl ()); ?> " />
15
+ <meta property="og:description" content="<?php echo $ block ->escapeHtml ($ block ->getProduct ()->getShortDescription ()); ?> " />
16
+ <meta property="og:url" content="<?php echo $ block ->escapeHtml ($ block ->getProduct ()->getProductUrl ()); ?> " />
17
17
<?php if ($ priceAmount = $ block ->getProduct ()->getFinalPrice ()):?>
18
18
<meta property="product:price:amount" content="<?php /* @escapeNotVerified */ echo $ priceAmount ; ?> "/>
19
19
<?php echo $ block ->getChildHtml ('meta.currency ' ); ?>
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ public function getTitle()
216
216
public function setMetadata ($ name , $ content )
217
217
{
218
218
$ this ->build ();
219
- $ this ->metadata [$ name ] = $ content ;
219
+ $ this ->metadata [$ name ] = htmlentities ( $ content) ;
220
220
}
221
221
222
222
/**
Original file line number Diff line number Diff line change @@ -133,8 +133,10 @@ public function testMetadata()
133
133
'keywords ' => null ,
134
134
'robots ' => null ,
135
135
'name ' => 'test_value ' ,
136
+ 'html_encoded ' => '<title><span class="test">Test</span></title> ' ,
136
137
];
137
138
$ this ->model ->setMetadata ('name ' , 'test_value ' );
139
+ $ this ->model ->setMetadata ('html_encoded ' , '<title><span class="test">Test</span></title> ' );
138
140
$ this ->assertEquals ($ expectedMetadata , $ this ->model ->getMetadata ());
139
141
}
140
142
You can’t perform that action at this time.
0 commit comments