Make WordPress Core

Ticket #11446: 11446.4.patch

File 11446.4.patch, 7.0 KB (added by bpetty, 12 years ago)
  • wp-admin/edit-comments.php

    diff --git wp-admin/edit-comments.php wp-admin/edit-comments.php
    index 46476ab..e1bfcdd 100644
    wp_enqueue_script('admin-comments'); 
    105105enqueue_comment_hotkeys_js();
    106106
    107107if ( $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 ) ) );
    109111else
    110112        $title = __('Comments');
    111113
    if ( $post_id ) 
    146148        echo sprintf(__('Comments on “%s”'),
    147149                sprintf('<a href="%s">%s</a>',
    148150                        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 ) )
    150153                )
    151154        );
    152155else
    153156        echo __('Comments');
    154157
    155158if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
    156         printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>
     159        printf( '<span class="subtitle">' .
     160                        sprintf( __( 'Search results for &#8220;%s&#8221;' ),
     161                                         wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50,
     162                                                                          array( 'append_ellipsis' => true ) ) ) .
     163                        '</span>' ); ?>
    157164</h2>
    158165
    159166<?php
  • wp-admin/includes/dashboard.php

    diff --git wp-admin/includes/dashboard.php wp-admin/includes/dashboard.php
    index cc72c99..f286be5 100644
    function wp_dashboard_incoming_links_output() { 
    827827                        $publisher = "<strong>$publisher</strong>";
    828828
    829829                $content = $item->get_content();
    830                 $content = wp_html_excerpt($content, 50) . ' &hellip;';
     830                $content = wp_html_excerpt( $content, 50, array( 'append_ellipsis' => true ) );
    831831
    832832                if ( $link )
    833833                        /* translators: incoming links feed, %1$s is other person, %3$s is content */
  • wp-admin/includes/media.php

    diff --git wp-admin/includes/media.php wp-admin/includes/media.php
    index a033e58..f65c63b 100644
    function get_media_item( $attachment_id, $args = null ) { 
    11591159        }
    11601160
    11611161        $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        }
    11631169
    11641170        $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
    11651171        $order = '';
  • wp-admin/includes/nav-menu.php

    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() { 
    516516                                        <?php foreach ( $menus as $menu ) : ?>
    517517                                        <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?>
    518518                                                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 ) . '&hellip;';
     519                                                echo wp_html_excerpt( $menu->name, 40, array( 'append_ellipsis' => true ) );
    521520                                        ?></option>
    522521                                        <?php endforeach; ?>
    523522                                </select>
  • wp-admin/nav-menus.php

    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 ) ) { 
    436436
    437437// Generate truncated menu names
    438438foreach( (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 .= '&hellip;';
    442 
     439        $_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40, array( 'append_ellipsis' => true ) ) );
    443440        $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
    444441}
    445442
  • wp-includes/comment.php

    diff --git wp-includes/comment.php wp-includes/comment.php
    index fd91b0e..8cff49a 100644
    function do_trackbacks($post_id) { 
    17531753        else
    17541754                $excerpt = apply_filters('the_excerpt', $post->post_excerpt);
    17551755        $excerpt = str_replace(']]>', ']]&gt;', $excerpt);
    1756         $excerpt = wp_html_excerpt($excerpt, 252) . '&#8230;';
     1756        $excerpt = wp_html_excerpt( $excerpt, 252, array( 'append_ellipsis' => true ) );
    17571757
    17581758        $post_title = apply_filters('the_title', $post->post_title, $post->ID);
    17591759        $post_title = strip_tags($post_title);
  • wp-includes/formatting.php

    diff --git wp-includes/formatting.php wp-includes/formatting.php
    index 246c333..c60626b 100644
    function wp_sprintf_l($pattern, $args) { 
    31143114 * be counted as one character. For example &amp; will be counted as 4, &lt; as
    31153115 * 3, etc.
    31163116 *
     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 *
    31173123 * @since 2.5.0
    31183124 *
    31193125 * @param integer $str String to get the excerpt from.
    31203126 * @param integer $count Maximum number of characters to take.
     3127 * @param string|array $options Additional options affecting extracted output.
    31213128 * @return string The excerpt.
    31223129 */
    3123 function wp_html_excerpt( $str, $count ) {
     3130function wp_html_excerpt( $str, $count, $options = '' ) {
     3131        $defaults = array(
     3132                'append_ellipsis' => false
     3133        );
     3134        $options = wp_parse_args( $options, $defaults );
    31243135        $str = wp_strip_all_tags( $str, true );
    3125         $str = mb_substr( $str, 0, $count );
     3136        $new_str = mb_substr( $str, 0, $count );
    31263137        // 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 .= '&hellip;';
     3141        return $new_str;
    31293142}
    31303143
    31313144/**
    function wp_slash( $value ) { 
    33853398 */
    33863399function wp_unslash( $value ) {
    33873400        return stripslashes_deep( $value );
    3388 }
    3389  No newline at end of file
     3401}
  • wp-trackback.php

    diff --git wp-trackback.php wp-trackback.php
    index ef6439e..d320193 100644
    if ( !empty($tb_url) && !empty($title) ) { 
    8787        if ( !pings_open($tb_id) )
    8888                trackback_response(1, 'Sorry, trackbacks are closed for this item.');
    8989
    90         $title =  wp_html_excerpt( $title, 250 ) . '&#8230;';
    91         $excerpt = wp_html_excerpt( $excerpt, 252 ) . '&#8230;';
     90        $title =  wp_html_excerpt( $title, 250, array( 'append_ellipsis' => true ) );
     91        $excerpt = wp_html_excerpt( $excerpt, 252, array( 'append_ellipsis' => true ) );
    9292
    9393        $comment_post_ID = (int) $tb_id;
    9494        $comment_author = $blog_name;