diff options
author | Art4 <[email protected]> | 2015-02-19 23:17:43 +0100 |
---|---|---|
committer | Art4 <[email protected]> | 2015-02-19 23:17:43 +0100 |
commit | d9c042c4c536f1afbf206aeea09b0b127b7b6418 (patch) | |
tree | 9d7ef18c6d9d4c8f8f4d1c9a5dbfceeb9fd5acf4 /plugins/no_iframes | |
parent | cf42b79120290ee5866136a0c4656e6999f06045 (diff) | |
parent | 4ca621a36016de1fbb5447e1c1de0b607ba94a7c (diff) |
Merge branch 'master' into patch-1
Conflicts:
locale/de_DE/LC_MESSAGES/messages.po
Diffstat (limited to 'plugins/no_iframes')
-rw-r--r-- | plugins/no_iframes/init.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/no_iframes/init.php b/plugins/no_iframes/init.php index c66d7abaf..35f7187f5 100644 --- a/plugins/no_iframes/init.php +++ b/plugins/no_iframes/init.php @@ -4,7 +4,7 @@ class No_Iframes extends Plugin { function about() { return array(1.0, - "Remove embedded iframes", + "Remove embedded iframes (unless whitelisted)", "fox"); } @@ -16,7 +16,13 @@ class No_Iframes extends Plugin { function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) { - $allowed_elements = array_diff($allowed_elements, array("iframe")); + $xpath = new DOMXpath($doc); + $entries = $xpath->query('//iframe'); + + foreach ($entries as $entry) { + if (!iframe_whitelisted($entry)) + $entry->parentNode->removeChild($entry); + } return array($doc, $allowed_elements, $disallowed_attributes); } |