attempt to improve overlong-word-control behavior

This commit is contained in:
Klaus Leithoff 2012-11-07 07:54:50 +00:00
parent e9393e1cb5
commit a406e83b2d

View File

@ -1679,25 +1679,38 @@ class infolog_ui
{
continue;
}
$cont = explode(' ', $content[$key]);
$ckarray = array();
foreach($cont as &$word)
$contlines = explode("\n", $content[$key]);
$clarray = array();
foreach ($contlines as &$line)
{
// set blank behind all , and . if words are too long, apply wordwrap afterwards to make sure we get
if (strlen($word)>75)
if(strlen($line) < 75)
{
$buff = html::activate_links($word);
if (strlen($buff) == strlen($word)) // no links -> try to break overlong words
{
if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word);
if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word);
$word = wordwrap($word, 75, ' ', true);
}
$clarray[] = $line;
continue;
}
$ckarray[] =$word;
$cont = explode(' ', $line);
$ckarray = array();
foreach($cont as &$word)
{
// set blank behind all , and . if words are too long, apply wordwrap afterwards to make sure we get
if (strlen($word)>75)
{
$buff = html::activate_links($word);
if (strlen($buff) == strlen($word)) // no links -> try to break overlong words
{
if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word);
if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word);
$word = wordwrap($word, 75, ' ', true);
}
}
$ckarray[] =$word;
}
$line = join(' ',$ckarray);
unset($ckarray);
$clarray[] = $line;
}
$content[$key] = join(' ',$ckarray);
unset($ckarray);
$content[$key] = join("\n",$clarray);
unset($clarray);
}
if (is_numeric($_REQUEST['cat_id']))
{