diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-09-19 17:11:22 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-09-19 17:11:22 +0000 |
| commit | e0dd57bf933576d098adb1be97c6a3d6c809449f (patch) | |
| tree | 7c92341ae229732bd9f09957f71188f6b723410e /roundcubemail/program | |
| parent | 2e8c2cb7bed1e60ef24a4d79ffdd361c8c727e9b (diff) | |
Create valid <a> tags
git-svn-id: https://svn.roundcube.net/trunk@1851 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/steps/mail/func.inc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc index 49dfe5f6a..567675772 100644 --- a/roundcubemail/program/steps/mail/func.inc +++ b/roundcubemail/program/steps/mail/func.inc @@ -977,24 +977,27 @@ function rcmail_html4inline($body, $container_id) * parse link attributes and set correct target */ function rcmail_alter_html_link($tag, $attrs, $container_id) - { +{ $attrib = parse_attrib_string($attrs); + $end = '>'; - if ($tag == 'link' && preg_match('/^https?:\/\//i', $attrib['href'])) + if ($tag == 'link' && preg_match('/^https?:\/\//i', $attrib['href'])) { $attrib['href'] = "./bin/modcss.php?u=" . urlencode($attrib['href']) . "&c=" . urlencode($container_id); - - else if (stristr((string)$attrib['href'], 'mailto:')) + $end = ' />'; + } + else if (stristr((string)$attrib['href'], 'mailto:')) { $attrib['onclick'] = sprintf( "return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ(substr($attrib['href'], 7))); - - else if (!empty($attrib['href']) && $attrib['href']{0}!='#') + } + else if (!empty($attrib['href']) && $attrib['href'][0] != '#') { $attrib['target'] = '_blank'; - - return "<$tag" . create_attrib_string($attrib, array('href','name','target','onclick','id','class','style','title','rel','type','media')) . ' />'; } + return "<$tag" . html::attrib_string($attrib, array('href','name','target','onclick','id','class','style','title','rel','type','media')) . $end; +} + /** * decode address string and re-format it as HTML links |
