Skip to:
Content

BuddyPress.org

Ticket #1660: bp_create_excerpt.patch

File bp_create_excerpt.patch, 669 bytes (added by junsuijin, 15 years ago)
  • bp-core/bp-core-templatetags.php

     
    10861086        if ( $filter_shortcodes )
    10871087                $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
    10881088
    1089         $words = explode(' ', $text, $excerpt_length + 1);
     1089        $words = preg_split(
     1090                "%\s*(<object\b.*?</object>)\s*|\s*((?:<[^>]+>)+\S*)\s*|\s+%is",
     1091                $text,
     1092                $excerpt_length + 1,
     1093                PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
     1094        );
     1095
    10901096        if (count($words) > $excerpt_length) {
    10911097                array_pop($words);
    10921098                array_push($words, '[...]');