127; } /** * Springt hinter das Ende einer Zeichenkette (Backslash und doppelte * Anfuehrungszeichen als Maskierung). Unvollstaendige Zeichenketten * reichen bis zum Ende. */ private static function skip_string( $sql, $start, $length, $backslash_escapes = true ) { $quote = $sql[ $start ]; $i = $start + 1; while ( $i < $length ) { $char = $sql[ $i ]; if ( $backslash_escapes && '\\' === $char ) { $i += 2; continue; } if ( $char === $quote ) { if ( $i + 1 < $length && $sql[ $i + 1 ] === $quote ) { $i += 2; continue; } return $i + 1; } ++$i; } return $length; } private static function truncate( $text, $max_len ) { if ( $max_len < 1 || strlen( $text ) <= $max_len ) { return $text; } $cut = substr( $text, 0, $max_len ); // Keine halbe UTF-8-Folge am Ende stehen lassen. while ( '' !== $cut && ! preg_match( '//u', $cut ) ) { $cut = substr( $cut, 0, -1 ); } return rtrim( $cut ) . '…'; } }