diff --git a/wp-admin/js/edit-comments.dev.js b/wp-admin/js/edit-comments.dev.js index 7b868dd131..cbc589fa96 100644 --- a/wp-admin/js/edit-comments.dev.js +++ b/wp-admin/js/edit-comments.dev.js @@ -549,7 +549,7 @@ $(document).ready(function(){ $(document).delegate('span.delete a.delete', 'click', function(){return false;}); if ( typeof QTags != 'undefined' ) - quicktags({quicktags_id: 'replycontent', quicktags_buttons: 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close'}); + quicktags({id: 'replycontent', buttons: 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close'}); if ( typeof $.table_hotkeys != 'undefined' ) { make_hotkeys_redirect = function(which) { diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index a4bab69b3e..59e2258250 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -1 +1 @@ -var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a(''+note+"")}else{q=a(".comment-author",l).text();r=a('")}l.before(r);a("strong","#undo-"+k).text(q+" ");t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),t,s,l,p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}if(m){t=-1}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}if(("object"==typeof k)&&jk){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var m=this,e,f,i,g,j=a("#comment-"+b),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a(document).delegate("span.delete a.delete","click",function(){return false});if(typeof QTags!="undefined"){quicktags({quicktags_id:"replycontent",quicktags_buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close"})}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery); \ No newline at end of file +var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a(''+note+"")}else{q=a(".comment-author",l).text();r=a('")}l.before(r);a("strong","#undo-"+k).text(q+" ");t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),t,s,l,p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}if(m){t=-1}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}if(("object"==typeof k)&&jk){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var m=this,e,f,i,g,j=a("#comment-"+b),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a(document).delegate("span.delete a.delete","click",function(){return false});if(typeof QTags!="undefined"){quicktags({id:"replycontent",buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close"})}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery); \ No newline at end of file diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 7a65dfdd35..eba78bc039 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -22,20 +22,20 @@ class WP_Editor { var $can_richedit; var $default_editor; var $first_init; - var $tinymce = false; - var $quicktags = false; + var $this_tinymce = false; + var $this_quicktags = false; function __construct() { $this->can_richedit = user_can_richedit(); $this->default_editor = $this->wp_default_editor(); } - + /** * Outputs the HTML and enqueues the JavaScript for a single instance of the editor. - * - * $param $content The initial content of the editor. - * $param $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers). - * $param $settings See below for description. + * + * @param $content The initial content of the editor. + * @param $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers). + * @param $settings See below for description. */ function editor( $content, $editor_id, $settings = array() ) { @@ -52,8 +52,8 @@ class WP_Editor { 'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array() ) ); - $this->tinymce = !empty($set['tinymce']) && $this->can_richedit; - $this->quicktags = !empty($set['quicktags']); + $this->this_tinymce = !empty($set['tinymce']) && $this->can_richedit; + $this->this_quicktags = !empty($set['quicktags']); $editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"'; $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : ''; $rows = ' rows="' . (int) $set['textarea_rows'] . '"'; @@ -63,7 +63,7 @@ class WP_Editor { if ( !current_user_can( 'upload_files' ) ) $set['media_buttons'] = false; - if ( $this->can_richedit && $this->quicktags && $this->tinymce ) { + if ( $this->can_richedit && $this->this_quicktags && $this->this_tinymce ) { $switch_class = 'html-active'; if ( 'html' == $this->default_editor ) { @@ -76,7 +76,7 @@ class WP_Editor { $buttons .= '' . __('HTML') . "\n"; $buttons .= '' . __('Visual') . "\n"; } - + echo '
'; if ( !empty($set['editor_css']) ) @@ -89,7 +89,7 @@ class WP_Editor { if ( $set['media_buttons'] ) { if ( !function_exists('media_buttons') ) include(ABSPATH . 'wp-admin/includes/media.php'); - + echo '
'; do_action('media_buttons', $editor_id); echo "
\n"; @@ -117,14 +117,14 @@ class WP_Editor { global $editor_styles; $first_run = false; - if ( $this->quicktags ) { + if ( $this->this_quicktags ) { $qtbuttons = apply_filters( 'quicktags_buttons', array(), $editor_id ); $qtbuttons_disabled = apply_filters( 'quicktags_disabled_buttons', array(), $editor_id ); $qtInit = array( - 'quicktags_id' => $editor_id, - 'quicktags_buttons' => implode($qtbuttons, ','), - 'quicktags_disabled_buttons' => implode($qtbuttons_disabled, ',') + 'id' => $editor_id, + 'buttons' => implode($qtbuttons, ','), + 'disabled_buttons' => implode($qtbuttons_disabled, ',') ); if ( is_array($settings['quicktags']) ) @@ -132,8 +132,8 @@ class WP_Editor { $this->qt_settings[$editor_id] = $qtInit; } - - if ( $this->tinymce ) { + + if ( $this->this_tinymce ) { if ( empty($this->first_init) ) { $this->baseurl = includes_url('js/tinymce'); @@ -154,10 +154,10 @@ class WP_Editor { If the plugin uses a button, it should be added with one of the "$mce_buttons" filters. */ $mce_external_plugins = apply_filters('mce_external_plugins', array()); - + $ext_plugins = ''; if ( ! empty($mce_external_plugins) ) { - + /* The following filter loads external language files for TinyMCE plugins. It takes an associative array 'plugin_name' => 'path', where path is the @@ -168,10 +168,10 @@ class WP_Editor { If that is not found, en.js will be tried next. */ $mce_external_languages = apply_filters('mce_external_languages', array()); - + $loaded_langs = array(); $strings = ''; - + if ( ! empty($mce_external_languages) ) { foreach ( $mce_external_languages as $name => $path ) { if ( @is_file($path) && @is_readable($path) ) { @@ -181,58 +181,58 @@ class WP_Editor { } } } - + foreach ( $mce_external_plugins as $name => $url ) { - + if ( is_ssl() ) $url = str_replace('http://', 'https://', $url); - + $plugins[] = '-' . $name; - + $plugurl = dirname($url); $strings = $str1 = $str2 = ''; if ( ! in_array($name, $loaded_langs) ) { $path = str_replace( WP_CONTENT_URL, '', $plugurl ); $path = WP_CONTENT_DIR . $path . '/langs/'; - + if ( function_exists('realpath') ) $path = trailingslashit( realpath($path) ); - + if ( @is_file($path . $mce_locale . '.js') ) $strings .= @file_get_contents($path . $mce_locale . '.js') . "\n"; - + if ( @is_file($path . $mce_locale . '_dlg.js') ) $strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n"; - + if ( 'en' != $mce_locale && empty($strings) ) { if ( @is_file($path . 'en.js') ) { $str1 = @file_get_contents($path . 'en.js'); $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n"; } - + if ( @is_file($path . 'en_dlg.js') ) { $str2 = @file_get_contents($path . 'en_dlg.js'); $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n"; } } - + if ( ! empty($strings) ) $ext_plugins .= "\n" . $strings . "\n"; } - + $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n"; - + $this->ext_plugins .= $ext_plugins; } } - + $plugins = array_unique( apply_filters('tiny_mce_plugins', $plugins) ); if ( 'content' == $editor_id ) // enable DFW only on Add/Edit Post screens for now $plugins[] = 'wpfullscreen'; $this->plugins = $plugins; - + /* The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu. By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server. @@ -288,7 +288,7 @@ class WP_Editor { 'wp_fullscreen_content_css' => "$this->baseurl/plugins/wpfullscreen/css/wp-fullscreen.css", 'plugins' => implode( ',', $plugins ) ); - + // load editor_style.css if the current theme supports it if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) { $mce_css = array(); @@ -311,9 +311,9 @@ class WP_Editor { } else { $mce_css = ''; } - + $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' ); - + if ( ! empty($mce_css) ) $this->first_init['content_css'] = $mce_css; } @@ -351,7 +351,7 @@ class WP_Editor { 'theme_advanced_buttons3' => implode($mce_buttons_3, ','), 'theme_advanced_buttons4' => implode($mce_buttons_4, ',') ); - + if ( $first_run ) $mceInit = array_merge($this->first_init, $mceInit); @@ -367,7 +367,7 @@ class WP_Editor { } else { $mceInit = apply_filters('tiny_mce_before_init', $mceInit, $editor_id); } - + if ( empty($mceInit['theme_advanced_buttons3']) && !empty($mceInit['theme_advanced_buttons4']) ) { $mceInit['theme_advanced_buttons3'] = $mceInit['theme_advanced_buttons4']; $mceInit['theme_advanced_buttons4'] = ''; @@ -375,9 +375,9 @@ class WP_Editor { $this->mce_settings[$editor_id] = $mceInit; $first_run = false; - } // end if $this->tinymce + } // end if $this->this_tinymce } - + function _parse_init($init) { $options = ''; @@ -395,7 +395,7 @@ class WP_Editor { return '{' . trim( $options, ' ,' ) . '}'; } - + /** * Find out which editor should be displayed by default. * @@ -419,21 +419,16 @@ class WP_Editor { wp_enqueue_script('quicktags'); wp_enqueue_script('word-count'); wp_enqueue_script('wplink'); + wp_enqueue_script('editor'); wp_enqueue_style('editor-buttons'); - + wp_enqueue_script('wpdialogs-popup'); wp_enqueue_style('wp-jquery-ui-dialog'); - if ( $this->tinymce ) - wp_enqueue_script('editor'); - else - wp_enqueue_script('utils'); - if ( in_array('wpfullscreen', $this->plugins, true) ) wp_enqueue_script('wp-fullscreen'); - if ( !is_admin() ) - add_thickbox(); + add_thickbox(); } function editor_js() { @@ -447,6 +442,7 @@ class WP_Editor { * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code). */ $version = 'ver=' . $tinymce_version; + $tmce_on = !empty($this->mce_settings); if ( ! isset($concatenate_scripts) ) script_concat_settings(); @@ -454,11 +450,11 @@ class WP_Editor { $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); - if ( $this->tinymce && 'en' != $this->mce_locale ) + if ( $tmce_on && 'en' != $this->mce_locale ) include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php'); $mceInit = $qtInit = ''; - if ( !empty($this->mce_settings) ) { + if ( $tmce_on ) { foreach ( $this->mce_settings as $editor_id => $init ) { $options = $this->_parse_init( $init ); $mceInit .= "'$editor_id':{$options},\n"; @@ -503,7 +499,7 @@ class WP_Editor { tinymce ) { + if ( $tmce_on ) { if ( $compressed ) echo "\n"; else @@ -570,7 +566,7 @@ class WP_Editor { ed.execCommand('mceInsertContent', false, h); } else if ( typeof quicktags != 'undefined' ) { - quicktags.insertContent(wpActiveEditor, h); + QTags.insertContent(wpActiveEditor, h); } else { jQuery('#'+wpActiveEditor).val( jQuery('#'+wpActiveEditor).val() + h ); } @@ -582,7 +578,7 @@ class WP_Editor { if ( $this->ext_plugins ) echo "$this->ext_plugins\n"; - if ( ! $compressed && $this->tinymce ) { + if ( ! $compressed && $tmce_on ) { ?> (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})(); $content_width ? $content_width : 800; $width = $width + 10; // compensate for the padding $dfw_width = get_user_setting( 'dfw_width', $width ); @@ -616,19 +612,19 @@ class WP_Editor {
- +
- +
array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ), @@ -645,15 +641,15 @@ class WP_Editor { '3' => 'separator', 'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false ) ); - + $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons ); - + foreach ( $buttons as $button => $args ) { if ( 'separator' == $args ) { ?>
- + class="wp-fullscreen-both"> @@ -661,39 +657,39 @@ class WP_Editor {
- +
- +
post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?>
- +
- +
- +
- +
0' ); ?>
- +
true ), 'objects' ); $pt_names = array_keys( $pts ); - + $query = array( 'post_type' => $pt_names, 'suppress_filters' => true, @@ -716,21 +712,21 @@ class WP_Editor { '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 ) { @@ -738,7 +734,7 @@ class WP_Editor { $info = mysql2date( __( 'Y/m/d' ), $post->post_date ); else $info = $pts[ $post->post_type ]->labels->singular_name; - + $results[] = array( 'ID' => $post->ID, 'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ), @@ -746,10 +742,10 @@ class WP_Editor { 'info' => $info, ); } - + return $results; } - + /** * Dialog for internal linking. * diff --git a/wp-includes/js/quicktags.dev.js b/wp-includes/js/quicktags.dev.js index d4de51912c..6c5fff236d 100644 --- a/wp-includes/js/quicktags.dev.js +++ b/wp-includes/js/quicktags.dev.js @@ -6,9 +6,11 @@ * * Run quicktags(settings) to initialize it, where settings is an object containing up to 3 properties: * settings = { - * quicktags_id: 'myid', // required - * buttons: '', // optional - * disabled_buttons: '' // optional + * id : 'my_id', // the HTML ID of the textarea, required + * buttons: '', // Comma separated list of the names of the default buttons to show. Optional. + * // This overwrites buttons order and any buttons added by plugins. + * // Current list of default button names: 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close' + * disabled_buttons : '' // Comma separated list of the names of the buttons to disable. * } * * The settings can also be a string quicktags_id. @@ -24,12 +26,35 @@ // by Alex King // http://www.alexking.org/ -var QTags, edButtons, edButton; +var QTags, edButtons = [], edCanvas; +/** + * Initialize new instance of the Quicktags editor + */ function quicktags(settings) { return new QTags(settings); } +/** + * Inderts content at the caret in the active editor (textarea) + * + * Added for back compatibility + * @see QTags.insertContent() + */ +function edInsertContent(bah, txt) { + return QTags.insertContent(txt); +} + +/** + * Adds a button to all instances of the editor + * + * Added for back compatibility + * @see QTags.addButton() + */ +function edButton(id, display, tagStart, tagEnd, access, open) { + return QTags.addButton( id, display, tagStart, tagEnd, open, access ); +} + (function(){ // private stuff is prefixed with an underscore var _domReady = function(func) { @@ -109,18 +134,18 @@ function quicktags(settings) { qt = QTags = function(settings) { if ( typeof(settings) == 'string' ) - settings = {quicktags_id: settings}; + settings = {id: settings}; else if ( typeof(settings) != 'object' ) return false; var t = this, - id = settings.quicktags_id, + id = settings.id, buttons = {}, theButtons = {}, canvas = document.getElementById(id), name = 'qt_' + id, html = '', - i, tb, qb, btn, onclick; + i, tb, qb, btn, onclick, toolbar_id; if ( !id || !canvas ) return false; @@ -130,6 +155,9 @@ function quicktags(settings) { // default buttons for ( i in edButtons ) { + if ( !edButtons[i] ) + continue; + buttons[edButtons[i].id] = edButtons[i]; } @@ -141,8 +169,8 @@ function quicktags(settings) { buttons[i] = new t._customButtons[i](); } - if ( settings.quicktags_buttons ) { - qb = settings.quicktags_buttons.split(','); + if ( settings.buttons ) { + qb = settings.buttons.split(','); for ( i in qb ) { btn = qb[i]; @@ -153,8 +181,8 @@ function quicktags(settings) { theButtons = buttons; } - if ( settings.quicktags_disabled_buttons ) { - qb = settings.quicktags_disabled_buttons.split(','); + if ( settings.disabled_buttons ) { + qb = settings.disabled_buttons.split(','); for ( i in qb ) { btn = qb[i]; @@ -166,8 +194,15 @@ function quicktags(settings) { for ( i in theButtons ) html += theButtons[i].html(name + '_'); + if ( id == 'content' && !qt.instances[0] ) { // back compat hack :-( + edCanvas = canvas; + toolbar_id = 'ed_toolbar'; + } else { + toolbar_id = name + '_toolbar'; + } + tb = document.createElement('div'); - tb.id = name + '_toolbar'; + tb.id = toolbar_id; tb.className = 'quicktags-toolbar'; canvas.parentNode.insertBefore(tb, canvas); @@ -197,6 +232,9 @@ function quicktags(settings) { tb.attachEvent('onclick', onclick); } + if ( !qt.instances[0] ) + qt.instances[0] = t; + qt.instances[id] = t; }; @@ -209,9 +247,65 @@ function quicktags(settings) { qt.getInstance = function(id) { return qt.instances[id]; }; + + /** + * Main API function for adding a button to Quicktags + * + * Adds qt.Button or qt.TagButton depending on the args. The first three args are always required. + * For TagButton arg2 is also required. To be able to add button(s) to Quicktags, your script + * should be enqueued as dependant on "quicktags" and outputted in the footer. If you are echoing JS + * directly from PHP, use add_action( 'admin_print_footer_scripts', 'output_my_js', 100 ) or add_action( 'wp_footer', 'output_my_js', 100 ) + * + * Minimun required to add a button that calls an external function: + * QTags.addButton( 'my_id', 'my button', my_callback ); + * function my_callback() { alert('yeah!'); } + * + * Minimun required to add a button that inserts a tag: + * QTags.addButton( 'my_id', 'my button', '', '' ); + * + * @param id string required button HTML ID + * @param display string required button's value="..." + * @param arg1 string || function required either a starting tag to be inserted like "" or a callback that is executed when the button is pressed + * @param arg2 string ending tag like "" + * @param arg3 int set to -1 if the inserted tag is self-closing + * @param access string access key for the button + * @param title string button's title="..." + * @param priority int number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc. + * @return bool TRUE on success FALSE on failure + */ + qt.addButton = function( id, display, arg1, arg2, arg3, access, title, priority ) { + var btn; + + if ( !id || !display ) + return false; - qt.insertContent = function(editor_id, content) { - var sel, startPos, endPos, scrollTop, text, ed = document.getElementById(editor_id); + if ( typeof(arg1) == 'function' ) { + btn = new qt.Button(id, display, access, title); + btn.callback = arg1; + } else if ( typeof(arg1) == 'string' && arg1 && arg2 ) { + btn = new qt.TagButton(id, display, arg1, arg2, access, arg3, title); + } else { + return false; + } + + if ( priority ) { + while ( typeof(edButtons[priority]) != 'undefined' ) { + priority++ + } + + edButtons[priority] = btn; + } else { + edButtons[edButtons.length] = btn; + } + + return true; + }; + + qt.insertContent = function(content) { + var sel, startPos, endPos, scrollTop, text, ed = document.getElementById(wpActiveEditor); + + if ( !ed ) + return false; if ( document.selection ) { //IE ed.focus(); @@ -234,6 +328,7 @@ function quicktags(settings) { ed.value += content; ed.focus(); } + return true; }; // a plain, dumb button @@ -468,22 +563,19 @@ function quicktags(settings) { }; // ensure backward compatibility - edButtons = [ - new qt.TagButton('strong','b','','','b'), - new qt.TagButton('em','i','','','i'), - new qt.LinkButton(), // special case - new qt.TagButton('block','b-quote','\n\n
','
\n\n','q'), - new qt.TagButton('del','del','','','d'), - new qt.TagButton('ins','ins','','','s'), - new qt.ImgButton(), // special case - new qt.TagButton('ul','ul','
    \n','
\n\n','u'), - new qt.TagButton('ol','ol','
    \n','
\n\n','o'), - new qt.TagButton('li','li','\t
  • ','
  • \n','l'), - new qt.TagButton('code','code','','','c'), - new qt.TagButton('more','more','','','t',-1), - new qt.SpellButton(), - new qt.CloseButton() - ]; + edButtons[10] = new qt.TagButton('strong','b','','','b'); + edButtons[20] = new qt.TagButton('em','i','','','i'), + edButtons[30] = new qt.LinkButton(), // special case + edButtons[40] = new qt.TagButton('block','b-quote','\n\n
    ','
    \n\n','q'), + edButtons[50] = new qt.TagButton('del','del','','','d'), + edButtons[60] = new qt.TagButton('ins','ins','','','s'), + edButtons[70] = new qt.ImgButton(), // special case + edButtons[80] = new qt.TagButton('ul','ul','
      \n','
    \n\n','u'), + edButtons[90] = new qt.TagButton('ol','ol','
      \n','
    \n\n','o'), + edButtons[100] = new qt.TagButton('li','li','\t
  • ','
  • \n','l'), + edButtons[110] = new qt.TagButton('code','code','','','c'), + edButtons[120] = new qt.TagButton('more','more','','','t',-1), + edButtons[130] = new qt.SpellButton(), + edButtons[140] = new qt.CloseButton() - edButton = qt.TagButton; })(); diff --git a/wp-includes/js/quicktags.js b/wp-includes/js/quicktags.js index ca361968cf..c1dc21a9ee 100644 --- a/wp-includes/js/quicktags.js +++ b/wp-includes/js/quicktags.js @@ -1 +1 @@ -var QTags,edButtons,edButton;function quicktags(a){return new QTags(a)}(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f'};d.Button.prototype.callback=function(e){};d.TagButton=function(l,j,g,f,e,h,k){var i=this;d.Button.call(i,l,j,e,k);i.tagStart=g;i.tagEnd=f;i.open=h};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g0){g.text=u.tagStart+g.text+u.tagEnd}else{if(u.isOpen(q)===false||u.tagEnd===""){g.text=u.tagStart;u.openTag(o,q)}else{g.text=u.tagEnd;u.closeTag(o,q)}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){p=j.selectionStart;f=j.selectionEnd;m=f;h=j.scrollTop;k=s.substring(0,p);e=s.substring(f,s.length);n=s.substring(p,f);if(p!=f){j.value=k+u.tagStart+n+u.tagEnd+e;if(u.tagEnd===""){m=p}m+=u.tagStart.length+u.tagEnd.length}else{if(u.isOpen(q)===false||u.tagEnd===""){j.value=k+u.tagStart+e;u.openTag(o,q);m=p+u.tagStart.length}else{j.value=k+u.tagEnd+e;m=p+u.tagEnd.length;u.closeTag(o,q)}}j.focus();j.selectionStart=m;j.selectionEnd=m;j.scrollTop=h}else{if(u.isOpen(q)!==false||u.tagEnd===""){j.value+=u.tagStart;u.openTag(o,q)}else{j.value+=u.tagEnd;u.closeTag(o,q)}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(h,g,i){var k="",j,f,e;if(document.selection){g.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(g.selectionStart||g.selectionStart=="0"){f=g.selectionStart;e=g.selectionEnd;if(f!=e){k=g.value.substring(f,e)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d.CloseButton.prototype.callback=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}};d.prototype.closeAllTags=function(){var e=this.getButton("close");e.callback.call(e,"",this.canvas,this.toolbar)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","
    ","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m",-1)};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart=''+h+'';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons=[new d.TagButton("strong","b","","","b"),new d.TagButton("em","i","","","i"),new d.LinkButton(),new d.TagButton("block","b-quote","\n\n
    ","
    \n\n","q"),new d.TagButton("del","del",'',"","d"),new d.TagButton("ins","ins",'',"","s"),new d.ImgButton(),new d.TagButton("ul","ul","
      \n","
    \n\n","u"),new d.TagButton("ol","ol","
      \n","
    \n\n","o"),new d.TagButton("li","li","\t
  • ","
  • \n","l"),new d.TagButton("code","code","","","c"),new d.TagButton("more","more","","","t",-1),new d.SpellButton(),new d.CloseButton()];edButton=d.TagButton})(); \ No newline at end of file +var QTags,edButtons=[],edCanvas;function quicktags(a){return new QTags(a)}function edInsertContent(b,a){return QTags.insertContent(a)}function edButton(f,e,c,b,a,d){return QTags.addButton(f,e,c,b,d,a)}(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f'};d.Button.prototype.callback=function(e){};d.TagButton=function(l,j,g,f,e,h,k){var i=this;d.Button.call(i,l,j,e,k);i.tagStart=g;i.tagEnd=f;i.open=h};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g0){g.text=u.tagStart+g.text+u.tagEnd}else{if(u.isOpen(q)===false||u.tagEnd===""){g.text=u.tagStart;u.openTag(o,q)}else{g.text=u.tagEnd;u.closeTag(o,q)}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){p=j.selectionStart;f=j.selectionEnd;m=f;h=j.scrollTop;k=s.substring(0,p);e=s.substring(f,s.length);n=s.substring(p,f);if(p!=f){j.value=k+u.tagStart+n+u.tagEnd+e;if(u.tagEnd===""){m=p}m+=u.tagStart.length+u.tagEnd.length}else{if(u.isOpen(q)===false||u.tagEnd===""){j.value=k+u.tagStart+e;u.openTag(o,q);m=p+u.tagStart.length}else{j.value=k+u.tagEnd+e;m=p+u.tagEnd.length;u.closeTag(o,q)}}j.focus();j.selectionStart=m;j.selectionEnd=m;j.scrollTop=h}else{if(u.isOpen(q)!==false||u.tagEnd===""){j.value+=u.tagStart;u.openTag(o,q)}else{j.value+=u.tagEnd;u.closeTag(o,q)}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(h,g,i){var k="",j,f,e;if(document.selection){g.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(g.selectionStart||g.selectionStart=="0"){f=g.selectionStart;e=g.selectionEnd;if(f!=e){k=g.value.substring(f,e)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d.CloseButton.prototype.callback=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}};d.prototype.closeAllTags=function(){var e=this.getButton("close");e.callback.call(e,"",this.canvas,this.toolbar)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","
    ","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m",-1)};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart=''+h+'';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons[10]=new d.TagButton("strong","b","","","b");edButtons[20]=new d.TagButton("em","i","","","i"),edButtons[30]=new d.LinkButton(),edButtons[40]=new d.TagButton("block","b-quote","\n\n
    ","
    \n\n","q"),edButtons[50]=new d.TagButton("del","del",'',"","d"),edButtons[60]=new d.TagButton("ins","ins",'',"","s"),edButtons[70]=new d.ImgButton(),edButtons[80]=new d.TagButton("ul","ul","
      \n","
    \n\n","u"),edButtons[90]=new d.TagButton("ol","ol","
      \n","
    \n\n","o"),edButtons[100]=new d.TagButton("li","li","\t
  • ","
  • \n","l"),edButtons[110]=new d.TagButton("code","code","","","c"),edButtons[120]=new d.TagButton("more","more","","","t",-1),edButtons[130]=new d.SpellButton(),edButtons[140]=new d.CloseButton()})(); \ No newline at end of file diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index e96149d912..14cfb6f42b 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -68,7 +68,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1', 1 ); - $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110802', 1 ); + $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110804', 1 ); $scripts->add_script_data( 'quicktags', 'quicktagsL10n', array( 'wordLookup' => __('Enter a word to look up:'), 'dictionaryLookup' => esc_attr(__('Dictionary lookup')), @@ -269,7 +269,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20110429', 1 ); - $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110802', 1 ); + $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110804', 1 ); $scripts->add_script_data( 'admin-comments', 'adminCommentsL10n', array( 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),