Handle posts without titles better in internal linking. see #11420.

git-svn-id: https://develop.svn.wordpress.org/trunk@16784 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-12-08 00:22:43 +00:00
parent 2fcbcdad76
commit 668956d2ff
4 changed files with 9 additions and 7 deletions

View File

@ -54,7 +54,7 @@ function wp_link_query( $args = array() ) {
$results[] = array(
'ID' => $post->ID,
'title' => trim( esc_html( strip_tags( $post->post_title ) ) ),
'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
'permalink' => get_permalink( $post->ID ),
'info' => $info,
);

View File

@ -144,7 +144,7 @@ var wpLink;
updateFields : function( e, li, originalEvent ) {
inputs.url.val( li.children('.item-permalink').val() );
inputs.title.val( li.children('.item-title').text() );
inputs.title.val( li.hasClass('no-title') ? '' : li.children('.item-title').text() );
if ( originalEvent && originalEvent.type == "click" )
inputs.url.focus();
},
@ -341,7 +341,7 @@ var wpLink;
this.element.scrollTop(0);
},
process: function( results, params ) {
var list = '', alt = true,
var list = '', alt = true, classes = '',
firstPage = params.page == 1;
if ( !results ) {
@ -352,10 +352,12 @@ var wpLink;
}
} else {
$.each( results, function() {
list += alt ? '<li class="alternate">' : '<li>';
classes = alt ? 'alternate' : '';
classes += this['title'] ? '' : ' no-title';
list += classes ? '<li class="' + classes + '">' : '<li>';
list += '<input type="hidden" class="item-permalink" value="' + this['permalink'] + '" />';
list += '<span class="item-title">';
list += this['title'] ? this['title'] : '<em>'+ wpLinkL10n.noTitle + '</em>';
list += this['title'] ? this['title'] : wpLinkL10n.noTitle;
list += '</span><span class="item-info">' + this['info'] + '</span></li>';
alt = ! alt;
});

File diff suppressed because one or more lines are too long

View File

@ -270,7 +270,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(adminBarL10n);}catch(e){};',
) );
$scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101206' );
$scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101207' );
$scripts->localize( 'wplink', 'wpLinkL10n', array(
'update' => __('Update'),
'save' => __('Save Link'),