Changeset 10832
- Timestamp:
- 05/31/2016 06:49:07 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-filters.php
r10825 r10832 388 388 * 389 389 * @since 1.5.0 390 * @since 2.6.0 Added $args parameter. 390 391 * 391 392 * @param string $text The original activity entry text. 393 * @param array $args { 394 * Optional parameters. See $options argument of {@link bp_create_excerpt()} 395 * for all available parameters. 396 * } 392 397 * @return string $excerpt The truncated text. 393 398 */ 394 function bp_activity_truncate_entry( $text ) {399 function bp_activity_truncate_entry( $text, $args = array() ) { 395 400 global $activities_template; 396 401 … … 408 413 409 414 // The full text of the activity update should always show on the single activity screen. 410 if ( ! $maybe_truncate_text || bp_is_single_activity() ) {415 if ( empty( $args['force_truncate'] ) && ( ! $maybe_truncate_text || bp_is_single_activity() ) ) { 411 416 return $text; 412 417 } … … 430 435 $excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 ); 431 436 437 $args = wp_parse_args( $args, array( 'ending' => __( '…', 'buddypress' ) ) ); 438 432 439 // Run the text through the excerpt function. If it's too short, the original text will be returned. 433 $excerpt = bp_create_excerpt( $text, $excerpt_length, array( 'ending' => __( '…', 'buddypress' ) ));440 $excerpt = bp_create_excerpt( $text, $excerpt_length, $args ); 434 441 435 442 /* … … 438 445 * shortcodes, so we have strip them from the $text before the comparison. 439 446 */ 440 if ( $excerpt != strip_shortcodes( $text) ) {447 if ( strlen( $excerpt ) > strlen( strip_shortcodes( $text ) ) ) { 441 448 $id = !empty( $activities_template->activity->current_comment->id ) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id(); 442 449
Note: See TracChangeset
for help on using the changeset viewer.