More effective solution is replacing code (in jcomments.class.php):
/**
* Inserts a separator in a very long continuous sequences of characters
* @static
* @param $text string The input string.
* @param $maxLength int The maximum length of sequence.
* @param $customBreaker string The custom string to be used as breaker.
* @return string Returns the altered string.
*/
function fixLongWords( $text, $maxLength, $customBreaker = '')
{
$maxLength = (int) min(65535, $maxLength);
if ($maxLength > 5) {
ob_start();
if ($customBreaker == '') {
if (!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
$breaker = '<span style="margin: 0 -0.65ex 0 -1px;padding:0;"> </span>';
} else {
$breaker = '<span style="font-size:0;padding:0;margin:0;"> </span>';
}
} else {
$breaker = $customBreaker;
}
$plainText = $text;
$plainText = preg_replace('#<img[^\>]+/>#isU', '', $plainText);
$plainText = preg_replace('#<a.*?>(.*?)</a>#isU', '', $plainText);
$plainText = preg_replace('#<object.*?>(.*?)</object>#isU', '', $plainText);
$plainText = preg_replace('#<code.*?>(.*?)</code>#isU', '', $plainText);
$plainText = preg_replace('#<embed.*?>(.*?)</embed>#isU', '', $plainText);
$plainText = preg_replace('#(^|\s|\>|\()((http://|https://|news://|ftp://|www.)\w+[^\s\[\]\<\>\"\'\)]+)#i', '', $plainText);
$matches = array();
$matchCount = preg_match_all('#([^\s<>\'\"/\.\x133\x151\\-\?&%=\n\r\%]{'.$maxLength.'})#i' . JCOMMENTS_PCRE_UTF8, $plainText, $matches);
for ($i = 0; $i < $matchCount; $i++) {
$text = preg_replace("#(".preg_quote($matches[1][$i], '#').")#i" . JCOMMENTS_PCRE_UTF8, "\\1".$breaker, $text);
}
$text = preg_replace('#('.preg_quote($breaker, '#').'\s)#i' . JCOMMENTS_PCRE_UTF8, " ", $text);
unset($matches);
ob_end_clean();
}
return $text;
}
with
/**
* @param $str The input string.
* @param $width The column width.
* @param $break The line is broken using the optional break parameter.
* @param bool $cut If the cut is set to TRUE, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken apart.
* @return string
*/
function wordwrap($str, $width, $break, $cut = false)
{
if (JCOMMENTS_JVERSION == '1.5') {
if (!$cut) {
$regexp = '#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$width.',}\b#U';
} else {
$regexp = '#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$width.'}#';
}
$i = 1;
$j = ceil(JCommentsText::strlen($str) / $width);
$return = '';
while ($i < $j) {
preg_match($regexp, $str, $matches);
$return .= $matches[0] . $break;
$str = JString::substr($str, JCommentsText::strlen($matches[0]));
$i++;
}
return $return . $str;
} else {
return wordwrap($str, $width, $break, $cut);
}
}
/**
* Inserts a separator in a very long continuous sequences of characters
* @static
* @param $text string The input string.
* @param $maxLength int The maximum length of sequence.
* @param $customBreaker string The custom string to be used as breaker.
* @return string Returns the altered string.
*/
function fixLongWords( $text, $maxLength, $customBreaker = '')
{
$maxLength = (int) min(65535, $maxLength);
if ($maxLength > 5) {
ob_start();
if ($customBreaker == '') {
if (!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
$breaker = '<span style="margin: 0 -0.65ex 0 -1px;padding:0;"> </span>';
} else {
$breaker = '<span style="font-size:0;padding:0;margin:0;"> </span>';
}
} else {
$breaker = $customBreaker;
}
$plainText = $text;
$plainText = preg_replace('#<br\s?/?>#is'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$plainText = preg_replace('#<img[^\>]+/>#is'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$plainText = preg_replace('#<a.*?>(.*?)</a>#is'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$plainText = preg_replace('#<span class="quote">(.*?)</span>#is', '', $plainText);
$plainText = preg_replace('#<pre.*?>(.*?)</pre>#is'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$plainText = preg_replace('#<blockquote.*?>(.*?)</blockquote>#is'. JCOMMENTS_PCRE_UTF8, '\\1 ', $plainText);
$plainText = preg_replace('#<code.*?>(.*?)</code>#is'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$plainText = preg_replace('#<embed.*?>(.*?)</embed>#is'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$plainText = preg_replace('#<object.*?>(.*?)</object>#is'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$plainText = preg_replace('#(^|\s|\>|\()((http://|https://|news://|ftp://|www.)\w+[^\s\[\]\<\>\"\'\)]+)#i'. JCOMMENTS_PCRE_UTF8, '', $plainText);
$words = explode(' ', $plainText);
foreach($words as $word) {
if (JCommentsText::strlen($word) > $maxLength) {
$text = str_replace($word, JCommentsText::wordwrap($word, $maxLength, $breaker, true), $text);
}
}
ob_end_clean();
}
return $text;
}