concrete/src/Utility/Service/Text.php
public function sanitize($string, $max_length = 0, $allowed = '')
    {
        $text = trim(strip_tags($string, $allowed));
        if ($max_length > 0) {
            if (function_exists('mb_substr')) {
                $text = mb_substr($text, 0, $max_length, APP_CHARSET);
            } else {
                $text = substr($text, 0, $max_length);
            }
        }
        if ($text == null) {
            return ""; // we need to explicitly return a string otherwise some DB functions might insert this as a ZERO.
        }

        return $text;
    }
public function sanitize($string, $max_length = 0, $allowed = '')
    {
        $text = trim(strip_tags($string, $allowed));
        if ($max_length > 0) {
            if (function_exists('mb_substr')) {
                $text = mb_substr($text, 0, $max_length, APP_CHARSET);
            } else {
                $text = substr($text, 0, $max_length);
            }
        }
        if ($text == null) {
            return ""; // we need to explicitly return a string otherwise some DB functions might insert this as a ZERO.
        }

        return $text;
    }
public function sanitize ( $ string , $ max_length = 0 , $ allowed = '' ) { $ text = trim ( strip_tags ( $ string , $ allowed ) ) ; if ( $ max_length > 0 ) { if ( function_exists ( 'mb_substr' ) ) { $ text = mb_substr ( $ text , 0 , $ max_length , APP_CHARSET ) ; } else { $ text = substr ( $ text , 0 , $ max_length ) ; } } if ( $ text == null ) { return "" ; // we need to explicitly return a string otherwise some DB functions might insert this as a ZERO. } return $ text ; }
Strips tags and optionally reduces string to specified length.

@param string $string
@param int    $max_length
@param string $allowed

@return string
Strips tags and optionally reduces string to specified length .