Ticket #11420: wpdialogs-and-friends.diff

File wpdialogs-and-friends.diff, 59.2 KB (added by koopersmith, 3 years ago)
Line 
1Index: wp-includes/js/tinymce/plugins/wplink/editor_plugin.js
2===================================================================
3--- wp-includes/js/tinymce/plugins/wplink/editor_plugin.js      (revision 16439)
4+++ wp-includes/js/tinymce/plugins/wplink/editor_plugin.js      (working copy)
5@@ -1 +1 @@
6-(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:430,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)})();
7\ No newline at end of file
8+(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){a.addCommand("WP_Link",function(){a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{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)})();
9\ No newline at end of file
10Index: wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css
11===================================================================
12--- wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css    (revision 0)
13+++ wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css    (revision 0)
14@@ -0,0 +1,113 @@
15+#wp-link p.howto {
16+       margin: 3px;
17+}
18+#link-options {
19+       padding: 10px 0 14px;
20+       border-bottom: 1px solid #dfdfdf;
21+       margin: 0 6px 14px;
22+}
23+#wp-link label input[type="text"] {
24+       width: 360px;
25+       margin-top: 5px;
26+}
27+#wp-link label span {
28+       display: inline-block;
29+       width: 80px;
30+       text-align: right;
31+       padding-right: 5px;
32+}
33+#wp-link .link-search-wrapper {
34+       margin: 5px 5px 9px;
35+       display: block;
36+       overflow: hidden;
37+}
38+#wp-link .link-search-wrapper span {
39+       float: left;
40+       margin-top: 6px;
41+}
42+#wp-link .link-search-wrapper input[type="text"] {
43+       float: left;
44+       width: 220px;
45+}
46+#wp-link .link-search-wrapper img.waiting {
47+       margin: 8px 1px 0 4px;
48+       float: left;
49+       display: none;
50+}
51+#open-in-new-tab {
52+       display: inline-block;
53+       padding: 3px 0 0;
54+       margin: 0 0 0 87px;
55+}
56+#open-in-new-tab span {
57+       width: auto;
58+       margin-left: 6px;
59+       font-size: 11px;
60+}
61+.query-results {
62+       border: 1px #dfdfdf solid;
63+       margin: 0 5px 5px;
64+       background: #fff;
65+       height: 185px;
66+       overflow: auto;
67+}
68+.query-results li {
69+       margin-bottom: 0;
70+       border-bottom: 1px solid #f1f1f1;
71+       color: #555;
72+       padding: 4px 6px;
73+       cursor: pointer;
74+}
75+.query-results li:hover {
76+       background: #eaf2fa;
77+       color: #333;
78+}
79+#wp-link .query-results li.unselectable:hover {
80+       background: #fff;
81+       cursor: auto;
82+       color: #555;
83+}
84+#wp-link .query-results li.unselectable {
85+       border-bottom: 1px solid #dfdfdf;
86+}
87+#wp-link .query-results li.selected {
88+       background: #f1f1f1;
89+       color: #333;
90+}
91+#wp-link .query-results li.selected .item-title {
92+       font-weight: bold;
93+}
94+#wp-link .item-info {
95+       text-transform: uppercase;
96+       color: #aaa;
97+       font-size: 11px;
98+       float: right;
99+}
100+#search-results {
101+       display: none;
102+}
103+#wp-link .river-waiting {
104+       display: none;
105+       padding: 10px 0;
106+}
107+#wp-link .river-waiting img.waiting {
108+       margin: 0 auto;
109+       display: block;
110+}
111+#wp-link .submitbox {
112+       padding: 5px 5px 0;
113+       font-size: 11px;
114+       overflow: auto;
115+       height: 29px;
116+}
117+#wp-link-cancel {
118+       line-height: 25px;
119+       float: left;
120+}
121+#wp-link-update {
122+       line-height: 23px;
123+       float: right;
124+}
125+#wp-link-update a {
126+       display: inline-block;
127+}
128\ No newline at end of file
129Index: wp-includes/js/tinymce/plugins/wplink/css/wplink.css
130===================================================================
131--- wp-includes/js/tinymce/plugins/wplink/css/wplink.css        (revision 0)
132+++ wp-includes/js/tinymce/plugins/wplink/css/wplink.css        (revision 0)
133@@ -0,0 +1 @@
134+#wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#open-in-new-tab{display:inline-block;padding:3px 0 0;margin:0 0 0 87px;}#open-in-new-tab span{width:auto;margin-left:6px;font-size:11px;}.query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;}.query-results li{margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#555;padding:4px 6px;cursor:pointer;}.query-results li:hover{background:#eaf2fa;color:#333;}#wp-link .query-results li.unselectable:hover{background:#fff;cursor:auto;color:#555;}#wp-link .query-results li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link .query-results li.selected{background:#f1f1f1;color:#333;}#wp-link .query-results li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#aaa;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 5px 0;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}#wp-link-update a{display:inline-block;}
135\ No newline at end of file
136Index: wp-includes/js/tinymce/plugins/wplink/js/wplink.js
137===================================================================
138--- wp-includes/js/tinymce/plugins/wplink/js/wplink.js  (revision 16439)
139+++ wp-includes/js/tinymce/plugins/wplink/js/wplink.js  (working copy)
140@@ -1 +1 @@
141-(function(d){var a={},c={},b,e={timeToTriggerRiver:150,minRiverAJAXDuration:200,lastSearch:"",riverDefaults:function(){return{page:2,allLoaded:false,active:false}},init:function(){var f;b=tinyMCEPopup.editor;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());d("#wp-update").click(e.update);d("#wp-cancel").click(function(){tinyMCEPopup.close()});d(".query-results").delegate("li","click",e.selectInternalLink);d(".query-results").scroll(e.maybeLoadRiver);a.search.keyup(e.searchInternalLinks);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")}}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+='<li class="no-matches-found unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{d.each(f,function(){h+='<li><input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';h+='<span class="item-title">';h+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";h+='</span><span class="item-info">'+this["info"]+"</span></li>"})}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);
142\ No newline at end of file
143+(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+='<li class="no-matches-found unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{d.each(f,function(){h+='<li><input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';h+='<span class="item-title">';h+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";h+='</span><span class="item-info">'+this["info"]+"</span></li>"})}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);
144\ No newline at end of file
145Index: wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
146===================================================================
147--- wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js      (revision 16439)
148+++ wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js      (working copy)
149@@ -12,11 +12,7 @@
150                        };
151                },
152                init : function() {
153-                       var e;
154-                       // Init shared vars
155-                       ed = tinyMCEPopup.editor;
156-
157-
158+                       inputs.dialog = $('#wp-link');
159                        // URL
160                        inputs.url = $('#url-field');
161                        // Secondary options
162@@ -29,14 +25,25 @@
163                        results.recent = $('#most-recent-results');
164                        results.search.data('river', wpLink.riverDefaults() );
165                        results.recent.data('river', wpLink.riverDefaults() );
166+                       results.group = $('.query-results', inputs.dialog);
167 
168                        // Bind event handlers
169-                       $('#wp-update').click( wpLink.update );
170-                       $('#wp-cancel').click( function() { tinyMCEPopup.close(); } );
171-                       $('.query-results').delegate('li', 'click', wpLink.selectInternalLink );
172-                       $('.query-results').scroll( wpLink.maybeLoadRiver );
173+                       $('#wp-link-update').click( wpLink.update );
174+                       $('#wp-link-cancel').click( function() { tinyMCEPopup.close(); } );
175+                       
176+                       results.group.delegate('li', 'click', wpLink.selectInternalLink )
177+                       results.group.scroll( wpLink.maybeLoadRiver );
178+                       
179                        inputs.search.keyup( wpLink.searchInternalLinks );
180+                       
181+                       inputs.dialog.bind('dialogopen', wpLink.refresh);
182+               },
183 
184+               refresh : function() {
185+                       var e;
186+                       
187+                       ed = tinyMCEPopup.editor;
188+                       
189                        // If link exists, select proper values.
190                        if ( e = ed.dom.getParent(ed.selection.getNode(), 'A') ) {
191                                // Set URL and description.
192@@ -47,6 +54,8 @@
193                                        inputs.openInNewTab.attr('checked','checked');
194                        }
195 
196+                       // Clear previously selected links
197+                       results.group.find('.selected').removeClass('selected');
198                        // Focus the URL field
199                        inputs.url.focus();
200                },
201Index: wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js
202===================================================================
203--- wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js  (revision 16439)
204+++ wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js  (working copy)
205@@ -12,10 +12,11 @@
206                        // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
207                        ed.addCommand('WP_Link', function() {
208                                ed.windowManager.open({
209-                                       file : tinymce.baseURL + '/wp-mce-link.php',
210+                                       id : 'wp-link',
211                                        width : 480,
212-                                       height : 430,
213-                                       inline : 1
214+                                       height : "auto",
215+                                       wpDialog : true,
216+                                       title : ed.getLang('advlink.link_desc')
217                                }, {
218                                        plugin_url : url // Plugin absolute URL
219                                });
220Index: wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js
221===================================================================
222--- wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js   (revision 0)
223+++ wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js   (revision 0)
224@@ -0,0 +1 @@
225+(function(b){var a=function(c){return function(){if(this.features.wpDialog){return c.apply(this,arguments)}else{return this.parent.apply(this,arguments)}}};tinymce.create("tinymce.plugins.WPDialogs",{init:function(c,d){c.onBeforeRenderUI.add(function(){c.windowManager=new tinymce.WPWindowManager(c)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=b("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;if(tinyMCEPopup){tinyMCEPopup.init()}c.dialog({title:e.title,width:e.width,height:e.height,modal:true})},close:a(function(){this.element.dialog("close")}),});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(jQuery);
226\ No newline at end of file
227Index: wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js
228===================================================================
229--- wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js       (revision 0)
230+++ wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js       (revision 0)
231@@ -0,0 +1,80 @@
232+/**
233+ * editor_plugin_src.js
234+ *
235+ * Copyright 2009, Moxiecode Systems AB
236+ * Released under LGPL License.
237+ *
238+ * License: http://tinymce.moxiecode.com/license
239+ * Contributing: http://tinymce.moxiecode.com/contributing
240+ */
241+
242+(function($) {
243+       var wpDialogFn = function( fn ) {
244+               return function() {
245+                       if ( this.features.wpDialog )
246+                               return fn.apply( this, arguments );
247+                       else
248+                               return this.parent.apply( this, arguments );
249+               };
250+       };
251+
252+       tinymce.create('tinymce.plugins.WPDialogs', {
253+               init : function(ed, url) {
254+                       // Replace window manager
255+                       ed.onBeforeRenderUI.add(function() {
256+                               ed.windowManager = new tinymce.WPWindowManager(ed);
257+                       });
258+               },
259+
260+               getInfo : function() {
261+                       return {
262+                               longname : 'WPDialogs',
263+                               author : 'WordPress',
264+                               authorurl : 'http://wordpress.org',
265+                               infourl : 'http://wordpress.org',
266+                               version : '0.1'
267+                       };
268+               }
269+       });
270+
271+       tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
272+               WPWindowManager : function(ed) {
273+                       this.parent(ed);
274+               },
275+
276+               open : function(f, p) {
277+                       var t = this, element;
278+                       // Can't use wpDialogFn here; this.features isn't set yet.
279+                       if ( ! f.wpDialog )
280+                               return this.parent( f, p );
281+                       else if ( ! f.id )
282+                               return;
283+                       
284+                       element = $('#' + f.id);
285+                       if ( ! element.length )
286+                               return;
287+                       
288+                       t.features = f;
289+                       t.params = p;
290+                       t.onOpen.dispatch(t, f, p);
291+                       t.element = t.windows[ f.id ] = element;
292+                       
293+                       if ( tinyMCEPopup )
294+                               tinyMCEPopup.init();
295+                       
296+                       element.dialog({
297+                               title: f.title,
298+                               width: f.width,
299+                               height: f.height,
300+                               modal: true
301+                       });
302+               },
303+               close : wpDialogFn(function() {
304+                       this.element.dialog('close');
305+               }),
306+       });
307+
308+       // Register plugin
309+       tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs);
310+})(jQuery);
311+
312Index: wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js
313===================================================================
314--- wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js    (revision 0)
315+++ wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js    (revision 0)
316@@ -0,0 +1,432 @@
317+/**
318+ * popup.js
319+ *
320+ * An altered version of tinyMCEPopup to work in the same window as tinymce.
321+ *
322+ * ------------------------------------------------------------------
323+ *
324+ * Copyright 2009, Moxiecode Systems AB
325+ * Released under LGPL License.
326+ *
327+ * License: http://tinymce.moxiecode.com/license
328+ * Contributing: http://tinymce.moxiecode.com/contributing
329+ */
330+
331+// Some global instances
332+
333+/**
334+ * TinyMCE popup/dialog helper class. This gives you easy access to the
335+ * parent editor instance and a bunch of other things. It's higly recommended
336+ * that you load this script into your dialogs.
337+ *
338+ * @static
339+ * @class tinyMCEPopup
340+ */
341+var tinyMCEPopup = {
342+       /**
343+        * Initializes the popup this will be called automatically.
344+        *
345+        * @method init
346+        */
347+       init : function() {
348+               var t = this, w, ti;
349+
350+               // Find window & API
351+               w = t.getWin();
352+               tinymce = w.tinymce;
353+               tinyMCE = w.tinyMCE;
354+               t.editor = tinymce.EditorManager.activeEditor;
355+               t.params = t.editor.windowManager.params;
356+               t.features = t.editor.windowManager.features;
357+               t.dom = tinymce.dom;
358+
359+               // Setup on init listeners
360+               t.listeners = [];
361+               t.onInit = {
362+                       add : function(f, s) {
363+                               t.listeners.push({func : f, scope : s});
364+                       }
365+               };
366+
367+               t.isWindow = !t.getWindowArg('mce_inline');
368+               t.id = t.features.id;
369+               t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
370+       },
371+
372+       /**
373+        * Returns the reference to the parent window that opened the dialog.
374+        *
375+        * @method getWin
376+        * @return {Window} Reference to the parent window that opened the dialog.
377+        */
378+       getWin : function() {
379+               return window;
380+       },
381+
382+       /**
383+        * Returns a window argument/parameter by name.
384+        *
385+        * @method getWindowArg
386+        * @param {String} n Name of the window argument to retrive.
387+        * @param {String} dv Optional default value to return.
388+        * @return {String} Argument value or default value if it wasn't found.
389+        */
390+       getWindowArg : function(n, dv) {
391+               var v = this.params[n];
392+
393+               return tinymce.is(v) ? v : dv;
394+       },
395+
396+       /**
397+        * Returns a editor parameter/config option value.
398+        *
399+        * @method getParam
400+        * @param {String} n Name of the editor config option to retrive.
401+        * @param {String} dv Optional default value to return.
402+        * @return {String} Parameter value or default value if it wasn't found.
403+        */
404+       getParam : function(n, dv) {
405+               return this.editor.getParam(n, dv);
406+       },
407+
408+       /**
409+        * Returns a language item by key.
410+        *
411+        * @method getLang
412+        * @param {String} n Language item like mydialog.something.
413+        * @param {String} dv Optional default value to return.
414+        * @return {String} Language value for the item like "my string" or the default value if it wasn't found.
415+        */
416+       getLang : function(n, dv) {
417+               return this.editor.getLang(n, dv);
418+       },
419+
420+       /**
421+        * Executed a command on editor that opened the dialog/popup.
422+        *
423+        * @method execCommand
424+        * @param {String} cmd Command to execute.
425+        * @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not.
426+        * @param {Object} val Optional value to pass with the comman like an URL.
427+        * @param {Object} a Optional arguments object.
428+        */
429+       execCommand : function(cmd, ui, val, a) {
430+               a = a || {};
431+               a.skip_focus = 1;
432+
433+               this.restoreSelection();
434+               return this.editor.execCommand(cmd, ui, val, a);
435+       },
436+
437+       /**
438+        * Resizes the dialog to the inner size of the window. This is needed since various browsers
439+        * have different border sizes on windows.
440+        *
441+        * @method resizeToInnerSize
442+        */
443+       resizeToInnerSize : function() {
444+               var t = this;
445+
446+               // Detach it to workaround a Chrome specific bug
447+               // https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281
448+               setTimeout(function() {
449+                       var vp = t.dom.getViewPort(window);
450+
451+                       t.editor.windowManager.resizeBy(
452+                               t.getWindowArg('mce_width') - vp.w,
453+                               t.getWindowArg('mce_height') - vp.h,
454+                               t.id || window
455+                       );
456+               }, 0);
457+       },
458+
459+       /**
460+        * Will executed the specified string when the page has been loaded. This function
461+        * was added for compatibility with the 2.x branch.
462+        *
463+        * @method executeOnLoad
464+        * @param {String} s String to evalutate on init.
465+        */
466+       executeOnLoad : function(s) {
467+               this.onInit.add(function() {
468+                       eval(s);
469+               });
470+       },
471+
472+       /**
473+        * Stores the current editor selection for later restoration. This can be useful since some browsers
474+        * looses it's selection if a control element is selected/focused inside the dialogs.
475+        *
476+        * @method storeSelection
477+        */
478+       storeSelection : function() {
479+               this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
480+       },
481+
482+       /**
483+        * Restores any stored selection. This can be useful since some browsers
484+        * looses it's selection if a control element is selected/focused inside the dialogs.
485+        *
486+        * @method restoreSelection
487+        */
488+       restoreSelection : function() {
489+               var t = tinyMCEPopup;
490+
491+               if (!t.isWindow && tinymce.isIE)
492+                       t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
493+       },
494+
495+       /**
496+        * Loads a specific dialog language pack. If you pass in plugin_url as a arugment
497+        * when you open the window it will load the <plugin url>/langs/<code>_dlg.js lang pack file.
498+        *
499+        * @method requireLangPack
500+        */
501+       requireLangPack : function() {
502+               var t = this, u = t.getWindowArg('plugin_url') || t.getWindowArg('theme_url');
503+
504+               if (u && t.editor.settings.language && t.features.translate_i18n !== false) {
505+                       u += '/langs/' + t.editor.settings.language + '_dlg.js';
506+
507+                       if (!tinymce.ScriptLoader.isDone(u)) {
508+                               document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
509+                               tinymce.ScriptLoader.markDone(u);
510+                       }
511+               }
512+       },
513+
514+       /**
515+        * Executes a color picker on the specified element id. When the user
516+        * then selects a color it will be set as the value of the specified element.
517+        *
518+        * @method pickColor
519+        * @param {DOMEvent} e DOM event object.
520+        * @param {string} element_id Element id to be filled with the color value from the picker.
521+        */
522+       pickColor : function(e, element_id) {
523+               this.execCommand('mceColorPicker', true, {
524+                       color : document.getElementById(element_id).value,
525+                       func : function(c) {
526+                               document.getElementById(element_id).value = c;
527+
528+                               try {
529+                                       document.getElementById(element_id).onchange();
530+                               } catch (ex) {
531+                                       // Try fire event, ignore errors
532+                               }
533+                       }
534+               });
535+       },
536+
537+       /**
538+        * Opens a filebrowser/imagebrowser this will set the output value from
539+        * the browser as a value on the specified element.
540+        *
541+        * @method openBrowser
542+        * @param {string} element_id Id of the element to set value in.
543+        * @param {string} type Type of browser to open image/file/flash.
544+        * @param {string} option Option name to get the file_broswer_callback function name from.
545+        */
546+       openBrowser : function(element_id, type, option) {
547+               tinyMCEPopup.restoreSelection();
548+               this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
549+       },
550+
551+       /**
552+        * Creates a confirm dialog. Please don't use the blocking behavior of this
553+        * native version use the callback method instead then it can be extended.
554+        *
555+        * @method confirm
556+        * @param {String} t Title for the new confirm dialog.
557+        * @param {function} cb Callback function to be executed after the user has selected ok or cancel.
558+        * @param {Object} s Optional scope to execute the callback in.
559+        */
560+       confirm : function(t, cb, s) {
561+               this.editor.windowManager.confirm(t, cb, s, window);
562+       },
563+
564+       /**
565+        * Creates a alert dialog. Please don't use the blocking behavior of this
566+        * native version use the callback method instead then it can be extended.
567+        *
568+        * @method alert
569+        * @param {String} t Title for the new alert dialog.
570+        * @param {function} cb Callback function to be executed after the user has selected ok.
571+        * @param {Object} s Optional scope to execute the callback in.
572+        */
573+       alert : function(tx, cb, s) {
574+               this.editor.windowManager.alert(tx, cb, s, window);
575+       },
576+
577+       /**
578+        * Closes the current window.
579+        *
580+        * @method close
581+        */
582+       close : function() {
583+               var t = this;
584+
585+               // To avoid domain relaxing issue in Opera
586+               function close() {
587+                       t.editor.windowManager.close(window);
588+                       t.editor = null;
589+               };
590+
591+               if (tinymce.isOpera)
592+                       t.getWin().setTimeout(close, 0);
593+               else
594+                       close();
595+       },
596+
597+       // Internal functions   
598+
599+       _restoreSelection : function() {
600+               var e = window.event.srcElement;
601+
602+               if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
603+                       tinyMCEPopup.restoreSelection();
604+       },
605+
606+/*     _restoreSelection : function() {
607+               var e = window.event.srcElement;
608+
609+               // If user focus a non text input or textarea
610+               if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
611+                       tinyMCEPopup.restoreSelection();
612+       },*/
613+
614+       _onDOMLoaded : function() {
615+               var t = tinyMCEPopup, ti = document.title, bm, h, nv;
616+
617+               if (t.domLoaded)
618+                       return;
619+
620+               t.domLoaded = 1;
621+
622+               tinyMCEPopup.init();
623+
624+               // Translate page
625+               if (t.features.translate_i18n !== false) {
626+                       h = document.body.innerHTML;
627+
628+                       // Replace a=x with a="x" in IE
629+                       if (tinymce.isIE)
630+                               h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
631+
632+                       document.dir = t.editor.getParam('directionality','');
633+
634+                       if ((nv = t.editor.translate(h)) && nv != h)
635+                               document.body.innerHTML = nv;
636+
637+                       if ((nv = t.editor.translate(ti)) && nv != ti)
638+                               document.title = ti = nv;
639+               }
640+
641+               document.body.style.display = '';
642+
643+               // Restore selection in IE when focus is placed on a non textarea or input element of the type text
644+               if (tinymce.isIE) {
645+                       document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
646+
647+                       // Add base target element for it since it would fail with modal dialogs
648+                       t.dom.add(t.dom.select('head')[0], 'base', {target : '_self'});
649+               }
650+
651+               t.restoreSelection();
652+
653+               // Set inline title
654+               if (!t.isWindow)
655+                       t.editor.windowManager.setTitle(window, ti);
656+               else
657+                       window.focus();
658+
659+               if (!tinymce.isIE && !t.isWindow) {
660+                       tinymce.dom.Event._add(document, 'focus', function() {
661+                               t.editor.windowManager.focus(t.id);
662+                       });
663+               }
664+
665+               // Patch for accessibility
666+               tinymce.each(t.dom.select('select'), function(e) {
667+                       e.onkeydown = tinyMCEPopup._accessHandler;
668+               });
669+
670+               // Call onInit
671+               // Init must be called before focus so the selection won't get lost by the focus call
672+               tinymce.each(t.listeners, function(o) {
673+                       o.func.call(o.scope, t.editor);
674+               });
675+
676+               // Move focus to window
677+               if (t.getWindowArg('mce_auto_focus', true)) {
678+                       window.focus();
679+
680+                       // Focus element with mceFocus class
681+                       tinymce.each(document.forms, function(f) {
682+                               tinymce.each(f.elements, function(e) {
683+                                       if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
684+                                               e.focus();
685+                                               return false; // Break loop
686+                                       }
687+                               });
688+                       });
689+               }
690+
691+               document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
692+       },
693+
694+       _accessHandler : function(e) {
695+               e = e || window.event;
696+
697+               if (e.keyCode == 13 || e.keyCode == 32) {
698+                       e = e.target || e.srcElement;
699+
700+                       if (e.onchange)
701+                               e.onchange();
702+
703+                       return tinymce.dom.Event.cancel(e);
704+               }
705+       },
706+
707+       _closeWinKeyHandler : function(e) {
708+               e = e || window.event;
709+
710+               if (e.keyCode == 27)
711+                       tinyMCEPopup.close();
712+       },
713+
714+       _wait : function() {
715+               // Use IE method
716+               if (document.attachEvent) {
717+                       document.attachEvent("onreadystatechange", function() {
718+                               if (document.readyState === "complete") {
719+                                       document.detachEvent("onreadystatechange", arguments.callee);
720+                                       tinyMCEPopup._onDOMLoaded();
721+                               }
722+                       });
723+
724+                       if (document.documentElement.doScroll && window == window.top) {
725+                               (function() {
726+                                       if (tinyMCEPopup.domLoaded)
727+                                               return;
728+
729+                                       try {
730+                                               // If IE is used, use the trick by Diego Perini
731+                                               // http://javascript.nwbox.com/IEContentLoaded/
732+                                               document.documentElement.doScroll("left");
733+                                       } catch (ex) {
734+                                               setTimeout(arguments.callee, 0);
735+                                               return;
736+                                       }
737+
738+                                       tinyMCEPopup._onDOMLoaded();
739+                               })();
740+                       }
741+
742+                       document.attachEvent('onload', tinyMCEPopup._onDOMLoaded);
743+               } else if (document.addEventListener) {
744+                       window.addEventListener('DOMContentLoaded', tinyMCEPopup._onDOMLoaded, false);
745+                       window.addEventListener('load', tinyMCEPopup._onDOMLoaded, false);
746+               }
747+       }
748+};
749Index: wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js
750===================================================================
751--- wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js        (revision 0)
752+++ wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js        (revision 0)
753@@ -0,0 +1 @@
754+var tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=tinymce.dom;b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.features.id;b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},0)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);a.editor=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;tinyMCEPopup.init();if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};
755\ No newline at end of file
756Index: wp-includes/js/tinymce/wp-mce-link.php
757===================================================================
758--- wp-includes/js/tinymce/wp-mce-link.php      (revision 16439)
759+++ wp-includes/js/tinymce/wp-mce-link.php      (working copy)
760@@ -1,160 +1,71 @@
761 <?php
762+// args expects optionally 'pagenum' and 's'
763+function wp_link_query( $args = array() ) {
764+       $pts = get_post_types( array( 'publicly_queryable' => true ), 'objects' );
765+       $pt_names = array_keys( $pts );
766 
767-require_once '../../../wp-load.php';
768-include './wp-mce-link-includes.php';
769+       $query = array(
770+               'post_type' => $pt_names,
771+               'suppress_filters' => true,
772+               'update_post_term_cache' => false,
773+               'update_post_meta_cache' => false,
774+               'post_status' => 'publish',
775+               'order' => 'DESC',
776+               'orderby' => 'post_date',
777+               'posts_per_page' => 20,
778+       );
779 
780-header( 'Content-Type: text/html; charset=' . get_bloginfo( 'charset' ) );
781-?>
782-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
783-<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
784-<head>
785-<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_bloginfo('charset'); ?>" />
786-<title><?php _e( 'Insert/edit link' ); ?></title>
787-<script type="text/javascript">
788-//<![CDATA[
789-var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>',
790-       wpLinkL10n = {
791-               untitled : '<?php _e('Untitled'); ?>',
792-               noMatchesFound : '<?php _e( 'No matches found.' ); ?>'
793-       };
794-//]]>
795-</script>
796-<script type="text/javascript" src="tiny_mce_popup.js?ver=3223"></script>
797-<?php
798-wp_print_scripts( array( 'jquery', 'jquery-ui-widget' ) );
799-$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
800-$src = "plugins/wplink/js/wplink$suffix.js?ver=20101116b";
801-?>
802-<script type="text/javascript" src="<?php echo $src; ?>"></script>
803-<?php
804-wp_admin_css( 'global', true );
805-wp_admin_css( 'wp-admin', true );
806-register_admin_color_schemes();
807-wp_admin_css( 'colors', true );
808-?>
809-<style>
810-html {
811-       background: #f1f1f1;
812+       $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
813+
814+       if ( isset( $args['s'] ) )
815+               $query['s'] = $args['s'];
816+
817+       $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
818+
819+       // Do main query.
820+       $get_posts = new WP_Query;
821+       $posts = $get_posts->query( $query );
822+       // Check if any posts were found.
823+       if ( ! $get_posts->post_count )
824+               return false;
825+
826+       // Build results.
827+       $results = array();
828+       foreach ( $posts as $post ) {
829+               if ( 'post' == $post->post_type )
830+                       $info = mysql2date( __( 'Y/m/d' ), $post->post_date );
831+               else
832+                       $info = $pts[ $post->post_type ]->labels->singular_name;
833+
834+               $results[] = array(
835+                       'ID' => $post->ID,
836+                       'title' => esc_html( strip_tags($post->post_title) ),
837+                       'permalink' => get_permalink( $post->ID ),
838+                       'info' => $info,
839+               );
840+       }
841+
842+       return $results;
843 }
844-a:link, a:visited {
845-       color: #21759b;
846+
847+function wp_link_ajax( $request ) {
848+       // Searches have a title term.
849+       if ( isset( $request['title'] ) )
850+               $args['s'] = stripslashes( $request['title'] );
851+       $args['pagenum'] = ! empty( $request['page'] ) ? absint( $request['page'] ) : 1;
852+
853+       $results = wp_link_query( $args );
854+
855+       if ( ! isset( $results ) )
856+               die( '0' );
857+
858+       echo json_encode( $results );
859+       echo "\n";
860 }
861-p.howto {
862-       margin: 3px;
863-}
864-#link-options {
865-       padding: 10px 0 14px;
866-       border-bottom: 1px solid #dfdfdf;
867-       margin: 0 6px 14px;
868-}
869-label input[type="text"] {
870-       width: 360px;
871-       margin-top: 5px;
872-}
873-label span {
874-       display: inline-block;
875-       width: 80px;
876-       text-align: right;
877-       padding-right: 5px;
878-}
879-.link-search-wrapper {
880-       margin: 5px 5px 9px;
881-       display: block;
882-       overflow: hidden;
883-}
884-.link-search-wrapper span {
885-       float: left;
886-       margin-top: 6px;
887-}
888-.link-search-wrapper input[type="text"] {
889-       float: left;
890-       width: 220px;
891-}
892-.link-search-wrapper img.waiting {
893-       margin: 8px 1px 0 4px;
894-       float: left;
895-       display: none;
896-}
897-#open-in-new-tab {
898-       display: inline-block;
899-       padding: 3px 0 0;
900-       margin: 0 0 0 87px;
901-}
902-#open-in-new-tab span {
903-       width: auto;
904-       margin-left: 6px;
905-       font-size: 11px;
906-}
907-.query-results {
908-       border: 1px #dfdfdf solid;
909-       margin: 0 5px 5px;
910-       background: #fff;
911-       height: 185px;
912-       overflow: auto;
913-}
914-.query-results li {
915-       margin-bottom: 0;
916-       border-bottom: 1px solid #f1f1f1;
917-       color: #555;
918-       padding: 4px 6px;
919-       cursor: pointer;
920-}
921-.query-results li:hover {
922-       background: #eaf2fa;
923-       color: #333;
924-}
925-.query-results li.unselectable:hover {
926-       background: #fff;
927-       cursor: auto;
928-       color: #555;
929-}
930-.query-results li.unselectable {
931-       border-bottom: 1px solid #dfdfdf;
932-}
933-.query-results li.selected {
934-       background: #f1f1f1;
935-       color: #333;
936-}
937-.query-results li.selected .item-title {
938-       font-weight: bold;
939-}
940-.item-info {
941-       text-transform: uppercase;
942-       color: #aaa;
943-       font-size: 11px;
944-       float: right;
945-}
946-#search-results {
947-       display: none;
948-}
949-.river-waiting {
950-       display: none;
951-       padding: 10px 0;
952-}
953-.river-waiting img.waiting {
954-       margin: 0 auto;
955-       display: block;
956-}
957-.submitbox {
958-       padding: 5px 5px 0;
959-       font-size: 11px;
960-       overflow: auto;
961-       height: 29px;
962-}
963-#wp-cancel {
964-       line-height: 25px;
965-       float: left;
966-}
967-#wp-update {
968-       line-height: 23px;
969-       float: right;
970-}
971-#wp-update a {
972-       display: inline-block;
973-}
974-</style>
975-</head>
976-<body id="post-body">
977+
978+function wp_link_dialog() {
979+?>
980+<div id="wp-link">
981 <div id="link-selector">
982        <div id="link-options">
983                <p class="howto"><?php _e( 'Enter the destination URL:' ); ?></p>
984@@ -204,12 +115,12 @@
985        </div>
986 </div>
987 <div class="submitbox">
988-       <div id="wp-cancel">
989+       <div id="wp-link-cancel">
990                <a class="submitdelete deletion"><?php _e( 'Cancel' ); ?></a>
991        </div>
992-       <div id="wp-update">
993+       <div id="wp-link-update">
994                <a class="button-primary"><?php _e( 'Update' ); ?></a>
995        </div>
996 </div>
997-</body>
998-</html>
999\ No newline at end of file
1000+</div>
1001+<?php } ?>
1002\ No newline at end of file
1003Index: wp-includes/js/tinymce/wp-mce-link-includes.php
1004===================================================================
1005--- wp-includes/js/tinymce/wp-mce-link-includes.php     (revision 16439)
1006+++ wp-includes/js/tinymce/wp-mce-link-includes.php     (working copy)
1007@@ -1,66 +0,0 @@
1008-<?php
1009-// args expects optionally 'pagenum' and 's'
1010-function wp_link_query( $args = array() ) {
1011-       $pts = get_post_types( array( 'publicly_queryable' => true ), 'objects' );
1012-       $pt_names = array_keys( $pts );
1013-
1014-       $query = array(
1015-               'post_type' => $pt_names,
1016-               'suppress_filters' => true,
1017-               'update_post_term_cache' => false,
1018-               'update_post_meta_cache' => false,
1019-               'post_status' => 'publish',
1020-               'order' => 'DESC',
1021-               'orderby' => 'post_date',
1022-               'posts_per_page' => 20,
1023-       );
1024-
1025-       $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
1026-
1027-       if ( isset( $args['s'] ) )
1028-               $query['s'] = $args['s'];
1029-
1030-       $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
1031-
1032-       // Do main query.
1033-       $get_posts = new WP_Query;
1034-       $posts = $get_posts->query( $query );
1035-       // Check if any posts were found.
1036-       if ( ! $get_posts->post_count )
1037-               return false;
1038-
1039-       // Build results.
1040-       $results = array();
1041-       foreach ( $posts as $post ) {
1042-               if ( 'post' == $post->post_type )
1043-                       $info = mysql2date( __( 'Y/m/d' ), $post->post_date );
1044-               else
1045-                       $info = $pts[ $post->post_type ]->labels->singular_name;
1046-
1047-               $results[] = array(
1048-                       'ID' => $post->ID,
1049-                       'title' => esc_html( strip_tags($post->post_title) ),
1050-                       'permalink' => get_permalink( $post->ID ),
1051-                       'info' => $info,
1052-               );
1053-       }
1054-
1055-       return $results;
1056-}
1057-
1058-function wp_link_ajax( $request ) {
1059-       // Searches have a title term.
1060-       if ( isset( $request['title'] ) )
1061-               $args['s'] = stripslashes( $request['title'] );
1062-       $args['pagenum'] = ! empty( $request['page'] ) ? absint( $request['page'] ) : 1;
1063-
1064-       $results = wp_link_query( $args );
1065-
1066-       if ( ! isset( $results ) )
1067-               die( '0' );
1068-
1069-       echo json_encode( $results );
1070-       echo "\n";
1071-}
1072-
1073-?>
1074\ No newline at end of file
1075Index: wp-includes/css/jquery-ui-dialog.dev.css
1076===================================================================
1077--- wp-includes/css/jquery-ui-dialog.dev.css    (revision 0)
1078+++ wp-includes/css/jquery-ui-dialog.dev.css    (revision 0)
1079@@ -0,0 +1,142 @@
1080+/*
1081+ * jQuery UI CSS Framework @VERSION
1082+ *
1083+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
1084+ * Dual licensed under the MIT or GPL Version 2 licenses.
1085+ * http://jquery.org/license
1086+ *
1087+ * http://docs.jquery.com/UI/Theming/API
1088+ */
1089+
1090+/* Layout helpers
1091+----------------------------------*/
1092+.ui-helper-hidden { display: none; }
1093+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
1094+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
1095+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
1096+.ui-helper-clearfix { display: inline-block; }
1097+/* required comment for clearfix to work in Opera \*/
1098+* html .ui-helper-clearfix { height:1%; }
1099+.ui-helper-clearfix { display:block; }
1100+/* end clearfix */
1101+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
1102+
1103+
1104+/* Interaction Cues
1105+----------------------------------*/
1106+.ui-state-disabled { cursor: default !important; }
1107+
1108+
1109+/* Icons
1110+----------------------------------*/
1111+
1112+/* states and images */
1113+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
1114+
1115+
1116+/* Misc visuals
1117+----------------------------------*/
1118+
1119+/* Overlays */
1120+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
1121+
1122+/*
1123+ * jQuery UI Resizable
1124+ *
1125+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
1126+ * Dual licensed under the MIT or GPL Version 2 licenses.
1127+ * http://jquery.org/license
1128+ *
1129+ * http://docs.jquery.com/UI/Resizable#theming
1130+ */
1131+.ui-resizable { position: relative;}
1132+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
1133+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
1134+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
1135+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
1136+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
1137+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
1138+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
1139+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
1140+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
1141+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
1142+
1143+/*
1144+ * jQuery UI Dialog
1145+ *
1146+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
1147+ * Dual licensed under the MIT or GPL Version 2 licenses.
1148+ * http://jquery.org/license
1149+ *
1150+ * http://docs.jquery.com/UI/Dialog#theming
1151+ */
1152+.ui-dialog { position: absolute; width: 300px; overflow: hidden; }
1153+.ui-dialog .ui-dialog-titlebar { position: relative; }
1154+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
1155+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: 0; background: none; overflow: auto; zoom: 1; }
1156+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
1157+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
1158+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
1159+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
1160+.ui-draggable .ui-dialog-titlebar { cursor: move; }
1161+
1162+
1163+
1164+/* WP jQuery Dialog Theme */
1165+.ui-dialog {
1166+       background: #f1f1f1;
1167+       border: 1px solid #999;
1168+       -moz-box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 );
1169+       -webkit-box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 );
1170+       box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 );
1171+}
1172+.ui-dialog-title {
1173+       display: block;
1174+       text-align: center;
1175+       padding: 1px 0 2px;
1176+}
1177+.ui-dialog-titlebar {
1178+       padding: 0 1em;
1179+       background-color: #444;
1180+       font-weight: bold;
1181+       font-size: 11px;
1182+       color: #e5e5e5;
1183+}
1184+.ui-dialog {
1185+       -moz-border-radius-topleft: 4px;
1186+       -webkit-border-top-left-radius: 4px;
1187+       -khtml-border-top-left-radius: 4px;
1188+       border-top-left-radius: 4px;
1189+       -moz-border-radius-topright: 4px;
1190+       -webkit-border-top-right-radius: 4px;
1191+       -khtml-border-top-right-radius: 4px;
1192+       border-top-right-radius: 4px;
1193+}
1194+.ui-dialog-titlebar {
1195+       -moz-border-radius-topleft: 3px;
1196+       -webkit-border-top-left-radius: 3px;
1197+       -khtml-border-top-left-radius: 3px;
1198+       border-top-left-radius: 3px;
1199+       -moz-border-radius-topright: 3px;
1200+       -webkit-border-top-right-radius: 3px;
1201+       -khtml-border-top-right-radius: 3px;
1202+       border-top-right-radius: 3px;
1203+}
1204+
1205+.ui-dialog .ui-dialog-titlebar-close {
1206+       position: absolute;
1207+       width: 29px;
1208+       height: 16px;
1209+       top: 2px;
1210+       right: 6px;
1211+       background: url('../js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif') no-repeat -87px -16px;
1212+       padding: 0;
1213+}
1214+.ui-dialog .ui-dialog-titlebar-close:hover,
1215+.ui-dialog .ui-dialog-titlebar-close:focus {
1216+       background-position: -87px -32px;
1217+}
1218+.ui-widget-overlay {
1219+       background-color: #000;
1220+       opacity: 0.6;
1221+}
1222\ No newline at end of file
1223Index: wp-includes/css/jquery-ui-dialog.css
1224===================================================================
1225--- wp-includes/css/jquery-ui-dialog.css        (revision 0)
1226+++ wp-includes/css/jquery-ui-dialog.css        (revision 0)
1227@@ -0,0 +1 @@
1228+.ui-helper-hidden{display:none;}.ui-helper-hidden-accessible{position:absolute;left:-99999999px;}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none;}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.ui-helper-clearfix{display:inline-block;}/* required comment for clearfix to work in Opera \*/ * html .ui-helper-clearfix{height:1%;}.ui-helper-clearfix{display:block;}/* end clearfix */ .ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0);}.ui-state-disabled{cursor:default!important;}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%;}.ui-resizable{position:relative;}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block;}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none;}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0;}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0;}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%;}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%;}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px;}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px;}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px;}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px;}.ui-dialog{position:absolute;width:300px;overflow:hidden;}.ui-dialog .ui-dialog-titlebar{position:relative;}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px;}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:0;background:none;overflow:auto;zoom:1;}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em;}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right;}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer;}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px;}.ui-draggable .ui-dialog-titlebar{cursor:move;}.ui-dialog{background:#f1f1f1;border:1px solid #999;-moz-box-shadow:0 0 16px rgba(0,0,0,0.3);-webkit-box-shadow:0 0 16px rgba(0,0,0,0.3);box-shadow:0 0 16px rgba(0,0,0,0.3);}.ui-dialog-title{display:block;text-align:center;padding:1px 0 2px;}.ui-dialog-titlebar{padding:0 1em;background-color:#444;font-weight:bold;font-size:11px;color:#e5e5e5;}.ui-dialog{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;-khtml-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;-khtml-border-top-right-radius:4px;border-top-right-radius:4px;}.ui-dialog-titlebar{-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;}.ui-dialog .ui-dialog-titlebar-close{position:absolute;width:29px;height:16px;top:2px;right:6px;background:url('../js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif') no-repeat -87px -16px;padding:0;}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{background-position:-87px -32px;}.ui-widget-overlay{background-color:#000;opacity:.6;}
1229\ No newline at end of file
1230Index: wp-includes/script-loader.php
1231===================================================================
1232--- wp-includes/script-loader.php       (revision 16439)
1233+++ wp-includes/script-loader.php       (working copy)
1234@@ -268,6 +268,14 @@
1235                'url' => __( 'URL:' ),
1236                'noShortlink' => __( 'No shortlink available for this page.' ),
1237        ) );
1238+       
1239+       $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101117' );
1240+       $scripts->localize( 'wplink', 'wpLinkL10n', array(
1241+               'untitled' => __('Untitled'),
1242+               'noMatchesFound' => __('No matches found.'),
1243+       ) );
1244+       
1245+       $scripts->add( 'wpdialogsPopup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", false, '20101117' );
1246 
1247        if ( is_admin() ) {
1248                $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
1249@@ -504,6 +512,11 @@
1250 
1251        // Admin bar
1252        $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101117' );
1253+       
1254+       // WP jQuery UI Dialog
1255+       $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101117' );
1256+       // WPLink TinyMCE plugin
1257+       $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101117' );
1258 
1259        foreach ( $rtl_styles as $rtl_style ) {
1260                $styles->add_data( $rtl_style, 'rtl', true );
1261Index: wp-admin/admin-ajax.php
1262===================================================================
1263--- wp-admin/admin-ajax.php     (revision 16439)
1264+++ wp-admin/admin-ajax.php     (working copy)
1265@@ -1074,7 +1074,7 @@
1266        exit;
1267        break;
1268 case 'wp-link-ajax':
1269-       require_once ABSPATH . WPINC . '/js/tinymce/wp-mce-link-includes.php';
1270+       require_once ABSPATH . WPINC . '/js/tinymce/wp-mce-link.php';
1271 
1272        wp_link_ajax( $_POST );
1273 
1274Index: wp-admin/includes/post.php
1275===================================================================
1276--- wp-admin/includes/post.php  (revision 16439)
1277+++ wp-admin/includes/post.php  (working copy)
1278@@ -1327,10 +1327,10 @@
1279        $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');
1280 
1281        if ( $teeny ) {
1282-               $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'media', 'fullscreen', 'wordpress', 'wplink') );
1283+               $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'media', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs') );
1284                $ext_plugins = '';
1285        } else {
1286-               $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink' );
1287+               $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink', 'wpdialogs' );
1288 
1289                /*
1290                The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
1291@@ -1411,8 +1411,6 @@
1292                }
1293        }
1294 
1295-       $plugins = implode($plugins, ',');
1296-
1297        if ( $teeny ) {
1298                $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );
1299                $mce_buttons = implode($mce_buttons, ',');
1300@@ -1485,7 +1483,7 @@
1301                'paste_strip_class_attributes' => 'all',
1302                'paste_text_use_dialog' => true,
1303                'wpeditimage_disable_captions' => $no_captions,
1304-               'plugins' => $plugins
1305+               'plugins' => implode($plugins, ',')
1306        );
1307 
1308        if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
1309@@ -1608,4 +1606,21 @@
1310 /* ]]> */
1311 </script>
1312 <?php
1313+
1314+       // Load additional inline scripts based on active plugins.
1315+       if ( in_array( 'wpdialogs', $plugins ) ) {
1316+               wp_print_scripts( array('jquery-ui-dialog', 'wpdialogsPopup') );
1317+               wp_print_styles('wp-jquery-ui-dialog');
1318+       }
1319+       if ( in_array( 'wplink', $plugins ) ) {
1320+               require_once ABSPATH . WPINC . "/js/tinymce/wp-mce-link.php";
1321+               add_action('tiny_mce_preload_dialogs', 'wp_link_dialog');
1322+               wp_print_scripts('wplink');
1323+               wp_print_styles('wplink');
1324+       }
1325 }
1326+function wp_tiny_mce_preload_dialogs() { ?>
1327+       <div id="preloaded-dialogs" style="display:none;">
1328+<?php  do_action('tiny_mce_preload_dialogs'); ?>
1329+       </div>
1330+<?php }
1331\ No newline at end of file
1332Index: wp-admin/admin-header.php
1333===================================================================
1334--- wp-admin/admin-header.php   (revision 16439)
1335+++ wp-admin/admin-header.php   (working copy)
1336@@ -66,6 +66,7 @@
1337 
1338 if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
1339        add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
1340+       add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
1341        wp_enqueue_script('quicktags');
1342 }
1343