Ticket #16079: 16079.diff
File 16079.diff, 1.3 KB (added by , 13 years ago) |
---|
-
wp-includes/formatting.php
2039 2039 /** 2040 2040 * Trims text to a certain number of words. 2041 2041 * 2042 * This function is localized. For languages that count 'words' by the individual 2043 * character (such as East Asian languages), the $num_words argument will apply 2044 * to the number of individual characters. 2045 * 2042 2046 * @since 3.3.0 2043 2047 * 2044 2048 * @param string $text Text to trim. … … 2051 2055 $more = __( '…' ); 2052 2056 $original_text = $text; 2053 2057 $text = wp_strip_all_tags( $text ); 2054 $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY ); 2058 /* translators: If your word count is based on single characters (East Asian characters), 2059 enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */ 2060 if ( 'characters' == _x( 'words', 'word count: words or characters?' ) ) { 2061 preg_match_all( '/(\S)/', $text, $words_array ); 2062 $words_array = array_slice( $words_array[1], 0, $num_words + 1 ); 2063 } else { 2064 $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY ); 2065 } 2055 2066 if ( count( $words_array ) > $num_words ) { 2056 2067 array_pop( $words_array ); 2057 2068 $text = implode( ' ', $words_array );