_shorten

Shorten a string for the given length

Parameters
string $str

A plain text string to be shortened

#
integer $length = 50

The character count

#
string $trail = '...'

To append ... or not. null to not show

#
Returns
string

The shorten text string