summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-03-02 13:21:52 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-03-02 13:21:52 +0000
commit9ce66dd16c281d6fb3f927edaa16ec32c656a0a8 (patch)
tree00b18658176428996251f93fc255fdfbd92a88b0
parent9cc05ace81e35ea9ea4ead8b8d4917f4e38350c6 (diff)
Add callback for <a> tags to add target=_blank
git-svn-id: https://svn.roundcube.net/trunk@2322 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/steps/mail/func.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc
index e947a27c4..702625cea 100644
--- a/roundcubemail/program/steps/mail/func.inc
+++ b/roundcubemail/program/steps/mail/func.inc
@@ -707,6 +707,7 @@ function rcmail_wash_html($html, $p = array(), $cid_replaces)
}
$washer = new washtml($wash_opts);
+ $washer->add_callback('a', 'rcmail_washtml_callback');
$washer->add_callback('form', 'rcmail_washtml_callback');
if ($p['safe']) { // allow CSS styles, will be sanitized by rcmail_washtml_callback()
@@ -819,6 +820,11 @@ function rcmail_washtml_callback($tagname, $attrib, $content)
$out = html::div('form', $content);
break;
+ case 'a':
+ if ($attrib) $attrib .= ' target="_blank"';
+ $out = '<a'.$attrib.'>' . $content . '</a>';
+ break;
+
case 'style':
// decode all escaped entities and reduce to ascii strings
$stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entitiy_decode($content));