From af782d1fc7b05e8884d943ef769ed39c35b7158d Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 31 Jul 2012 10:59:56 +0000 Subject: [PATCH] simple balancing on throwaway divs --- phpgwapi/inc/class.egw_htmLawed.inc.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.egw_htmLawed.inc.php b/phpgwapi/inc/class.egw_htmLawed.inc.php index 20735d00f4..27f335a947 100644 --- a/phpgwapi/inc/class.egw_htmLawed.inc.php +++ b/phpgwapi/inc/class.egw_htmLawed.inc.php @@ -197,7 +197,15 @@ function hl_my_tag_transform($element, $attribute_array=0) function hl_email_tag_transform($element, $attribute_array=0) { static $lastelement; - if ($element=='div' && $element==$lastelement && ($attribute_array==0 || empty($attribute_array))) return ''; + static $throwawaycounter; + if (is_null($throwawaycounter)) $throwawaycounter = 0; + //if ($throwawaycounter>250) error_log(__METHOD__.__LINE__.' '.$throwawaycounter); + if ($element=='div' && $element==$lastelement && ($attribute_array==0 || empty($attribute_array))) + { + if (is_array($attribute_array)) $throwawaycounter++; + if ($attribute_array==0 && $throwawaycounter>0) $throwawaycounter--; + if ($throwawaycounter>0) return ''; + } if (is_array($attribute_array) && !empty($attribute_array) && $element=='div') { $lastelement = 'div_with_attr';