dumper.php
public function clipString($string, $size, $position = 0)
    {
        $utf8 = false;
        if (function_exists('mb_detect_encoding') && mb_detect_encoding($string) == 'UTF-8') {
            $utf8 = true;   
        }

        $length = ($utf8 == true) ? mb_strlen($string, "UTF-8") : strlen($string);

        if ($length <= $size) {
            return $string;
        }

        $position = min($position, $length);
        $start    = ($size/2 > $position ? 0 : $position - $size/2);
        if ($start + $size > $length) {
            $start = $length - $size;
        }
        $string = ($utf8 == true) ? mb_substr($string, $start, $size) : substr($string, $start, $size);

        return ($start > 0 ? '...' : '') . $string . ($start + $size < $length ? '...' : '');
    }
public function clipString($string, $size, $position = 0)
    {
        $utf8 = false;
        if (function_exists('mb_detect_encoding') && mb_detect_encoding($string) == 'UTF-8') {
            $utf8 = true;   
        }

        $length = ($utf8 == true) ? mb_strlen($string, "UTF-8") : strlen($string);

        if ($length <= $size) {
            return $string;
        }

        $position = min($position, $length);
        $start    = ($size/2 > $position ? 0 : $position - $size/2);
        if ($start + $size > $length) {
            $start = $length - $size;
        }
        $string = ($utf8 == true) ? mb_substr($string, $start, $size) : substr($string, $start, $size);

        return ($start > 0 ? '...' : '') . $string . ($start + $size < $length ? '...' : '');
    }
public function clipString ( $ string , $ size , $ position = 0 ) { $ utf8 = false ; if ( function_exists ( 'mb_detect_encoding' ) && mb_detect_encoding ( $ string ) == 'UTF-8' ) { $ utf8 = true ; } $ length = ( $ utf8 == true ) ? mb_strlen ( $ string , "UTF-8" ) : strlen ( $ string ) ; if ( $ length <= $ size ) { return $ string ; } $ position = min ( $ position , $ length ) ; $ start = ( $ size / 2 > $ position ? 0 : $ position - $ size / 2 ) ; if ( $ start + $ size > $ length ) { $ start = $ length - $ size ; } $ string = ( $ utf8 == true ) ? mb_substr ( $ string , $ start , $ size ) : substr ( $ string , $ start , $ size ) ; return ( $ start > 0 ? '...' : '' ) . $ string . ( $ start + $ size < $ length ? '...' : '' ) ; }
Clips a string to a maximum length.

@param string $string     String to truncate.
@param int $size         Minimum string size to show.
@param int $position     Centre of string section.

@return string               Shortened version.
Clips a string to a maximum length .