diff --git wp-admin/edit-comments.php wp-admin/edit-comments.php
index 46476ab..e1bfcdd 100644
|
|
wp_enqueue_script('admin-comments'); |
105 | 105 | enqueue_comment_hotkeys_js(); |
106 | 106 | |
107 | 107 | if ( $post_id ) |
108 | | $title = sprintf(__('Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50)); |
| 108 | $title = sprintf(__('Comments on “%s”'), |
| 109 | wp_html_excerpt( _draft_or_post_title($post_id), 50, |
| 110 | array( 'append_ellipsis' => true ) ) ); |
109 | 111 | else |
110 | 112 | $title = __('Comments'); |
111 | 113 | |
… |
… |
if ( $post_id ) |
146 | 148 | echo sprintf(__('Comments on “%s”'), |
147 | 149 | sprintf('<a href="%s">%s</a>', |
148 | 150 | get_edit_post_link($post_id), |
149 | | wp_html_excerpt(_draft_or_post_title($post_id), 50) |
| 151 | wp_html_excerpt( _draft_or_post_title($post_id), 50, |
| 152 | array( 'append_ellipsis' => true ) ) |
150 | 153 | ) |
151 | 154 | ); |
152 | 155 | else |
153 | 156 | echo __('Comments'); |
154 | 157 | |
155 | 158 | if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) |
156 | | printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?> |
| 159 | printf( '<span class="subtitle">' . |
| 160 | sprintf( __( 'Search results for “%s”' ), |
| 161 | wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, |
| 162 | array( 'append_ellipsis' => true ) ) ) . |
| 163 | '</span>' ); ?> |
157 | 164 | </h2> |
158 | 165 | |
159 | 166 | <?php |
diff --git wp-admin/includes/dashboard.php wp-admin/includes/dashboard.php
index cc72c99..f286be5 100644
|
|
function wp_dashboard_incoming_links_output() { |
827 | 827 | $publisher = "<strong>$publisher</strong>"; |
828 | 828 | |
829 | 829 | $content = $item->get_content(); |
830 | | $content = wp_html_excerpt($content, 50) . ' …'; |
| 830 | $content = wp_html_excerpt( $content, 50, array( 'append_ellipsis' => true ) ); |
831 | 831 | |
832 | 832 | if ( $link ) |
833 | 833 | /* translators: incoming links feed, %1$s is other person, %3$s is content */ |
diff --git wp-admin/includes/media.php wp-admin/includes/media.php
index a033e58..f65c63b 100644
|
|
function get_media_item( $attachment_id, $args = null ) { |
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case |
1162 | | $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : ''; |
| 1162 | $display_title = "<div class='filename new'><span class='title'>" . |
| 1163 | wp_html_excerpt( $display_title, 60, |
| 1164 | array( 'append_ellipsis' => true ) ) . |
| 1165 | "</span></div>"; |
| 1166 | if ( ! $show_title ) { |
| 1167 | $display_title = ''; |
| 1168 | } |
1163 | 1169 | |
1164 | 1170 | $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ); |
1165 | 1171 | $order = ''; |
diff --git wp-admin/includes/nav-menu.php wp-admin/includes/nav-menu.php
index 79ed9d6..84d8ff5 100644
|
|
function wp_nav_menu_locations_meta_box() { |
516 | 516 | <?php foreach ( $menus as $menu ) : ?> |
517 | 517 | <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?> |
518 | 518 | value="<?php echo $menu->term_id; ?>"><?php |
519 | | $truncated_name = wp_html_excerpt( $menu->name, 40 ); |
520 | | echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '…'; |
| 519 | echo wp_html_excerpt( $menu->name, 40, array( 'append_ellipsis' => true ) ); |
521 | 520 | ?></option> |
522 | 521 | <?php endforeach; ?> |
523 | 522 | </select> |
diff --git wp-admin/nav-menus.php wp-admin/nav-menus.php
index bdf7d42..50b5925 100644
|
|
if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) { |
436 | 436 | |
437 | 437 | // Generate truncated menu names |
438 | 438 | foreach( (array) $nav_menus as $key => $_nav_menu ) { |
439 | | $_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40 ) ); |
440 | | if ( $_nav_menu->truncated_name != $_nav_menu->name ) |
441 | | $_nav_menu->truncated_name .= '…'; |
442 | | |
| 439 | $_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40, array( 'append_ellipsis' => true ) ) ); |
443 | 440 | $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name; |
444 | 441 | } |
445 | 442 | |
diff --git wp-includes/comment.php wp-includes/comment.php
index fd91b0e..8cff49a 100644
|
|
function do_trackbacks($post_id) { |
1753 | 1753 | else |
1754 | 1754 | $excerpt = apply_filters('the_excerpt', $post->post_excerpt); |
1755 | 1755 | $excerpt = str_replace(']]>', ']]>', $excerpt); |
1756 | | $excerpt = wp_html_excerpt($excerpt, 252) . '…'; |
| 1756 | $excerpt = wp_html_excerpt( $excerpt, 252, array( 'append_ellipsis' => true ) ); |
1757 | 1757 | |
1758 | 1758 | $post_title = apply_filters('the_title', $post->post_title, $post->ID); |
1759 | 1759 | $post_title = strip_tags($post_title); |
diff --git wp-includes/formatting.php wp-includes/formatting.php
index 246c333..c60626b 100644
|
|
function wp_sprintf_l($pattern, $args) { |
3114 | 3114 | * be counted as one character. For example & will be counted as 4, < as |
3115 | 3115 | * 3, etc. |
3116 | 3116 | * |
| 3117 | * The list of arguments that $options can contain, which will overwrite the |
| 3118 | * defaults: |
| 3119 | * |
| 3120 | * append_ellipsis - Whether to append truncated string with an ellipsis. |
| 3121 | * Defaults to false. |
| 3122 | * |
3117 | 3123 | * @since 2.5.0 |
3118 | 3124 | * |
3119 | 3125 | * @param integer $str String to get the excerpt from. |
3120 | 3126 | * @param integer $count Maximum number of characters to take. |
| 3127 | * @param string|array $options Additional options affecting extracted output. |
3121 | 3128 | * @return string The excerpt. |
3122 | 3129 | */ |
3123 | | function wp_html_excerpt( $str, $count ) { |
| 3130 | function wp_html_excerpt( $str, $count, $options = '' ) { |
| 3131 | $defaults = array( |
| 3132 | 'append_ellipsis' => false |
| 3133 | ); |
| 3134 | $options = wp_parse_args( $options, $defaults ); |
3124 | 3135 | $str = wp_strip_all_tags( $str, true ); |
3125 | | $str = mb_substr( $str, 0, $count ); |
| 3136 | $new_str = mb_substr( $str, 0, $count ); |
3126 | 3137 | // remove part of an entity at the end |
3127 | | $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str ); |
3128 | | return $str; |
| 3138 | $new_str = preg_replace( '/&[^;\s]{0,6}$/', '', $new_str ); |
| 3139 | if( $options['append_ellipsis'] && strlen( $new_str ) < strlen( $str ) ) |
| 3140 | $new_str .= '…'; |
| 3141 | return $new_str; |
3129 | 3142 | } |
3130 | 3143 | |
3131 | 3144 | /** |
… |
… |
function wp_slash( $value ) { |
3385 | 3398 | */ |
3386 | 3399 | function wp_unslash( $value ) { |
3387 | 3400 | return stripslashes_deep( $value ); |
3388 | | } |
3389 | | No newline at end of file |
| 3401 | } |
diff --git wp-trackback.php wp-trackback.php
index ef6439e..d320193 100644
|
|
if ( !empty($tb_url) && !empty($title) ) { |
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, array( 'append_ellipsis' => true ) ); |
| 91 | $excerpt = wp_html_excerpt( $excerpt, 252, array( 'append_ellipsis' => true ) ); |
92 | 92 | |
93 | 93 | $comment_post_ID = (int) $tb_id; |
94 | 94 | $comment_author = $blog_name; |