Changeset 13236
- Timestamp:
- 02/22/2024 06:10:37 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php
r13235 r13236 542 542 543 543 if ( 'words' === $type ) { 544 return wp_trim_words( $desc, $length, ' …' ); 544 // Split by whitespace, capturing it so we can put it back together. 545 $pieces = preg_split( '/(\s+)/u', $desc, -1, PREG_SPLIT_DELIM_CAPTURE ); 546 547 $word_count_with_spaces = $length * 2; 548 549 if ( count( $pieces ) < $word_count_with_spaces ) { 550 return $desc; 551 } 552 553 $pieces = array_slice( $pieces, 0, $word_count_with_spaces ); 554 555 return implode( '', $pieces ) . ' …'; 545 556 } 546 557
Note: See TracChangeset
for help on using the changeset viewer.