forked from extern/egroupware
Revert "reinsert filtered <style></style> section at initial position"
It seems to lead to a significant higher memory usage and did NOT fix the problem it was supposed to fix (empty line above email after sending)
This reverts commit 4e0bb13571
.
This commit is contained in:
parent
662ea62790
commit
52cca3676e
@ -116,9 +116,7 @@ class HtmLawed
|
|||||||
// put it back in after purifying; styles are processed for known security risks
|
// put it back in after purifying; styles are processed for known security risks
|
||||||
// in self::getStyles
|
// in self::getStyles
|
||||||
// we allow filtered style sections now throughout egroupware
|
// we allow filtered style sections now throughout egroupware
|
||||||
/*if ($Config['hook_tag'] =="hl_email_tag_transform")*/
|
/*if ($Config['hook_tag'] =="hl_email_tag_transform")*/ $styles = self::getStyles($html2check);
|
||||||
$replacement = '<style>.something{color:red}</style>';
|
|
||||||
$styles = self::getStyles($html2check, $replacement);
|
|
||||||
//error_log(__METHOD__.__LINE__.array2string($styles));
|
//error_log(__METHOD__.__LINE__.array2string($styles));
|
||||||
//error_log(__METHOD__.__LINE__.' Config:'.array2string($Config));
|
//error_log(__METHOD__.__LINE__.' Config:'.array2string($Config));
|
||||||
|
|
||||||
@ -127,28 +125,17 @@ class HtmLawed
|
|||||||
{
|
{
|
||||||
$Config['hook_tag']=__NAMESPACE__.'\\'.$Config['hook_tag'];
|
$Config['hook_tag']=__NAMESPACE__.'\\'.$Config['hook_tag'];
|
||||||
}
|
}
|
||||||
$validated = htmLawed($html2check, $Config, $Spec);
|
return ($styles?$styles:'').htmLawed($html2check, $Config, $Spec);
|
||||||
if (strpos($validated, $replacement) !== false)
|
|
||||||
{
|
|
||||||
return str_replace($replacement, $styles, $validated);
|
|
||||||
}
|
|
||||||
// htmLawed seems to remove the style tabs
|
|
||||||
elseif (strpos($validated, $replacement=preg_replace('#</?style>#', '', $replacement)) !== false)
|
|
||||||
{
|
|
||||||
return str_replace($replacement, $styles, $validated);
|
|
||||||
}
|
|
||||||
return ($styles?:'').$validated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all style tag definitions, <style> stuff </style> of the html passed in
|
* get all style tag definitions, <style> stuff </style> of the html passed in
|
||||||
* and remove it from input
|
* and remove it from input
|
||||||
* @author Leithoff, Klaus
|
* @author Leithoff, Klaus
|
||||||
* @param string& html
|
* @param string html
|
||||||
* @param string $replace='' text to replace returned styles with, default ""
|
|
||||||
* @return string the style css
|
* @return string the style css
|
||||||
*/
|
*/
|
||||||
static function getStyles(&$html, $replace='')
|
static function getStyles(&$html)
|
||||||
{
|
{
|
||||||
$ct=0;
|
$ct=0;
|
||||||
$newStyle = null;
|
$newStyle = null;
|
||||||
@ -159,7 +146,7 @@ class HtmLawed
|
|||||||
$style2buffer = implode('',$newStyle[0]);
|
$style2buffer = implode('',$newStyle[0]);
|
||||||
// only replace what we have found, we use it here, as we use the same routine in Api\Mail\Html::replaceTagsCompletley
|
// only replace what we have found, we use it here, as we use the same routine in Api\Mail\Html::replaceTagsCompletley
|
||||||
// no need to do the extra routine
|
// no need to do the extra routine
|
||||||
$html = str_ireplace($newStyle[0], $replace, $html);
|
$html = str_ireplace($newStyle[0],'',$html);
|
||||||
}
|
}
|
||||||
if (!empty($style2buffer))
|
if (!empty($style2buffer))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user