diff options
author | Andres Rey <[email protected]> | 2017-11-07 20:12:41 +0000 |
---|---|---|
committer | Andres Rey <[email protected]> | 2017-11-07 20:12:41 +0000 |
commit | 97ded7d0d0c277bf39013b04b87906cb9aa23ddc (patch) | |
tree | cd40fd91be60a1a760b050e1915660dc67787691 /src | |
parent | d31c0c271ff4b8bf64549b03398595f29fe2f9b5 (diff) | |
parent | 2b115d4411147480401756f9d52f15fea768f519 (diff) |
Merge branch 'master' into development-update-to-f0edc77cb58ef52890e3065cf2b0e334d940feb2
Diffstat (limited to 'src')
-rw-r--r-- | src/HTMLParser.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php index f1c3d3e..27dd8e5 100644 --- a/src/HTMLParser.php +++ b/src/HTMLParser.php @@ -97,6 +97,7 @@ class HTMLParser 'fixRelativeURLs' => false, 'substituteEntities' => true, 'normalizeEntities' => false, + 'summonCthulhu' => false, 'originalURL' => 'http://fakehost', ]; @@ -214,6 +215,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'; @@ -463,7 +468,7 @@ class HTMLParser } if (array_key_exists('og:image', $values) || array_key_exists('twitter:image', $values)) { - $metadata['image'] = ($values['og:image']) ? $values['og:image'] : $values['twitter:image']; + $metadata['image'] = array_key_exists('og:image', $values) ? $values['og:image'] : $values['twitter:image']; } else { $metadata['image'] = null; } |