protected function trim_center($string, $length) {
        $trimlength = ceil($length/2);
        $start = core_text::substr($string, 0, $trimlength);
        $end = core_text::substr($string, core_text::strlen($string)-$trimlength);
        $string = $start.'...'.$end;
        return $string;
    }
protected function trim_center($string, $length) {
        $trimlength = ceil($length/2);
        $start = core_text::substr($string, 0, $trimlength);
        $end = core_text::substr($string, core_text::strlen($string)-$trimlength);
        $string = $start.'...'.$end;
        return $string;
    }
protected function trim_center ( $ string , $ length ) { $ trimlength = ceil ( $ length / 2 ) ; $ start = core_text :: substr ( $ string , 0 , $ trimlength ) ; $ end = core_text :: substr ( $ string , core_text :: strlen ( $ string ) - $ trimlength ) ; $ string = $ start . '...' . $ end ; return $ string ; }
Truncate a string in the center
@param string $string The string to truncate
@param int $length The length to truncate to
@return string The truncated string
Truncate a string in the center