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:
parent
2fcbcdad76
commit
668956d2ff
|
@ -54,7 +54,7 @@ function wp_link_query( $args = array() ) {
|
||||||
|
|
||||||
$results[] = array(
|
$results[] = array(
|
||||||
'ID' => $post->ID,
|
'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 ),
|
'permalink' => get_permalink( $post->ID ),
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
);
|
);
|
||||||
|
|
|
@ -144,7 +144,7 @@ var wpLink;
|
||||||
|
|
||||||
updateFields : function( e, li, originalEvent ) {
|
updateFields : function( e, li, originalEvent ) {
|
||||||
inputs.url.val( li.children('.item-permalink').val() );
|
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" )
|
if ( originalEvent && originalEvent.type == "click" )
|
||||||
inputs.url.focus();
|
inputs.url.focus();
|
||||||
},
|
},
|
||||||
|
@ -341,7 +341,7 @@ var wpLink;
|
||||||
this.element.scrollTop(0);
|
this.element.scrollTop(0);
|
||||||
},
|
},
|
||||||
process: function( results, params ) {
|
process: function( results, params ) {
|
||||||
var list = '', alt = true,
|
var list = '', alt = true, classes = '',
|
||||||
firstPage = params.page == 1;
|
firstPage = params.page == 1;
|
||||||
|
|
||||||
if ( !results ) {
|
if ( !results ) {
|
||||||
|
@ -352,10 +352,12 @@ var wpLink;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$.each( results, function() {
|
$.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 += '<input type="hidden" class="item-permalink" value="' + this['permalink'] + '" />';
|
||||||
list += '<span class="item-title">';
|
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>';
|
list += '</span><span class="item-info">' + this['info'] + '</span></li>';
|
||||||
alt = ! alt;
|
alt = ! alt;
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -270,7 +270,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
'l10n_print_after' => 'try{convertEntities(adminBarL10n);}catch(e){};',
|
'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(
|
$scripts->localize( 'wplink', 'wpLinkL10n', array(
|
||||||
'update' => __('Update'),
|
'update' => __('Update'),
|
||||||
'save' => __('Save Link'),
|
'save' => __('Save Link'),
|
||||||
|
|
Loading…
Reference in New Issue