Skip to content

Commit 881b723

Browse files
Style tag and its content removed from description (#495)
1 parent bbb7d3a commit 881b723

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app/code/Meta/Catalog/Model/Product/Feed/Builder.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,14 @@ private function getDescription(Product $product)
412412

413413
// phpcs:ignore
414414
$description = html_entity_decode($description);
415+
416+
// remove style tag and its content from description
417+
// phpcs:ignore
418+
$description = html_entity_decode(preg_replace(
419+
'/<\s*style.+?<\s*\/\s*style.*?>/',
420+
'',
421+
$description
422+
));
415423
// phpcs:ignore
416424
$description = html_entity_decode(preg_replace('/<[^<]+?>/', '', $description));
417425
return $this->builderTools->lowercaseIfAllCaps($description);
@@ -439,6 +447,17 @@ private function getRichDescription(Product $product)
439447
return '';
440448
}
441449

450+
// phpcs:ignore
451+
$description = html_entity_decode($description);
452+
453+
// remove style tag and its content from description
454+
// phpcs:ignore
455+
$description = html_entity_decode(preg_replace(
456+
'/<\s*style.+?<\s*\/\s*style.*?>/',
457+
'',
458+
$description
459+
));
460+
442461
return $this->trimAttribute(
443462
self::ATTR_RICH_DESCRIPTION,
444463
strip_tags($description, self::ALLOWED_TAGS_FOR_RICH_TEXT_DESCRIPTION)

0 commit comments

Comments
 (0)