function prepareForDisplay( $str, $width = 200, $convertHttpLinks = true, $applyHttpEntitites = true )
{
if( empty( $str ) ) return '';
if ( $applyHttpEntitites )
{
$str = htmlentities( $str, ENT_COMPAT, 'UTF-8' );
}
if ( $convertHttpLinks )
{
$str = addHttpLinks( $str );
}
$str = nl2br($str);
$words = explode(" ", $str);
foreach( $words as $word )
{
if( mb_strlen( $word ) >= $width )
{
$word = htmlwrap( $word, $width, " ");
}
$finalStr .= "$word ";
}
return trim( $finalStr );
}
Thursday, May 6, 2010
Preparing Texts for Display
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment