Changeset 24214 for trunk/wp-includes/formatting.php
- Timestamp:
- 05/09/2013 12:22:02 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r24207 r24214 2200 2200 * @param string $text Text to trim. 2201 2201 * @param int $num_words Number of words. Default 55. 2202 * @param string $more What to append if $text needs to be trimmed. Default '…'.2202 * @param string $more Optional. What to append if $text needs to be trimmed. Default '…'. 2203 2203 * @return string Trimmed text. 2204 2204 */ … … 3119 3119 * @param integer $str String to get the excerpt from. 3120 3120 * @param integer $count Maximum number of characters to take. 3121 * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string. 3121 3122 * @return string The excerpt. 3122 3123 */ 3123 function wp_html_excerpt( $str, $count ) { 3124 function wp_html_excerpt( $str, $count, $more = null ) { 3125 if ( null === $more ) 3126 $more = ''; 3124 3127 $str = wp_strip_all_tags( $str, true ); 3125 $ str= mb_substr( $str, 0, $count );3128 $excerpt = mb_substr( $str, 0, $count ); 3126 3129 // remove part of an entity at the end 3127 $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str ); 3128 return $str; 3130 $excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt ); 3131 if ( $str != $excerpt ) 3132 $excerpt = trim( $excerpt ) . $more; 3133 return $excerpt; 3129 3134 } 3130 3135
Note: See TracChangeset
for help on using the changeset viewer.