Changeset 33440 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 07/27/2015 11:18:55 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r33411 r33440 2813 2813 */ 2814 2814 function wp_trim_words( $text, $num_words = 55, $more = null ) { 2815 if ( null === $more ) 2815 if ( null === $more ) { 2816 2816 $more = __( '…' ); 2817 } 2818 2817 2819 $original_text = $text; 2818 2820 $text = wp_strip_all_tags( $text ); 2819 /* translators: If your word count is based on single characters (East Asian characters), 2820 enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */ 2821 if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { 2821 2822 /* translators: If your word count is based on single characters (e.g. East Asian characters), 2823 enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 2824 Do not translate into your own language. */ 2825 if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { 2822 2826 $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' ); 2823 2827 preg_match_all( '/./u', $text, $words_array ); … … 2828 2832 $sep = ' '; 2829 2833 } 2834 2830 2835 if ( count( $words_array ) > $num_words ) { 2831 2836 array_pop( $words_array ); … … 2835 2840 $text = implode( $sep, $words_array ); 2836 2841 } 2842 2837 2843 /** 2838 2844 * Filter the text content after words have been trimmed.
Note: See TracChangeset
for help on using the changeset viewer.