Changeset 3610 for trunk/bp-core/bp-core-templatetags.php
- Timestamp:
- 12/29/2010 03:22:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-templatetags.php
r3607 r3610 375 375 376 376 $defaults = array( 377 'length' => 15377 'length' => 70 378 378 ); 379 379 … … 1116 1116 * @return str The excerpt text 1117 1117 */ 1118 function bp_create_excerpt( $text, $excerpt_length = 55, $filter_shortcodes = true ) { // Fakes an excerpt if needed1118 function bp_create_excerpt( $text, $excerpt_length = 225, $filter_shortcodes = true ) { // Fakes an excerpt if needed 1119 1119 $original_text = $text; 1120 1120 $text = str_replace(']]>', ']]>', $text); … … 1123 1123 $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text ); 1124 1124 1125 $words = preg_split( 1126 "%\s*((?:<[^>]+>)+\S*)\s*|\s+%s", 1127 $text, 1128 $excerpt_length + 1, 1129 PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE 1130 ); 1131 1132 if (count($words) > $excerpt_length) { 1133 array_pop($words); 1134 array_push($words, '[...]'); 1135 $text = implode(' ', $words); 1136 } 1137 1125 preg_match( "%\s*((?:<[^>]+>)+\S*)\s*|\s+%s", $text, $matches, PREG_OFFSET_CAPTURE, $excerpt_length ); 1126 1127 if ( !empty( $matches ) ) { 1128 $pos = array_pop( array_pop( $matches ) ); 1129 $text = substr( $text, 0, $pos ) . ' [...]'; 1130 } 1131 1138 1132 return apply_filters( 'bp_create_excerpt', $text, $original_text ); 1139 1133 }
Note: See TracChangeset
for help on using the changeset viewer.