Changeset 7140
- Timestamp:
- 03/03/2008 09:05:23 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r7131 r7140 336 336 else 337 337 $content = __( 'something' ); 338 $content = strip_tags( $content ); 339 if ( 50 < strlen($content) ) 340 $content = substr($content, 0, 50) . ' ...'; 341 $content = wp_specialchars( $content ); 338 $content = wp_html_excerpt($content, 50) . ' ...'; 342 339 if ( $link ) 343 340 $text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' ); -
trunk/wp-includes/comment.php
r6994 r7140 1047 1047 $excerpt = apply_filters('the_excerpt', $post->post_excerpt); 1048 1048 $excerpt = str_replace(']]>', ']]>', $excerpt); 1049 $excerpt = strip_tags($excerpt); 1050 if ( function_exists('mb_strcut') ) // For international trackbacks 1051 $excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...'; 1052 else 1053 $excerpt = substr($excerpt, 0, 252) . '...'; 1049 $excerpt = wp_html_excerpt($excerpt, 252) . '...'; 1054 1050 1055 1051 $post_title = apply_filters('the_title', $post->post_title); -
trunk/wp-includes/compat.php
r6726 r7140 78 78 endif; 79 79 80 if ( ! function_exists('mb_strcut') ): 81 function mb_strcut( $str, $start, $length=null, $encoding=null ) { 82 return _mb_strcut($str, $start, $length, $encoding); 83 } 84 endif; 85 86 function _mb_strcut( $str, $start, $length=null, $encoding=null ) { 87 // the solution below, works only for utf-8, so in case of a different 88 // charset, just use built-in substr 89 $charset = get_option( 'blog_charset' ); 90 if ( !in_array( $charset, array('utf8', 'utf-8', 'UTF8', 'UTF-8') ) ) { 91 return is_null( $length )? substr( $str, $start ) : substr( $str, $start, $length); 92 } 93 // use the regex unicode support to separate the UTF-8 characters into an array 94 preg_match_all( '/./us', $str, $match ); 95 $chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length ); 96 return implode( '', $chars ); 97 } 98 80 99 ?> -
trunk/wp-includes/formatting.php
r7056 r7140 1371 1371 } 1372 1372 1373 /** 1374 * Safely extracts not more than the first $count characters from html string 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. 1379 * 1380 * @param integer $str String to get the excerpt from 1381 * @param integer $count Maximum number of visible characters to take 1382 * @eaturn string the excerpt 1383 */ 1384 function wp_html_excerpt( $str, $count ) { 1385 $str = strip_tags( $str ); 1386 $str = html_entity_decode( $str, ENT_QUOTES); 1387 $str = mb_strcut( $str, 0, $count ); 1388 // remove part of an entity at the end 1389 $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str ); 1390 // we decoded some entities we should put back 1391 $str = wp_specialchars( $str ); 1392 return $str; 1393 } 1394 1373 1395 ?> -
trunk/wp-settings.php
r6982 r7140 15 15 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 16 16 @ini_set('memory_limit', WP_MEMORY_LIMIT); 17 17 18 18 19 /** … … 351 352 require (ABSPATH . WPINC . '/pluggable.php'); 352 353 354 /* 355 * In most cases the default internal encoding is latin1, which is of no use, 356 * since we want to use the mb_ functions for utf-8 strings 357 */ 358 if ( function_exists('mb_internal_encoding') ) 359 mb_internal_encoding( get_option( 'blog_charset' ) ); 360 361 362 353 363 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') ) 354 364 wp_cache_postload(); -
trunk/wp-trackback.php
r6716 r7140 73 73 trackback_response(1, 'Sorry, trackbacks are closed for this item.'); 74 74 75 $title = wp_specialchars( strip_tags( $title ) ); 76 $excerpt = strip_tags($excerpt); 77 if ( function_exists('mb_strcut') ) { // For international trackbacks 78 $excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...'; 79 $title = mb_strcut($title, 0, 250, get_option('blog_charset')) . '...'; 80 } else { 81 $excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252) . '...' : $excerpt; 82 $title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title; 83 } 75 $title = wp_html_excerpt( $title, 250 ).'...'; 76 $excerpt = wp_html_excerpt( $excerpt, 252 ).'...'; 84 77 85 78 $comment_post_ID = (int) $tb_id;
Note: See TracChangeset
for help on using the changeset viewer.