summaryrefslogtreecommitdiff
path: root/src/HTMLParser.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/HTMLParser.php')
-rw-r--r--src/HTMLParser.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php
index 9aa9974..b1a5809 100644
--- a/src/HTMLParser.php
+++ b/src/HTMLParser.php
@@ -96,6 +96,7 @@ class HTMLParser
'fixRelativeURLs' => false,
'substituteEntities' => true,
'normalizeEntities' => false,
+ 'summonCthulhu' => false,
'originalURL' => 'http://fakehost',
];
@@ -212,6 +213,10 @@ class HTMLParser
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
}
+ if($this->getConfig()->getOption('summonCthulhu')){
+ $html = preg_replace('/<script\b[^>]*>([\s\S]*?)<\/script>/', '', $html);
+ }
+
// Prepend the XML tag to avoid having issues with special characters. Should be harmless.
$dom->loadHTML('<?xml encoding="UTF-8">' . $html);
$dom->encoding = 'UTF-8';