Index: htmlpurifier/HTMLPurifier_DefinitionCache_Drupal.php
===================================================================
--- htmlpurifier/HTMLPurifier_DefinitionCache_Drupal.php (revision 34)
+++ htmlpurifier/HTMLPurifier_DefinitionCache_Drupal.php (working copy)
@@ -93,3 +93,21 @@
}
+class HTMLPurifier_Filter_MyIframe extends HTMLPurifier_Filter
+{
+ public $name = 'MyIframe';
+
+ public function preFilter($html, $config, $context) {
+ return preg_replace("/iframe/", "img class=\"MyIframe\" ", preg_replace("/<\/iframe>/", "", $html));
+ }
+
+ public function postFilter($html, $config, $context) {
+ $post_regex = '#]+)>#';
+ return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
+ }
+
+ protected function postFilterCallback($matches) {
+ return '';
+ }
+}
+
Index: htmlpurifier/htmlpurifier.module
===================================================================
--- htmlpurifier/htmlpurifier.module (revision 34)
+++ htmlpurifier/htmlpurifier.module (working copy)
@@ -312,6 +312,9 @@
$config->set('Core.AggressivelyFixLt', TRUE);
$config->set('Cache.DefinitionImpl', 'Drupal');
+ // added for iframe support
+ $config->set('Filter.Custom', array( new HTMLPurifier_Filter_MyIframe() ));
+
// Filter HTML doesn't allow external images, so neither will we...
// for now. This can be configured off.
$config->set('URI.DisableExternalResources', TRUE);