diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php
index b7a939e3d2..38f756b35b 100644
--- a/wp-admin/admin-ajax.php
+++ b/wp-admin/admin-ajax.php
@@ -1074,7 +1074,7 @@ case 'menu-quick-search':
exit;
break;
case 'wp-link-ajax':
- require_once ABSPATH . WPINC . '/js/tinymce/wp-mce-link-includes.php';
+ require_once ABSPATH . WPINC . '/js/tinymce/wp-mce-link.php';
wp_link_ajax( $_POST );
diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php
index 1a5a29ba65..88768d2e85 100644
--- a/wp-admin/admin-header.php
+++ b/wp-admin/admin-header.php
@@ -66,6 +66,7 @@ var userSettings = {
if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
+ add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
wp_enqueue_script('quicktags');
}
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 00df3e8421..cf5f2dcd03 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -1327,10 +1327,10 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
$mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
if ( $teeny ) {
- $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'media', 'fullscreen', 'wordpress', 'wplink') );
+ $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'media', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs') );
$ext_plugins = '';
} else {
- $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink' );
+ $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink', 'wpdialogs' );
/*
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
@@ -1411,8 +1411,6 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
}
}
- $plugins = implode($plugins, ',');
-
if ( $teeny ) {
$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );
$mce_buttons = implode($mce_buttons, ',');
@@ -1485,7 +1483,7 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
'paste_strip_class_attributes' => 'all',
'paste_text_use_dialog' => true,
'wpeditimage_disable_captions' => $no_captions,
- 'plugins' => $plugins
+ 'plugins' => implode($plugins, ',')
);
if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
@@ -1608,4 +1606,21 @@ tinyMCE.init(tinyMCEPreInit.mceInit);
/* ]]> */
+
+
+
+2){c.recent.hide();c.search.show();if(e.lastSearch==g){return}e.lastSearch=g;h=f.siblings("img.waiting").show();c.search.data("river",e.riverDefaults());c.search.scrollTop(0);e.linkAJAX(c.search,{title:g},function(){h.hide()})}else{c.search.hide();c.recent.show()}},linkAJAX:function(i,h,j,g){var f;g=g||{};if(!i.hasClass("query-results")){i=i.parents(".query-results")}if(!i.length){return}f=e.delayedCallback(function(k){e.processAJAXResponse(i,k,j,g)},g.delay);d.post(ajaxurl,d.extend({action:"wp-link-ajax"},h),f,"json")},processAJAXResponse:function(i,f,j,g){var h="";if(!f){if(!g.append){h+=''+wpLinkL10n.noMatchesFound+""}}else{d.each(f,function(){h+='';h+='';h+=this["title"]?this["title"]:""+wpLinkL10n.untitled+"";h+=''+this["info"]+""})}i.children("ul")[g.append?"append":"html"](h);if(j){j(f)}},delayedCallback:function(h,f){var k,j,i,g;if(!f){return h}setTimeout(function(){if(j){return h.apply(g,i)}k=true},f);return function(){if(k){return h.apply(this,arguments)}i=arguments;g=this;j=true}}};d(document).ready(e.init)})(jQuery);
\ No newline at end of file
+(function(d){var a={},c={},b,e={timeToTriggerRiver:150,minRiverAJAXDuration:200,lastSearch:"",riverDefaults:function(){return{page:2,allLoaded:false,active:false}},init:function(){a.dialog=d("#wp-link");a.url=d("#url-field");a.title=d("#link-title-field");a.openInNewTab=d("#link-target-checkbox");a.search=d("#search-field");c.search=d("#search-results");c.recent=d("#most-recent-results");c.search.data("river",e.riverDefaults());c.recent.data("river",e.riverDefaults());c.group=d(".query-results",a.dialog);d("#wp-link-update").click(e.update);d("#wp-link-cancel").click(function(){tinyMCEPopup.close()});c.group.delegate("li","click",e.selectInternalLink);c.group.scroll(e.maybeLoadRiver);a.search.keyup(e.searchInternalLinks);a.dialog.bind("dialogopen",e.refresh)},refresh:function(){var f;b=tinyMCEPopup.editor;if(f=b.dom.getParent(b.selection.getNode(),"A")){a.url.val(f.href);a.title.val(b.dom.getAttrib(f,"title"));if("_blank"==b.dom.getAttrib(f,"target")){a.openInNewTab.attr("checked","checked")}}c.group.find(".selected").removeClass("selected");a.url.focus()},update:function(){var j,g=tinyMCEPopup.editor,h={href:a.url.val(),title:a.title.val(),target:a.openInNewTab.attr("checked")?"_blank":""},k,f,i=h.title?h.title:h.href;tinyMCEPopup.restoreSelection();k=g.dom.getParent(g.selection.getNode(),"A");if(!h.href){if(g.selection.isCollapsed()){tinyMCEPopup.close();return}else{if(k){tinyMCEPopup.execCommand("mceBeginUndoLevel");f=g.selection.getBookmark();g.dom.remove(k,1);g.selection.moveToBookmark(f);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(k==null){g.getDoc().execCommand("unlink",false,null);if(g.selection.isCollapsed()){j=g.dom.create("a",{href:"#mce_temp_url#"},i);g.selection.setNode(j)}else{tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1})}tinymce.each(g.dom.select("a"),function(l){if(g.dom.getAttrib(l,"href")=="#mce_temp_url#"){k=l;g.dom.setAttribs(k,h)}})}else{g.dom.setAttribs(k,h)}if(k.childNodes.length!=1||k.firstChild.nodeName!="IMG"){g.focus();g.selection.select(k);g.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},selectInternalLink:function(){var f=d(this);if(f.hasClass("unselectable")){return}f.siblings(".selected").removeClass("selected");f.addClass("selected");a.url.val(f.children(".item-permalink").val());a.title.val(f.children(".item-title").text())},maybeLoadRiver:function(){var h=d(this),g=h.children("ul"),i=h.data("river"),f=h.scrollTop()+h.height();if(f!=g.height()||i.active||i.allLoaded){return}setTimeout(function(){var j=h.scrollTop(),k=j+h.height(),l=h.find(".river-waiting");if(f!=k||k!=g.height()||i.active||i.allLoaded){return}i.active=true;l.show();h.scrollTop(j+l.outerHeight());e.linkAJAX(h,{page:i.page},function(m){i.page++;i.active=false;i.allLoaded=!m;l.hide()},{append:true,delay:e.minRiverAJAXDuration})},e.timeToTriggerRiver)},searchInternalLinks:function(){var f=d(this),h,g=f.val();if(g.length>2){c.recent.hide();c.search.show();if(e.lastSearch==g){return}e.lastSearch=g;h=f.siblings("img.waiting").show();c.search.data("river",e.riverDefaults());c.search.scrollTop(0);e.linkAJAX(c.search,{title:g},function(){h.hide()})}else{c.search.hide();c.recent.show()}},linkAJAX:function(i,h,j,g){var f;g=g||{};if(!i.hasClass("query-results")){i=i.parents(".query-results")}if(!i.length){return}f=e.delayedCallback(function(k){e.processAJAXResponse(i,k,j,g)},g.delay);d.post(ajaxurl,d.extend({action:"wp-link-ajax"},h),f,"json")},processAJAXResponse:function(i,f,j,g){var h="";if(!f){if(!g.append){h+=''+wpLinkL10n.noMatchesFound+""}}else{d.each(f,function(){h+='';h+='';h+=this["title"]?this["title"]:""+wpLinkL10n.untitled+"";h+=''+this["info"]+""})}i.children("ul")[g.append?"append":"html"](h);if(j){j(f)}},delayedCallback:function(h,f){var k,j,i,g;if(!f){return h}setTimeout(function(){if(j){return h.apply(g,i)}k=true},f);return function(){if(k){return h.apply(this,arguments)}i=arguments;g=this;j=true}}};d(document).ready(e.init)})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/wp-mce-link-includes.php b/wp-includes/js/tinymce/wp-mce-link-includes.php
deleted file mode 100644
index 767a1d71d1..0000000000
--- a/wp-includes/js/tinymce/wp-mce-link-includes.php
+++ /dev/null
@@ -1,66 +0,0 @@
- true ), 'objects' );
- $pt_names = array_keys( $pts );
-
- $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,
- );
-
- $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
-
- if ( isset( $args['s'] ) )
- $query['s'] = $args['s'];
-
- $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
-
- // Do main query.
- $get_posts = new WP_Query;
- $posts = $get_posts->query( $query );
- // Check if any posts were found.
- if ( ! $get_posts->post_count )
- return false;
-
- // 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' => esc_html( strip_tags($post->post_title) ),
- 'permalink' => get_permalink( $post->ID ),
- 'info' => $info,
- );
- }
-
- return $results;
-}
-
-function wp_link_ajax( $request ) {
- // Searches have a title term.
- if ( isset( $request['title'] ) )
- $args['s'] = stripslashes( $request['title'] );
- $args['pagenum'] = ! empty( $request['page'] ) ? absint( $request['page'] ) : 1;
-
- $results = wp_link_query( $args );
-
- if ( ! isset( $results ) )
- die( '0' );
-
- echo json_encode( $results );
- echo "\n";
-}
-
-?>
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/wp-mce-link.php b/wp-includes/js/tinymce/wp-mce-link.php
index 3eed49db6d..80377fb533 100644
--- a/wp-includes/js/tinymce/wp-mce-link.php
+++ b/wp-includes/js/tinymce/wp-mce-link.php
@@ -1,160 +1,71 @@
true ), 'objects' );
+ $pt_names = array_keys( $pts );
-require_once '../../../wp-load.php';
-include './wp-mce-link-includes.php';
+ $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,
+ );
-header( 'Content-Type: text/html; charset=' . get_bloginfo( 'charset' ) );
+ $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
+
+ if ( isset( $args['s'] ) )
+ $query['s'] = $args['s'];
+
+ $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
+
+ // Do main query.
+ $get_posts = new WP_Query;
+ $posts = $get_posts->query( $query );
+ // Check if any posts were found.
+ if ( ! $get_posts->post_count )
+ return false;
+
+ // 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' => esc_html( strip_tags($post->post_title) ),
+ 'permalink' => get_permalink( $post->ID ),
+ 'info' => $info,
+ );
+ }
+
+ return $results;
+}
+
+function wp_link_ajax( $request ) {
+ // Searches have a title term.
+ if ( isset( $request['title'] ) )
+ $args['s'] = stripslashes( $request['title'] );
+ $args['pagenum'] = ! empty( $request['page'] ) ? absint( $request['page'] ) : 1;
+
+ $results = wp_link_query( $args );
+
+ if ( ! isset( $results ) )
+ die( '0' );
+
+ echo json_encode( $results );
+ echo "\n";
+}
+
+function wp_link_dialog() {
?>
-
->
-
-
-
-
-
-
-
-
-
-
-
+
@@ -204,12 +115,12 @@ label span {
-
+
-
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/wp-tinymce.js.gz b/wp-includes/js/tinymce/wp-tinymce.js.gz
index 27d6055207..9c0a10e962 100644
Binary files a/wp-includes/js/tinymce/wp-tinymce.js.gz and b/wp-includes/js/tinymce/wp-tinymce.js.gz differ
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index a94e83e2bb..a4c56e3efe 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -268,6 +268,14 @@ function wp_default_scripts( &$scripts ) {
'url' => __( 'URL:' ),
'noShortlink' => __( 'No shortlink available for this page.' ),
) );
+
+ $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101117' );
+ $scripts->localize( 'wplink', 'wpLinkL10n', array(
+ 'untitled' => __('Untitled'),
+ 'noMatchesFound' => __('No matches found.'),
+ ) );
+
+ $scripts->add( 'wpdialogsPopup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", false, '20101117' );
if ( is_admin() ) {
$scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
@@ -504,6 +512,11 @@ function wp_default_styles( &$styles ) {
// Admin bar
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101117' );
+
+ // WP jQuery UI Dialog
+ $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101117' );
+ // WPLink TinyMCE plugin
+ $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101117' );
foreach ( $rtl_styles as $rtl_style ) {
$styles->add_data( $rtl_style, 'rtl', true );