forked from extern/egroupware
rework of translation::replaceTagsCompletley as the prior method removed too much in rare cases
This commit is contained in:
parent
264868adaf
commit
04760c6510
@ -1590,6 +1590,9 @@ egw_LAB.wait(function() {
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($newStyle[0]));
|
||||
$style2buffer = implode('',$newStyle[0]);
|
||||
// only replace what we have found, we use it here, as we use the same routine in translation::replaceTagsCompletley
|
||||
// no need to do the extra routine
|
||||
$html = str_ireplace($newStyle[0],'',$html);
|
||||
}
|
||||
if ($style2buffer)
|
||||
{
|
||||
@ -1621,8 +1624,10 @@ egw_LAB.wait(function() {
|
||||
// as the comments as <!-- styledefinition --> in stylesheet are outdated, and ck-editor does not understand it, we remove it
|
||||
$css_no_comment = str_replace(array(':','<!--','-->'),array(': ','',''),$css);
|
||||
//error_log(__METHOD__.__LINE__.$css);
|
||||
// we already removed what we have found, above, as we used pretty much the same routine as in translation::replaceTagsCompletley
|
||||
// no need to do the extra routine
|
||||
// TODO: we may have to strip urls and maybe comments and ifs
|
||||
if (stripos($html,'style')!==false) translation::replaceTagsCompletley($html,'style'); // clean out empty or pagewide style definitions / left over tags
|
||||
//if (stripos($html,'style')!==false) translation::replaceTagsCompletley($html,'style'); // clean out empty or pagewide style definitions / left over tags
|
||||
return $css_no_comment;
|
||||
}
|
||||
}
|
||||
|
@ -1086,15 +1086,31 @@ class translation
|
||||
}
|
||||
else
|
||||
{
|
||||
$found=null;
|
||||
if ($addbracesforendtag === true )
|
||||
{
|
||||
$_body = preg_replace('~<'.$tag.'[^>]*?>(.*?)</'.$endtag.'[\s]*>~simU','',$_body);
|
||||
if (stripos($_body,'<'.$tag)!==false) $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)</'.$endtag.'>#isU', $_body, $found);
|
||||
if ($ct>0)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($found[0]));
|
||||
// only replace what we have found
|
||||
$_body = str_ireplace($found[0],'',$_body);
|
||||
}
|
||||
// remove left over tags, unfinished ones, and so on
|
||||
$_body = preg_replace('~<'.$tag.'[^>]*?>~si','',$_body);
|
||||
}
|
||||
if ($addbracesforendtag === false )
|
||||
{
|
||||
if (stripos($_body,'<'.$tag)!==false) $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)'.$endtag.'#isU', $_body, $found);
|
||||
if ($ct>0)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($found[0]));
|
||||
// only replace what we have found
|
||||
$_body = str_ireplace($found[0],'',$_body);
|
||||
}
|
||||
/*
|
||||
$_body = preg_replace('~<'.$tag.'[^>]*?>(.*?)'.$endtag.'~simU','',$_body);
|
||||
*/
|
||||
// remove left over tags, unfinished ones, and so on
|
||||
$_body = preg_replace('~<'.$tag.'[^>]*?>~si','',$_body);
|
||||
$_body = preg_replace('~'.$endtag.'~','',$_body);
|
||||
|
Loading…
Reference in New Issue
Block a user