Make WordPress Core

Ticket #11446: 11446.5.patch

File 11446.5.patch, 9.6 KB (added by SergeyBiryukov, 12 years ago)
  • wp-admin/async-upload.php

     
    5757                                echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
    5858                        echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
    5959                        $title = $post->post_title ? $post->post_title : wp_basename( $post->guid ); // title shouldn't ever be empty, but use filename just in cas.e
    60                         echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60 ) ) . '</span></div>';
     60                        echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ) . '</span></div>';
    6161                        break;
    6262                case 2 :
    6363                        add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
  • wp-admin/edit-comments.php

     
    105105enqueue_comment_hotkeys_js();
    106106
    107107if ( $post_id )
    108         $title = sprintf(__('Comments on &#8220;%s&#8221;'), wp_html_excerpt(_draft_or_post_title($post_id), 50));
     108        $title = sprintf( __( 'Comments on &#8220;%s&#8221;' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' ) );
    109109else
    110110        $title = __('Comments');
    111111
     
    143143<?php screen_icon(); ?>
    144144<h2><?php
    145145if ( $post_id )
    146         echo sprintf(__('Comments on &#8220;%s&#8221;'),
    147                 sprintf('<a href="%s">%s</a>',
    148                         get_edit_post_link($post_id),
    149                         wp_html_excerpt(_draft_or_post_title($post_id), 50)
     146        echo sprintf( __( 'Comments on &#8220;%s&#8221;' ),
     147                sprintf( '<a href="%s">%s</a>',
     148                        get_edit_post_link( $post_id ),
     149                        wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' )
    150150                )
    151151        );
    152152else
    153153        echo __('Comments');
    154154
    155155if ( 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>' ); ?>
     156        printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) ) . '</span>' ); ?>
    157157</h2>
    158158
    159159<?php
  • wp-admin/includes/dashboard.php

     
    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, ' &hellip;' );
    831831
    832832                if ( $link )
    833833                        /* translators: incoming links feed, %1$s is other person, %3$s is content */
  • wp-admin/includes/media.php

     
    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 = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . "</span></div>" : '';
    11631163
    11641164        $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
    11651165        $order = '';
  • wp-admin/includes/nav-menu.php

     
    515515                                        <option value="0"></option>
    516516                                        <?php foreach ( $menus as $menu ) : ?>
    517517                                        <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?>
    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 ) . '&hellip;';
    521                                         ?></option>
     518                                                value="<?php echo $menu->term_id; ?>"><?php echo wp_html_excerpt( $menu->name, 40, '&hellip;' ); ?></option>
    522519                                        <?php endforeach; ?>
    523520                                </select>
    524521                        </label>
  • wp-admin/nav-menus.php

     
    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 
    443         $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
     439        $nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '&hellip;' );
    444440}
    445441
    446442// Retrieve menu locations
     
    572568                                                                <?php foreach ( $nav_menus as $menu ) : ?>
    573569                                                                        <?php $selected = isset( $menu_locations[$_location] ) && $menu_locations[$_location] == $menu->term_id; ?>
    574570                                                                        <option <?php if ( $selected ) echo 'data-orig="true"'; ?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>">
    575                                                                                 <?php $truncated_name = wp_html_excerpt( $menu->name, 40 );
    576                                                                                 echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '&hellip;'; ?>
     571                                                                                <?php echo wp_html_excerpt( $menu->name, 40, '&hellip;' ); ?>
    577572                                                                        </option>
    578573                                                                <?php endforeach; ?>
    579574                                                        </select>
  • wp-includes/admin-bar.php

     
    229229                $blogname = sprintf( __('Global Dashboard: %s'), esc_html( $current_site->site_name ) );
    230230        }
    231231
    232         $title = wp_html_excerpt( $blogname, 40 );
    233         if ( $title != $blogname )
    234                 $title = trim( $title ) . '&hellip;';
     232        $title = wp_html_excerpt( $blogname, 40, '&hellip;' );
    235233
    236234        $wp_admin_bar->add_menu( array(
    237235                'id'    => 'site-name',
  • wp-includes/class-wp-customize-manager.php

     
    897897                if ( $menus ) {
    898898                        $choices = array( 0 => __( '&mdash; Select &mdash;' ) );
    899899                        foreach ( $menus as $menu ) {
    900                                 $truncated_name = wp_html_excerpt( $menu->name, 40 );
    901                                 $truncated_name = ( $truncated_name == $menu->name ) ? $menu->name : trim( $truncated_name ) . '&hellip;';
    902                                 $choices[ $menu->term_id ] = $truncated_name;
     900                                $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '&hellip;' );
    903901                        }
    904902
    905903                        foreach ( $locations as $location => $description ) {
  • wp-includes/comment.php

     
    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, '&#8230;');
    17571757
    17581758        $post_title = apply_filters('the_title', $post->post_title, $post->ID);
    17591759        $post_title = strip_tags($post_title);
  • wp-includes/formatting.php

     
    21992199 *
    22002200 * @param string $text Text to trim.
    22012201 * @param int $num_words Number of words. Default 55.
    2202  * @param string $more What to append if $text needs to be trimmed. Default '&hellip;'.
     2202 * @param string $more Optional. What to append if $text needs to be trimmed. Default '&hellip;'.
    22032203 * @return string Trimmed text.
    22042204 */
    22052205function wp_trim_words( $text, $num_words = 55, $more = null ) {
     
    31183118 *
    31193119 * @param integer $str String to get the excerpt from.
    31203120 * @param integer $count Maximum number of characters to take.
     3121 * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string.
    31213122 * @return string The excerpt.
    31223123 */
    3123 function wp_html_excerpt( $str, $count ) {
     3124function wp_html_excerpt( $str, $count, $more = null ) {
     3125        if ( null === $more )
     3126                $more = '';
    31243127        $str = wp_strip_all_tags( $str, true );
    3125         $str = mb_substr( $str, 0, $count );
     3128        $excerpt = mb_substr( $str, 0, $count );
    31263129        // remove part of an entity at the end
    3127         $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str );
    3128         return $str;
     3130        $excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
     3131        if ( $str != $excerpt )
     3132                $excerpt = trim( $excerpt ) . $more;
     3133        return $excerpt;
    31293134}
    31303135
    31313136/**
  • wp-trackback.php

     
    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, '&#8230;' );
     91        $excerpt = wp_html_excerpt( $excerpt, 252, '&#8230;' );
    9292
    9393        $comment_post_ID = (int) $tb_id;
    9494        $comment_author = $blog_name;