Skip to content

Commit 64948d6

Browse files
committed
Patch: Apply html_replacements in any notification
1 parent e974656 commit 64948d6

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

src/Helpers/Purifiable.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace PanicHD\PanicHD\Helpers;
4+
5+
use PanicHD\PanicHD\Traits\Purifiable as Main;
6+
7+
/**
8+
* This file containes the version of different external JS and CSS libraries
9+
* that are included.
10+
*
11+
* Class Cdn
12+
*/
13+
class Purifiable
14+
{
15+
use Main;
16+
17+
}

src/Views/emails/partial/html_field.blade.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?php
22
$dom = new \DomDocument();
33
4-
if ($dom->loadHtml( mb_convert_encoding('<div>' . $html_field . '</div>', 'HTML-ENTITIES', "UTF-8"), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD)){
4+
$purifiable = new PanicHD\PanicHD\Helpers\Purifiable();
5+
$processed_html = $purifiable->getReplaced($html_field);
6+
7+
if ($dom->loadHtml( mb_convert_encoding('<div>' . $processed_html . '</div>', 'HTML-ENTITIES', "UTF-8"), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD)){
58
69
$container = $dom->getElementsByTagName('div')->item(0);
710
$container = $container->parentNode->removeChild($container);
@@ -35,6 +38,6 @@
3538
3639
}else{
3740
\Log::warning('HMTL could not be processed for ' . $field . ' field in ticket #' . $ticket->id);
38-
echo $html_field;
41+
echo $processed_html;
3942
}
40-
?>
43+
?>

0 commit comments

Comments
 (0)