allow some nesting of div elements

This commit is contained in:
Klaus Leithoff 2013-06-03 13:27:19 +00:00
parent 021e37d014
commit 6270bc83f9

View File

@ -229,16 +229,17 @@ function hl_my_tag_transform($element, $attribute_array=0)
*/ */
function hl_email_tag_transform($element, $attribute_array=0) function hl_email_tag_transform($element, $attribute_array=0)
{ {
//error_log(__METHOD__.__LINE__.$element.array2string($attribute_array));
static $lastelement; static $lastelement;
static $throwawaycounter; static $throwawaycounter;
if (is_null($lastelement)) $lastelement=''; if (is_null($lastelement)) $lastelement='';
if (is_null($throwawaycounter)) $throwawaycounter = 0; if (is_null($throwawaycounter)) $throwawaycounter = 0;
//if ($throwawaycounter>250) error_log(__METHOD__.__LINE__.' '.$throwawaycounter); //if ($throwawaycounter>1) error_log(__METHOD__.__LINE__.' '.$throwawaycounter.$element.array2string($attribute_array));
if ($element=='div' && $element==$lastelement && ($attribute_array==0 || empty($attribute_array))) if ($element=='div' && $element==$lastelement && ($attribute_array==0 || empty($attribute_array)))
{ {
if (is_array($attribute_array)) $throwawaycounter++; if (is_array($attribute_array)) $throwawaycounter++;
if ($attribute_array==0 && $throwawaycounter>0) $throwawaycounter--; if ($attribute_array==0 && $throwawaycounter>0) $throwawaycounter--;
if ($throwawaycounter>0) return ''; if ($throwawaycounter>1) return '';
} }
if ($lastelement=='div' && $element!=$lastelement && is_array($attribute_array)) $throwawaycounter = 0; if ($lastelement=='div' && $element!=$lastelement && is_array($attribute_array)) $throwawaycounter = 0;
if (is_array($attribute_array) && !empty($attribute_array) && $element=='div') if (is_array($attribute_array) && !empty($attribute_array) && $element=='div')