Changeset 7190
- Timestamp:
- 03/09/2008 10:11:20 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/formatting.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r7140 r7190 1374 1374 * Safely extracts not more than the first $count characters from html string 1375 1375 * 1376 * UTF-8, tags and entities safe prefix extraction. Entities inside will be 1377 * counted as one character. As a side effect, all entities will be converted to 1378 * their decimal form. 1376 * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* be 1377 * counted as one character. For example & will be counted as 4, < as 3, etc. 1379 1378 * 1380 1379 * @param integer $str String to get the excerpt from 1381 * @param integer $count Maximum number of visiblecharacters to take1380 * @param integer $count Maximum number of characters to take 1382 1381 * @eaturn string the excerpt 1383 1382 */ 1384 1383 function wp_html_excerpt( $str, $count ) { 1385 1384 $str = strip_tags( $str ); 1386 $str = html_entity_decode( $str, ENT_QUOTES);1387 1385 $str = mb_strcut( $str, 0, $count ); 1388 1386 // remove part of an entity at the end 1389 1387 $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str ); 1390 // we decoded some entities we should put back1391 $str = wp_specialchars( $str );1392 1388 return $str; 1393 1389 }
Note: See TracChangeset
for help on using the changeset viewer.