В Buddypress окно предварительного просмотра сообщений усекает сообщение на одной строке (225 символов), а затем добавляет горизонтальный эллипс. не проанализирован для отображения в виде эллипса. Строки.
Функция, которая управляет этим в файле/plugins/bp-core/bp-gore-template.php (Start Line 878)
Кто -нибудь знает, как решить эту проблему? Многие, большое спасибо заранее. (Код ниже) < /p>
В Buddypress окно предварительного просмотра сообщений усекает сообщение на одной строке (225 символов), а затем добавляет горизонтальный эллипс. не проанализирован для отображения в виде эллипса. Строки. Функция, которая управляет этим в файле/plugins/bp-core/bp-gore-template.php (Start Line 878) Кто -нибудь знает, как решить эту проблему? Многие, большое спасибо заранее. (Код ниже) < /p> [code]function bp_create_excerpt( $text, $length = 225, $options = array() ) {
// Backward compatibility. The third argument used to be a boolean $filter_shortcodes. $filter_shortcodes_default = is_bool( $options ) ? $options : true;
// Save the original text, to be passed along to the filter. $original_text = $text;
/** * Filters the excerpt length to trim text to. * * @since 1.5.0 * * @param int $length Length of returned string, including ellipsis. */ $length = apply_filters( 'bp_excerpt_length', $length );
/** * Filters the excerpt appended text value. * * @since 1.5.0 * * @param string $value Text to append to the end of the excerpt. */ $ending = apply_filters( 'bp_excerpt_append_text', $r['ending'] );
// Remove shortcodes if necessary. if ( ! empty( $r['filter_shortcodes'] ) ) { $text = strip_shortcodes( $text ); }
// When $html is true, the excerpt should be created without including HTML tags in the // excerpt length. if ( ! empty( $r['html'] ) ) {
// The text is short enough. No need to truncate. if ( mb_strlen( preg_replace( '//', '', $text ) ) $length ) { $left = $length - $totalLength; $entitiesLength = 0; if ( preg_match_all( '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', $tag[3], $entities, PREG_OFFSET_CAPTURE ) ) { foreach ( $entities[0] as $entity ) { if ( $entity[1] + 1 - $entitiesLength = $length ) { break; } } } else { // Strip HTML tags if necessary. if ( ! empty( $r['strip_tags'] ) ) { $text = strip_tags( $text ); }
if ( mb_strlen( $text ) /', $truncate, $_truncate_tags, PREG_OFFSET_CAPTURE );
// Rekey tags by the string index of their last character. $truncate_tags = array(); if ( ! empty( $_truncate_tags[0] ) ) { foreach ( $_truncate_tags[0] as $_tt ) { $_tt['start'] = $_tt[1]; $_tt['end'] = $_tt[1] + strlen( $_tt[0] ); $truncate_tags[ $_tt['end'] ] = $_tt; } }
$truncate_length = mb_strlen( $truncate ); $spacepos = $truncate_length + 1; for ( $pos = $truncate_length - 1; $pos >= 0; $pos-- ) { // Word boundaries are spaces and the close of HTML tags, when the tag is preceded by a space. $is_word_boundary = ' ' === $truncate[ $pos ]; if ( ! $is_word_boundary && isset( $truncate_tags[ $pos - 1 ] ) ) { $preceding_tag = $truncate_tags[ $pos - 1 ]; if ( ' ' === $truncate[ $preceding_tag['start'] - 1 ] ) { $is_word_boundary = true; break; } }
if ( ! $is_word_boundary ) { continue; }
// If there are no tags in the string, the first space found is the right one. if ( empty( $truncate_tags ) ) { $spacepos = $pos; break; }
// Look at each tag to see if the space is inside of it. $intag = false; foreach ( $truncate_tags as $tt ) { if ( $pos > $tt['start'] && $pos < $tt['end'] ) { $intag = true; break; } }