From 33da0b48b343609a46e200afc814d75fba589057 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 29 Sep 2010 13:53:13 -0400
Subject: [PATCH] - Allow setting some washtml options from plugin (#1486578)

---
 CHANGELOG                   |    1 +
 program/steps/mail/func.inc |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index b950610..f3f2b79 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
 - Add option to "Return receipt" will be always checked (#1486352)
 - Fix HTML to plain text conversion doesn't handle citation blocks (#1486921)
 - Use custom sorting when SORT is disabled by IMAP admin (#1486959)
+- Allow setting some washtml options from plugin (#1486578)
 
 RELEASE 0.4.1
 -------------
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index d7c6523..4dd6d8b 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -695,11 +695,21 @@
     $wash_opts['html_attribs'] = array('rel','type');
   }
 
+  // overwrite washer options with options from plugins
+  if (isset($p['html_elements']))
+    $wash_opts['html_elements'] = $p['html_elements'];
+  if (isset($p['html_attribs']))
+    $wash_opts['html_attribs'] = $p['html_attribs'];
+
+  // initialize HTML washer
   $washer = new washtml($wash_opts);
-  $washer->add_callback('form', 'rcmail_washtml_callback');
+
+  if (!$p['skip_washer_form_callback'])
+    $washer->add_callback('form', 'rcmail_washtml_callback');
 
   // allow CSS styles, will be sanitized by rcmail_washtml_callback()
-  $washer->add_callback('style', 'rcmail_washtml_callback');
+  if (!$p['skip_washer_style_callback'])
+    $washer->add_callback('style', 'rcmail_washtml_callback');
 
   $html = $washer->wash($html);
   $REMOTE_OBJECTS = $washer->extlinks;

--
Gitblit v1.9.1