Changeset 3859 in subversion
- Timestamp:
- Aug 3, 2010 7:46:13 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/steps/mail/func.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/steps/mail/func.inc
r3845 r3859 988 988 989 989 if ($part->ctype_secondary == 'html') { 990 $body = rcmail_html4inline($body, $attrib['id'], 'rcmBody', $ color);990 $body = rcmail_html4inline($body, $attrib['id'], 'rcmBody', $attrs); 991 991 $div_attr = array('class' => 'message-htmlpart'); 992 if ($color) 993 $div_attr['style'] = 'background-color: '.$color; 992 $style = array(); 993 994 if (!empty($attrs['color'])) 995 $style[] = 'background-color: '.$attrs['color']; 996 if (!empty($attrs['image'])) 997 $style[] = 'background-image: url('.$attrs['image'].')'; 998 if (!empty($style)) 999 $div_attr['style'] = implode('; ', $style); 994 1000 995 1001 $out .= html::div($div_attr, $body); … … 1053 1059 * modify a HTML message that it can be displayed inside a HTML page 1054 1060 */ 1055 function rcmail_html4inline($body, $container_id, $body_id='', &$ body_color='')1061 function rcmail_html4inline($body, $container_id, $body_id='', &$attributes=null) 1056 1062 { 1057 1063 $last_style_pos = 0; … … 1106 1112 $body); 1107 1113 1108 // Get rcmBody's bgcolor attribute, we'll set the color to the body container 1109 // as background-color, bgcolor doesn't work with a div 1110 if (preg_match('/<div class="' . preg_quote($body_id, '/') . '" ([^>]+)>/', $out, $m)) { 1111 if (preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $m[0], $mb)) { 1112 $body_color = $mb[1]; 1113 } 1114 $attributes = array(); 1115 1116 // Handle body attributes that doesn't play nicely with div elements 1117 if (preg_match('/<div class="' . preg_quote($body_id, '/') . '" ([^>]+)/', $out, $m)) { 1118 $attrs = $m[0]; 1119 // Get bgcolor, we'll set it as background-color of the message container 1120 if (preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $attrs, $mb)) { 1121 $attributes['color'] = $mb[1]; 1122 $attrs = preg_replace('/bgcolor=["\']*([a-z0-9#]+)["\']*/', '', $attrs); 1123 } 1124 // Get background, we'll set it as background-image of the message container 1125 if (preg_match('/background=["\']*([^"\'>\s]+)["\']*/', $attrs, $mb)) { 1126 $attributes['image'] = $mb[1]; 1127 $attrs = preg_replace('/background=["\']*([^"\'>\s]+)["\']*/', '', $attrs); 1128 } 1129 if (!empty($attributes)) 1130 $out = preg_replace('/<div class="' . preg_quote($body_id, '/') . '" [^>]+/', rtrim($attrs), $out, 1); 1114 1131 } 1115 1132 // make sure there's 'rcmBody' div, we need it for proper css modification
Note: See TracChangeset
for help on using the changeset viewer.
