Next pass on internal linking. Functional, but needs styling. props koopersmith, see #11420.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-11-15 23:48:24 +00:00
parent 27200382fa
commit afcbc49e62
6 changed files with 217 additions and 423 deletions

View File

@ -13,8 +13,8 @@
ed.addCommand('WP_Link', function() {
ed.windowManager.open({
file : tinymce.baseURL + '/wp-mce-link.php',
width : 320,
height : 340,
width : 480,
height : 400,
inline : 1
}, {
plugin_url : url // Plugin absolute URL

View File

@ -1 +1 @@
(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){a.addCommand("WP_Link",function(){a.windowManager.open({file:tinymce.baseURL+"/wp-mce-link.php",width:320,height:340,inline:1},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(d,c,e){c.setActive("wplink",e.nodeName=="A")})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})();
(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){a.addCommand("WP_Link",function(){a.windowManager.open({file:tinymce.baseURL+"/wp-mce-link.php",width:480,height:400,inline:1},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(d,c,e){c.setActive("wplink",e.nodeName=="A")})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})();

View File

@ -1,137 +1,50 @@
(function($){
$.widget('wp.wpTabs', {
options: {},
_create: function() {
var self = this,
ul = this.element,
lis = ul.children();
this.active = lis.filter('.wp-tab-active');
// Calculate panel IDs
lis.each(function() {
var panel = self._getPanel( $(this) );
if ( self.active[0] == this )
panel.show();
else
panel.hide();
});
ul.delegate('li', 'click.wpTabs', function(e) {
var li = $(this);
// Prevent any child link from redirecting the page.
e.preventDefault();
// Deactivate previous tab.
self._getPanel( self.active ).hide();
self.active.removeClass('wp-tab-active');
self._trigger("hide", e, self.widget() );
// Activate current tab.
self.active = li.addClass('wp-tab-active');
self._getPanel( self.active ).show();
self._trigger("show", e, self.widget() );
});
},
widget: function() {
return {
ul: this.element,
tab: this.active,
panel: this._getPanel( this.active )
};
},
_setPanel: function( $el ) {
var panel = $( '#' + $el.children('.wp-tab-for-id').val() );
$el.data( 'wp-tab-panel', panel );
return panel;
},
_getPanel: function( $el ) {
var panel = $el.data('wp-tab-panel');
return ( !panel || !panel.length ) ? this._setPanel( $el ) : panel;
}
});
// Create tab bars by default.
$(function(){
$('.wp-tab-bar').wpTabs();
});
})(jQuery);
(function($){
var inputs = {}, panels, active, ed,
var inputs = {}, results = {}, ed,
wpLink = {
init : function() {
var e, etarget, eclass;
// Init shared vars
ed = tinyMCEPopup.editor;
// URL
inputs.url = $('#url-field');
// Secondary options
inputs.title = $('#link-title-field');
// Advanced Options
inputs.openInNewTab = $('#link-target-checkbox');
panels = $('.link-panel');
active = $('.link-panel-active');
$('#link-panel-tab-bar').wpTabs({
show: function(e, widget) {
active = widget.panel;
active.addClass('link-panel-active');
wpLink.maybeLoadPanel();
},
hide: function(e, widget) {
active.removeClass('link-panel-active');
}
})
panels.each( function(){
var linkType = this.id.replace(/^link-panel-id-/,''),
parts = linkType.split('-');
$(this).data( 'link-type', {
full : linkType,
type : parts[0],
name : parts[1] || ''
});
});
inputs.search = $('#search-field');
// Result lists
results.search = $('#search-results');
results.recent = $('#most-recent-results');
// Bind event handlers
$('#wp-update').click( wpLink.update );
$('#wp-cancel').click( function() { tinyMCEPopup.close(); } );
$('.link-panel .wp-tab-bar').wpTabs('option', 'show', wpLink.maybeLoadPanel );
$('.link-panel .wp-tab-panel').delegate('li', 'click', wpLink.selectInternalLink );
$('.wp-tab-panel-pagelinks').delegate('a', 'click', wpLink.selectPageLink );
$('.link-panel .link-search-field').keyup( wpLink.searchInternalLinks );
active.find('input.url-field').focus();
$('.query-results').delegate('li', 'click', wpLink.selectInternalLink );
$('.wp-results-pagelinks').delegate('a', 'click', wpLink.selectPageLink );
inputs.search.keyup( wpLink.searchInternalLinks );
// If link exists, select proper values.
e = ed.dom.getParent(ed.selection.getNode(), 'A');
if ( ! e )
return;
active.find('input.url-field').val( e.href );
inputs.title.val( ed.dom.getAttrib(e, 'title') );
// Advanced Options
if ( "_blank" == ed.dom.getAttrib(e, 'target') )
inputs.openInNewTab.attr('checked','checked');
if ( e = ed.dom.getParent(ed.selection.getNode(), 'A') ) {
// Set URL and description.
inputs.url.val( e.href );
inputs.title.val( ed.dom.getAttrib(e, 'title') );
// Set open in new tab.
if ( "_blank" == ed.dom.getAttrib(e, 'target') )
inputs.openInNewTab.attr('checked','checked');
}
},
update : function() {
var el,
ed = tinyMCEPopup.editor,
attrs = {
href : inputs.url.val(),
title : inputs.title.val(),
target : inputs.openInNewTab.attr('checked') ? '_blank' : ''
}, defaultContent, e, b;
if ( active.hasClass('link-panel-custom') ) {
attrs.href = active.find('input.url-field').val();
defaultContent = attrs.href;
} else {
el = active.find('li.selected:visible');
if ( !el.length )
return;
attrs.href = el.children('input').val();
defaultContent = el.text();
}
}, e, b,
defaultContent = attrs.title ? attrs.title : attrs.href;
tinyMCEPopup.restoreSelection();
e = ed.dom.getParent(ed.selection.getNode(), 'A');
@ -190,47 +103,14 @@
tinyMCEPopup.close();
},
maybeLoadPanel : function() {
var panel = active.find('.wp-tab-panel:visible');
if ( panel.length && panel.find('.wp-tab-panel-loading').length )
wpLink.linkPanelAJAX( panel );
},
linkPanelAJAX : function( $panel, params, callback ) {
if ( ! $panel.hasClass('wp-tab-panel') )
$panel = $panel.parents('.wp-tab-panel');
if ( ! $panel.length )
return;
var query = $panel.children('.wp-tab-panel-query').val();
wpLink.linkAJAX( $panel, $.extend({
preset : query,
page : 'all' == query ? 1 : 0
}, params), function(r, lt) {
var pagelinks = $panel.children('.wp-tab-panel-pagelinks');
// Set results
$panel.children('ul').html( wpLink.generateListMarkup( r['results'], lt ) );
// Handle page links
if ( r['page_links'] )
pagelinks.html( r['page_links'] ).show();
else
pagelinks.hide();
// Run callback
if ( callback )
callback(r, lt);
})
},
selectInternalLink : function() {
var t = $(this);
if ( t.hasClass('unselectable') )
return;
t.siblings('.selected').removeClass('selected');
t.addClass('selected');
inputs.url.val( t.children('.item-permalink').val() );
inputs.title.val( t.children('.item-title').text() );
},
selectPageLink : function(e) {
@ -239,37 +119,62 @@
page = page ? page[1] : 1; // If there's no match, it's the first page.
e.preventDefault(); // Prevent the link from redirecting.
wpLink.linkPanelAJAX( $(this), { page : page });
wpLink.linkAJAX( $(this), { page : page });
},
searchInternalLinks : function() {
var t = $(this),
var t = $(this), waiting,
title = t.val();
if ( title ) {
results.recent.hide();
results.search.show();
waiting = t.siblings('img.waiting').show();
wpLink.linkPanelAJAX( t, { title : t.val() }, function(){ waiting.hide(); });
wpLink.linkAJAX( results.search, { title : title }, function(){ waiting.hide(); });
} else {
results.search.hide();
results.recent.show();
}
},
linkAJAX : function( el, params, callback ) {
var linkType = el.parents('.link-panel').data('link-type');
linkAJAX : function( $panel, params, callback ) {
if ( ! $panel.hasClass('query-results') )
$panel = $panel.parents('.query-results');
if ( ! $panel.length )
return;
$.post( ajaxurl, $.extend({
action : 'wp-link-ajax',
type : linkType.type,
name : linkType.name
action : 'wp-link-ajax'
}, params ), function(r) {
return callback(r, linkType);
var pagelinks = $panel.children('.wp-results-pagelinks');
// Set results
$panel.children('ul').html( wpLink.generateListMarkup( r['results'] ) );
// Handle page links
if ( r['page_links'] )
pagelinks.html( r['page_links'] ).show();
else
pagelinks.hide();
// Run callback
if ( callback )
callback( r['results'] );
}, "json" );
},
generateListMarkup : function( results, linkType ) {
generateListMarkup : function( results ) {
var s = '';
if ( ! results )
return '<li class="no-matches-found unselectable"><em>' + wpLinkL10n.noMatchesFound + '</em></li>';
return '<li class="no-matches-found unselectable"><span class="item-title"><em>' + wpLinkL10n.noMatchesFound + '</em></span></li>';
$.each( results, function() {
s+= '<li id="link-to-' + linkType.full + '-' + this['ID'] + '">';
s+= '<input type="hidden" value="' + this['permalink'] + '" />';
s+= '<li><input type="hidden" class="item-permalink" value="' + this['permalink'] + '" />';
s+= '<span class="item-title">'
s+= this['title'] ? this['title'] : '<em>'+ wpLinkL10n.untitled + '</em>';
s+= '</span><span class="item-info">' + this['info'] + '</span>';
s+= '</li>';
});
return s;

View File

@ -1,151 +1,35 @@
<?php
// args expects optionally 'pagenum' and 's'
function wp_link_query( $args = array() ) {
$pts = get_post_types( array( 'publicly_queryable' => true ), 'objects' );
$pt_names = array_keys( $pts );
class WP_Tab_Bar {
var $tabs = array();
var $id = '';
var $classes = array();
var $selected = '';
function add( $id, $label, $url='' ) {
array_push( $this->tabs, array(
'label' => $label,
'for' => $id,
'url' => $url
));
}
function select( $id ) {
$this->selected = $id;
}
function render( $echo=true ) {
if ( empty( $this->selected ) )
$this->selected = $this->tabs[0]['for'];
array_unshift( $this->classes, 'wp-tab-bar' );
$out = "<ul id='$this->id' class='" . esc_attr( implode( ' ', $this->classes ) ) . "'>";
foreach( $this->tabs as $tab ) {
if ( !isset($tab['url']) )
$tab['url'] = '';
$out.= "<li class='";
$out.= $this->selected == $tab['for'] ? 'wp-tab-active' : '';
$out.= "'><input type='hidden' class='wp-tab-for-id' value='{$tab['for']}' />";
$out.= "<a href='{$tab['url']}#{$tab['for']}'>";
$out.= "{$tab['label']}</a></li>";
}
$out.= "</ul>";
if ( $echo )
echo $out;
return $out;
}
}
function wp_link_panel_custom() { ?>
<div id="link-panel-id-custom" class="link-panel link-panel-custom link-panel-active">
<input type="hidden" class="link-panel-type" value="custom" />
<label>
<span><?php _e('URL:'); ?></span><input class="url-field" type="text" />
</label>
</div>
<?php }
function wp_link_panel_structure( $panel_type, $name, $queries ) {
$id = $panel_type . '-' . $name;
?>
<div id="link-panel-id-<?php echo $id; ?>" class="link-panel link-panel-<?php echo $panel_type; ?>">
<!-- <input type="hidden" class="link-panel-type" value="<?php echo $panel_type; ?>" /> -->
<!-- <input type="hidden" class="link-panel-id" value="" /> -->
<?php
$tb = new WP_Tab_Bar();
foreach( $queries as $i => $query ) {
$queries[$i]['id'] = "$id-{$query['preset']}";
$tb->add( $queries[$i]['id'], $query['label'] );
}
$tb->render();
foreach( $queries as $query ): ?>
<div id="<?php echo $query['id']; ?>" class="wp-tab-panel">
<input type="hidden" class="wp-tab-panel-query" value="<?php echo $query['preset']; ?>" />
<?php if ( 'search' == $query['preset'] ): ?>
<label for="<?php echo $id; ?>-search-field" class="link-search-wrapper">
<span><?php _e('Search:'); ?></span>
<input type="text" id="<?php echo $id; ?>-search-field" class="link-search-field" />
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</label>
<ul id="<?php echo $id; ?>-search-results" class="link-search-results"></ul>
<?php else: ?>
<div class="wp-tab-panel-pagelinks wp-tab-panel-pagelinks-top"></div>
<ul>
<li class="wp-tab-panel-loading unselectable"><em><?php _e('Loading...'); ?></em></li>
</ul>
<div class="wp-tab-panel-pagelinks wp-tab-panel-pagelinks-bottom"></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php }
function wp_link_query_post_type( $pt_obj, $preset='all', $opts=array() ) {
$args_base = array(
'post_type' => $pt_obj->name,
$query = array(
'post_type' => $pt_names,
'suppress_filters' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'post_date',
'posts_per_page' => 20,
);
switch( $preset ) {
case 'all':
$args = array_merge( $args_base, array(
'order' => 'ASC',
'orderby' => 'title',
'posts_per_page' => 20,
));
break;
case 'recent':
$args = array_merge( $args_base, array(
'order' => 'DESC',
'orderby' => 'post_date',
'posts_per_page' => 15,
));
break;
case 'search':
$args = array_merge( $args_base, array(
's' => isset($opts['search']) ? $opts['search'] : '',
'posts_per_page' => 10
));
break;
}
// Handle pages if a page number is specified.
if ( isset( $opts['pagenum'] ) && isset( $args['posts_per_page'] ) ) {
$pages = array(
'current' => $opts['pagenum'],
'per_page' => $args['posts_per_page']
);
if ( ! isset( $args['offset'] ) )
$args['offset'] = 0 < $opts['pagenum'] ? $args['posts_per_page'] * ( $opts['pagenum'] - 1 ) : 0;
$pages['offset'] = $args['offset'];
}
// Allow args to be extended.
if ( isset( $opts['args'] ) )
$args = array_merge( $args, $opts['args'] );
$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
if ( isset( $args['s'] ) )
$query['s'] = $args['s'];
$pagination = array(
'current' => $args['pagenum'],
'per_page' => $query['posts_per_page'],
);
$query['offset'] = $pagination['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
// Do main query.
$get_posts = new WP_Query;
$posts = $get_posts->query( $args );
$posts = $get_posts->query( $query );
// Check if any posts were found.
if ( ! $get_posts->post_count )
return false;
@ -153,57 +37,49 @@ function wp_link_query_post_type( $pt_obj, $preset='all', $opts=array() ) {
// Build results.
$results = array();
foreach ( $posts as $post ) {
if ( 'post' == $post->post_type )
$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
else
$info = $pts[ $post->post_type ]->labels->singular_name;
$results[] = array(
'ID' => $post->ID,
'title' => $post->post_title,
'permalink' => get_permalink( $post->ID )
);
'title' => esc_html( strip_tags($post->post_title) ),
'permalink' => get_permalink( $post->ID ),
'info' => $info,
);;
}
// Remaining pagination values.
$pagination['max'] = $get_posts->max_num_pages;
$pagination['page_links'] = paginate_links( array(
'prev_text' => __('&laquo;'),
'next_text' => __('&raquo;'),
'total' => $pagination['max'],
'current' => $pagination['current']
) );
// Build response.
$resp = array(
'query' => $get_posts,
'objects' => $posts,
'results' => $results
'results' => $results,
'pages' => $pagination,
);
// Set remaining pages values.
if ( isset( $pages ) ) {
$pages['max'] = $resp['query']->max_num_pages;
$pages['page_links'] = paginate_links( array(
'prev_text' => __('&laquo;'),
'next_text' => __('&raquo;'),
'total' => $pages['max'],
'current' => $pages['current']
));
$resp['pages'] = $pages;
}
return $resp;
}
function wp_link_ajax( $request ) {
if ( !isset($request['type']) || !isset($request['name']) || !isset($request['preset']) )
die('-1');
// Searches have a title term.
if ( isset( $request['title'] ) )
$args['s'] = stripslashes( $request['title'] );
$args['pagenum'] = ! empty( $request['page'] ) ? absint( $request['page'] ) : 1;
// Run only presets we recognize.
if ( 'pt' != $request['type'] || ! in_array( $request['preset'], array('all','search','recent') ) )
die('-1');
// Searches must have a search term.
else if ( 'search' == $request['preset'] && !isset($request['title']) )
die('-1');
$opts = array();
if ( 'search' == $request['preset'] ) {
$opts['search'] = $request['title'];
} else if ( ! empty( $request['page'] ) ) {
$opts['pagenum'] = $request['page'];
}
if ( 'pt' == $request['type'] && $obj = get_post_type_object($request['name']) )
$resp = wp_link_query_post_type( $obj, $request['preset'], $opts );
$resp = wp_link_query( $args );
if ( ! isset( $resp ) )
die('0');
die( '0' );
$json = array( 'results' => $resp['results'] );
if ( isset( $resp['pages'] ) && !empty( $resp['pages']['page_links'] ) )
@ -212,4 +88,5 @@ function wp_link_ajax( $request ) {
echo json_encode( $json );
echo "\n";
}
?>

View File

@ -23,7 +23,11 @@ var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
<?php
wp_print_scripts( array('jquery', 'jquery-ui-widget') );
?>
<script type="text/javascript" src="plugins/wplink/js/wplink.js?ver=20101023"></script>
<?php
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
$src = "plugins/wplink/js/wplink$suffix.js?ver=20101023";
?>
<script type="text/javascript" src="<?php echo $src; ?>"></script>
<?php
wp_admin_css( 'global', true );
wp_admin_css( 'wp-admin', true );
@ -43,26 +47,11 @@ select {
height: 2em;
}
#link-header,
#link-options,
#link-advanced-options {
padding: 5px;
border-bottom: 1px solid #dfdfdf;
}
#link-header {
padding-bottom: 0;
background: #fff;
}
#link-panel-tab-bar li {
font-weight: bold;
border: #dfdfdf solid;
margin-right: 5px;
border-width: 1px 1px 0;
}
#link-panel-tab-bar .wp-tab-active {
border-color:#ccc;
background-color: #f1f1f1;
}
#link-type {
width: 140px;
@ -77,12 +66,9 @@ select {
}
label input[type="text"] {
width: 220px;
width: 360px;
margin-top: 5px;
}
.wp-tab-panel label input[type="text"] {
float: left;
width: 200px;
}
label span {
display: inline-block;
@ -90,20 +76,21 @@ label span {
text-align: right;
padding-right: 5px;
}
.wp-tab-panel label span {
width: auto;
text-align: left;
float: left;
margin-top: 3px;
}
.link-search-wrapper {
padding: 5px;
border-bottom: solid 1px #dfdfdf;
display: block;
overflow: hidden;
}
.link-search-wrapper span {
float: left;
margin-top: 6px;
}
.link-search-wrapper input[type="text"] {
float: left;
width: 220px;
}
.link-search-wrapper img.waiting {
margin: 4px 1px 0 4px;
margin: 8px 1px 0 4px;
float: left;
display: none;
}
@ -116,9 +103,53 @@ label span {
margin-left: 10px;
font-size: 11px;
}
.query-results {
border: #dfdfdf solid;
border-width: 1px 0;
margin: 5px 0;
background: #fff;
height: 220px;
overflow: auto;
}
.query-results li {
margin-bottom: 0;
border-bottom: 1px solid #dfdfdf;
color: #555;
padding: 4px 6px;
cursor: pointer;
}
.query-results li:hover {
background: #EAF2FA;
color: #333;
}
.query-results li.selected {
background: #f1f1f1;
font-weight: bold;
color: #333;
}
.item-info {
text-transform: uppercase;
color: #aaa;
font-weight: bold;
font-size: 11px;
float: right;
}
#search-results {
display: none;
}
.wp-results-pagelinks {
padding:4px 0;
margin:0 auto;
text-align:center;
}
.wp-results-pagelinks-top {
border-bottom: 1px solid #dfdfdf;
}
.submitbox {
padding: 5px;
padding: 5px 5px 0;
font-size: 11px;
overflow: auto;
height: 29px;
@ -134,71 +165,18 @@ label span {
#wp-update a {
display: inline-block;
}
.wp-tab-active,
.wp-tab-panel {
background: #fff;
}
.wp-tab-panel {
height: 160px;
padding: 0;
}
.wp-tab-panel li {
margin-bottom: 0;
border-bottom: 1px solid #dfdfdf;
color: #555;
padding: 4px 6px;
cursor: pointer;
}
.wp-tab-panel li:hover {
background: #EAF2FA;
color: #333;
}
.wp-tab-panel li.selected {
background: #f1f1f1;
font-weight: bold;
color: #333;
}
.wp-tab-panel-pagelinks {
display: none;
padding:4px 0;
margin:0 auto;
text-align:center;
}
.wp-tab-panel-pagelinks-top {
border-bottom: 1px solid #dfdfdf;
}
</style>
</head>
<?php
// @TODO: Support custom post types.
// $pts = get_post_types( array( 'public' => true ), 'objects' );
$pts = array( get_post_type_object( 'post' ), get_post_type_object( 'page' ) );
$queries = array(
array( 'preset' => 'all', 'label' => __('View All') ),
array( 'preset' => 'recent', 'label' => __('Most Recent') ),
array( 'preset' => 'search', 'label' => __('Search') )
);
$tb = new WP_Tab_Bar();
$tb->id = 'link-panel-tab-bar';
$tb->add( 'link-panel-id-custom', __('External Link') );
foreach( $pts as $pt ) {
$tb->add( "link-panel-id-pt-$pt->name", $pt->labels->singular_name );
}
?>
<body id="post-body">
<div id="link-header">
<?php $tb->render(); ?>
</div>
<div id="link-selector">
<?php
wp_link_panel_custom();
foreach( $pts as $pt )
wp_link_panel_structure('pt', $pt->name, $queries);
?>
<div id="link-options">
<label for="url-field">
<span><?php _e('URL:'); ?></span><input id="url-field" type="text" />
</label>
<label for="link-title-field">
<span><?php _e('Description:'); ?></span><input id="link-title-field" type="text" />
</label>
@ -206,6 +184,40 @@ foreach( $pts as $pt ) {
<input type="checkbox" id="link-target-checkbox" /><span><?php _e('Open in new tab'); ?></span>
</label>
</div>
<div id="search-panel">
<label for="search-field" class="link-search-wrapper">
<span><?php _e('Search:'); ?></span>
<input type="text" id="search-field" class="link-search-field" />
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</label>
<div id="search-results" class="query-results">
<div class="wp-results-pagelinks wp-results-pagelinks-top"></div>
<ul>
<li class="wp-results-loading unselectable"><em><?php _e('Loading...'); ?></em></li>
</ul>
<div class="wp-results-pagelinks wp-results-pagelinks-bottom"></div>
</div>
<?php $most_recent = wp_link_query(); ?>
<div id="most-recent-results" class="query-results">
<div class="wp-results-pagelinks wp-results-pagelinks-top">
<?php echo $most_recent['pages']['page_links']; ?>
</div>
<ul>
<?php foreach ( $most_recent['results'] as $item ): ?>
<li>
<input type="hidden" class="item-permalink" value="<?php echo esc_url( $item['permalink'] ); ?>" />
<span class="item-title"><?php echo $item['title']; ?></span>
<span class="item-info"><?php echo esc_html( $item['info'] ); ?></span>
</li>
<?php endforeach; ?>
</ul>
<div class="wp-results-pagelinks wp-results-pagelinks-bottom">
<?php echo $most_recent['pages']['page_links']; ?>
</div>
</div>
</div>
</div>
<div class="submitbox">
<div id="wp-cancel">