Exemplo n.º 1
0
function utf8_cut($utf8_string, $length)
{
    bb_log_deprecated('function', __FUNCTION__, 'bb_utf8_cut');
    return bb_utf8_cut($utf8_string, $length);
}
function bb_trim_for_db($string, $length)
{
    $_string = $string;
    if (seems_utf8($string)) {
        $string = bb_utf8_cut($string, $length);
        // if we have slashes at the end, make sure we have a reasonable number of them
        if (preg_match('#[^\\\\](\\\\+)$#', $string, $matches)) {
            $end = stripslashes($matches[1]);
            $end = addslashes($end);
            $string = trim($string, '\\') . $end;
        }
    }
    return apply_filters('bb_trim_for_db', $string, $_string, $length);
}