Ticket #11446: 11446.2.diff
File 11446.2.diff, 6.8 KB (added by , 14 years ago) |
---|
-
wp-includes/comment.php
1704 1704 else 1705 1705 $excerpt = apply_filters('the_excerpt', $post->post_excerpt); 1706 1706 $excerpt = str_replace(']]>', ']]>', $excerpt); 1707 $excerpt = wp_html_excerpt($excerpt, 252 ) . '...';1707 $excerpt = wp_html_excerpt($excerpt, 252, true); 1708 1708 1709 1709 $post_title = apply_filters('the_title', $post->post_title); 1710 1710 $post_title = strip_tags($post_title); -
wp-includes/formatting.php
2710 2710 * 2711 2711 * @param integer $str String to get the excerpt from. 2712 2712 * @param integer $count Maximum number of characters to take. 2713 * @param bool $append_ellipsis optional Whether to append truncated string with an ellipsis. Defaults to false. 2713 2714 * @return string The excerpt. 2714 2715 */ 2715 function wp_html_excerpt( $str, $count ) {2716 function wp_html_excerpt( $str, $count, $append_ellipsis = false ) { 2716 2717 $str = wp_strip_all_tags( $str, true ); 2717 $ str = mb_substr( $str, 0, $count );2718 $new_str = mb_substr( $str, 0, $count ); 2718 2719 // remove part of an entity at the end 2719 $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str ); 2720 return $str; 2720 $new_str = preg_replace( '/&[^;\s]{0,6}$/', '', $new_str ); 2721 if( $append_ellipsis && strlen( $new_str ) < strlen( $str ) ) 2722 $new_str .= '…'; 2723 return $new_str; 2721 2724 } 2722 2725 2723 2726 /** -
wp-trackback.php
87 87 if ( !pings_open($tb_id) ) 88 88 trackback_response(1, 'Sorry, trackbacks are closed for this item.'); 89 89 90 $title = wp_html_excerpt( $title, 250 ).'...';91 $excerpt = wp_html_excerpt( $excerpt, 252 ).'...';90 $title = wp_html_excerpt( $title, 250, true ); 91 $excerpt = wp_html_excerpt( $excerpt, 252, true ); 92 92 93 93 $comment_post_ID = (int) $tb_id; 94 94 $comment_author = $blog_name; -
wp-admin/edit-comments.php
111 111 enqueue_comment_hotkeys_js(); 112 112 113 113 if ( $post_id ) 114 $title = sprintf(__('Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50 ));114 $title = sprintf(__('Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50, true)); 115 115 else 116 116 $title = __('Comments'); 117 117 … … 139 139 echo sprintf(__('Comments on “%s”'), 140 140 sprintf('<a href="%s">%s</a>', 141 141 get_edit_post_link($post_id), 142 wp_html_excerpt(_draft_or_post_title($post_id), 50 )142 wp_html_excerpt(_draft_or_post_title($post_id), 50, true) 143 143 ) 144 144 ); 145 145 else 146 146 echo __('Comments'); 147 147 148 148 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) 149 printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>149 printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50, true ) ) . '</span>' ); ?> 150 150 </h2> 151 151 152 152 <?php -
wp-admin/includes/dashboard.php
824 824 $publisher = "<strong>$publisher</strong>"; 825 825 826 826 $content = $item->get_content(); 827 $content = wp_html_excerpt($content, 50 ) . ' ...';827 $content = wp_html_excerpt($content, 50, true); 828 828 829 829 if ( $link ) 830 830 /* translators: incoming links feed, %1$s is other person, %3$s is content */ -
wp-admin/includes/media.php
1215 1215 } 1216 1216 1217 1217 $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case 1218 $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';1218 $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, true ) . "</span></div>" : ''; 1219 1219 1220 1220 $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ); 1221 1221 $order = ''; -
wp-admin/includes/nav-menu.php
482 482 <?php foreach ( $menus as $menu ) : ?> 483 483 <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?> 484 484 value="<?php echo $menu->term_id; ?>"><?php 485 $truncated_name = wp_html_excerpt( $menu->name, 40 ); 486 echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '…'; 485 echo wp_html_excerpt( $menu->name, 40, true ); 487 486 ?></option> 488 487 <?php endforeach; ?> 489 488 </select> -
wp-admin/nav-menus.php
420 420 421 421 // Generate truncated menu names 422 422 foreach( (array) $nav_menus as $key => $_nav_menu ) { 423 $_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40 ) ); 424 if ( $_nav_menu->truncated_name != $_nav_menu->name ) 425 $_nav_menu->truncated_name .= '…'; 426 423 $_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40, true ) ); 427 424 $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name; 428 425 } 429 426 -
wp-admin/admin-header.php
113 113 $blog_name = sprintf( __('%s Global Dashboard'), esc_html($current_site->site_name) ); 114 114 else 115 115 $blog_name = get_bloginfo('name', 'display'); 116 if ( '' == $blog_name ) {116 if ( '' == $blog_name ) 117 117 $blog_name = __( 'Visit Site' ); 118 } else { 119 $blog_name_excerpt = wp_html_excerpt($blog_name, 40); 120 if ( $blog_name != $blog_name_excerpt ) 121 $blog_name_excerpt = trim($blog_name_excerpt) . '…'; 122 $blog_name = $blog_name_excerpt; 123 unset($blog_name_excerpt); 124 } 118 else 119 $blog_name = wp_html_excerpt($blog_name, 40, true); 120 125 121 $title_class = ''; 126 122 if ( function_exists('mb_strlen') ) { 127 123 if ( mb_strlen($blog_name, 'UTF-8') > 30 )