Ok. It seems, now it splits "normally" (of course, for avoiding splits, you have to enter 'spaces' more often :)
We will fix this in next release, for those, who can't wait, here is a solution for more correct words splitting, just replace function warpText() to that:
function wrapText($wrap,$text){ $ft=0; $exploded=explode(' ',$text); for($i=0;$i<sizeof($exploded);$i++) { $str=$exploded[$i];
if (substr_count($str, '<')>0 or substr_count($str, '>')>0 or substr_count($str, '&#')>0 or substr_count($str, '"')>0 or substr_count($str, '&')>0 or substr_count($str, '<')>0 or substr_count($str, '>')>0) $ft=1; else $ft=0;
if (strlen($str)<$wrap and $ft!=0) $dT=TRUE;
if(strlen($str)>$wrap and $ft!=0) {
$sf=FALSE; $qf=0; $chkPhr=''; $sym=0; for ($a=0; $a<strlen($str); $a++) { if ($qf==2) $qf=0; if ($str[$a]=="\n") { $sym=0; }
if ($str[$a]=='<') { $qf=1; $ft=0; $dT=TRUE; } elseif ($str[$a]=='>') { $qf=2; $ft=0; $dT=FALSE; }
if ($str[$a]=='&' and isset($str[$a+1]) and ($str[$a+1]=='#' or substr($str,$a+1,4)=='quot' or substr($str,$a+1,3)=='amp') or substr($str,$a+1,2)=='lt' or substr($str,$a+1,2)=='gt') { $sf=TRUE; } if ($sf and $str[$a]==';') { $sf=FALSE; }
if ($qf>=1 or $dT) { $chkPhr.=$str[$a]; } elseif($qf==0) { if(!$sf) $sym++; if ($sym<$wrap) $chkPhr.=$str[$a]; else {$chkPhr.=$str[$a].' '; $sym=0;} } } //cycle
if (strlen($chkPhr)>0) $exploded[$i]=$chkPhr; $sym=0; $qf=0; $chkPhr=''; } elseif (strlen($str)>$wrap and !$dT) $exploded[$i]=chunk_split($exploded[$i],$wrap,' ');
} //i cycle
return implode(' ',$exploded); } |