WordPress build repository browser

Changeset 63334


Ignore:
Timestamp:
10/06/2026 06:02:41 PM (5 weeks ago)
Author:
johnbillion
Message:

Security: Backport the WordPress 7.1.3 security fixes to the 4.7 branch.

  • REST API: Require both capabilities to change a post's sticky status.
  • Query: Prevent exposure of comments on unviewable posts.
  • Posts, Post Types: Fire dynamic status transition hooks only for registered statuses and post types.
  • Administration: Treat contextual help tab links as selectors.
  • Embeds: Remove support for Imgur oEmbeds.
  • HTTP: Improve relative path resolution in WP_Http::make_absolute_url().

Merges r64127, r64128, r64130, r64131, r64132, r64133 to the 4.7 branch.

Props xknown, jeremyfelt, jorbin, peterwilsoncc, ehtis, westonruter, lancewillett, jonsurrell, marcs0h, rfaile313, johnbillion, vortfu.

Built from ​https://develop.svn.wordpress.org/branches/4.7@64183

Location:
branches/4.7
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7/wp-admin/js/common.js

    r40388 r63334  
    169169        link.parent('li').addClass('active');
    170170
    171         panel = $( link.attr('href') );
     171        panel = $( document ).find( link.attr('href') );
    172172
    173173        // Panels
  • branches/4.7/wp-admin/js/common.min.js

    r49878 r63334  
    1 var showNotice,adminMenu,columns,validateForm,screenMeta;!function(V,q){var e,n,B=V(document),H=V(q),Q=V(document.body);function t(){B.trigger("wp-window-resized")}adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}},columns={init:function(){var t=this;V(".hide-column-tog","#adv-settings").click(function(){var e=V(this),n=e.val();e.prop("checked")?t.checked(n):t.unchecked(n),columns.saveManageColumnsState()})},saveManageColumnsState:function(){var e=this.hidden();V.post(ajaxurl,{action:"hidden-columns",hidden:e,screenoptionnonce:V("#screenoptionnonce").val(),page:pagenow})},checked:function(e){V(".column-"+e).removeClass("hidden"),this.colSpanChange(1)},unchecked:function(e){V(".column-"+e).addClass("hidden"),this.colSpanChange(-1)},hidden:function(){return V(".manage-column[id]").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return V(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(e,e.length-5)}).get().join(",")}},colSpanChange:function(e){var n=V("table").find(".colspanchange");n.length&&(e=parseInt(n.attr("colspan"),10)+e,n.attr("colspan",e.toString()))}},B.ready(function(){columns.init()}),validateForm=function(e){return!V(e).find(".form-required").filter(function(){return""===V("input:visible",this).val()}).addClass("form-invalid").find("input:visible").change(function(){V(this).closest(".form-invalid").removeClass("form-invalid")}).length},showNotice={warn:function(){var e=commonL10n.warnDelete||"";return!!confirm(e)},note:function(e){alert(e)}},screenMeta={element:null,toggles:null,page:null,init:function(){this.element=V("#screen-meta"),this.toggles=V("#screen-meta-links").find(".show-settings"),this.page=V("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(){var e=V("#"+V(this).attr("aria-controls"));e.length&&(e.is(":visible")?screenMeta.close(e,V(this)):screenMeta.open(e,V(this)))},open:function(e,n){V("#screen-meta-links").find(".screen-meta-toggle").not(n.parent()).css("visibility","hidden"),e.parent().show(),e.slideDown("fast",function(){e.focus(),n.addClass("screen-meta-active").attr("aria-expanded",!0)}),B.trigger("screen:options:open")},close:function(e,n){e.slideUp("fast",function(){n.removeClass("screen-meta-active").attr("aria-expanded",!1),V(".screen-meta-toggle").css("visibility",""),e.parent().hide()}),B.trigger("screen:options:close")}},V(".contextual-help-tabs").delegate("a","click",function(e){var n=V(this);if(e.preventDefault(),n.is(".active a"))return!1;V(".contextual-help-tabs .active").removeClass("active"),n.parent("li").addClass("active"),n=V(n.attr("href")),V(".help-tab-content").not(n).removeClass("active").hide(),n.addClass("active").show()}),B.ready(function(){var t,i,o,s,e,n,a,r,c,l,d=!1,u=V("input.current-page"),p=u.val(),f=/iPhone|iPad|iPod/.test(navigator.userAgent),h=-1!==navigator.userAgent.indexOf("Android"),m=V(document.documentElement).hasClass("ie8"),v=V("#adminmenuwrap"),w=V("#wpwrap"),g=V("#adminmenu"),b=V("#wp-responsive-overlay"),k=V("#wp-toolbar"),C=k.find('a[aria-haspopup="true"]'),x=V(".meta-box-sortables"),y=!1,S=V("#wpadminbar"),M=0,T=!1,D=!1,E=0,A=!1,I={window:H.height(),wpwrap:w.height(),adminbar:S.height(),menu:v.height()},U=V(".wp-header-end");function j(){var e=V("a.wp-has-current-submenu");"folded"===r?e.attr("aria-haspopup","true"):e.attr("aria-haspopup","false")}function K(e){var n=e.find(".wp-submenu"),t=e.offset().top,i=H.scrollTop(),o=t-i-30,e=t+n.height()+1,t=60+e-w.height(),i=H.height()+i-50;1<(t=o<(t=i<e-t?e-i:t)?o:t)?n.css("margin-top","-"+t+"px"):n.css("margin-top","")}function z(){V(".notice.is-dismissible").each(function(){var n=V(this),e=V('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),t=commonL10n.dismiss||"";e.find(".screen-reader-text").text(t),e.on("click.wp-dismiss-notice",function(e){e.preventDefault(),n.fadeTo(100,0,function(){n.slideUp(100,function(){n.remove()})})}),n.append(e)})}function N(){c.prop("disabled",""===l.map(function(){return V(this).val()}).get().join(""))}function O(e){var n=H.scrollTop(),e=!e||"scroll"!==e.type;if(!(f||m||g.data("wp-responsive")))if(I.menu+I.adminbar<I.window||I.menu+I.adminbar+20>I.wpwrap)W();else{if(A=!0,I.menu+I.adminbar>I.window){if(n<0)return void(T||(D=!(T=!0),v.css({position:"fixed",top:"",bottom:""})));if(n+I.window>B.height()-1)return void(D||(T=!(D=!0),v.css({position:"fixed",top:"",bottom:0})));M<n?T?(T=!1,(E=v.offset().top-I.adminbar-(n-M))+I.menu+I.adminbar<n+I.window&&(E=n+I.window-I.menu-I.adminbar),v.css({position:"absolute",top:E,bottom:""})):!D&&v.offset().top+I.menu<n+I.window&&(D=!0,v.css({position:"fixed",top:"",bottom:0})):n<M?D?(D=!1,(E=v.offset().top-I.adminbar+(M-n))+I.menu>n+I.window&&(E=n),v.css({position:"absolute",top:E,bottom:""})):!T&&v.offset().top>=n+I.adminbar&&(T=!0,v.css({position:"fixed",top:"",bottom:""})):e&&(T=D=!1,0<(E=n+I.window-I.menu-I.adminbar-1)?v.css({position:"absolute",top:E,bottom:""}):W())}M=n}}function P(){I={window:H.height(),wpwrap:w.height(),adminbar:S.height(),menu:v.height()}}function W(){!f&&A&&(T=D=A=!1,v.css({position:"",top:"",bottom:""}))}function L(){P(),g.data("wp-responsive")?(Q.removeClass("sticky-menu"),W()):I.menu+I.adminbar>I.window?(O(),Q.removeClass("sticky-menu")):(Q.addClass("sticky-menu"),W())}function F(){V(".aria-button-if-js").attr("role","button")}function R(){var e=!1;return e=q.innerWidth?Math.max(q.innerWidth,document.documentElement.clientWidth):e}function _(){var e=R()||961;r=e<=782?"responsive":Q.hasClass("folded")||Q.hasClass("auto-fold")&&e<=960&&782<e?"folded":"open",B.trigger("wp-menu-state-set",{state:r})}g.on("click.wp-submenu-head",".wp-submenu-head",function(e){V(e.target).parent().siblings("a").get(0).click()}),V("#collapse-button").on("click.collapse-menu",function(){var e=R()||961;V("#adminmenu div.wp-submenu").css("margin-top",""),r=e<960?Q.hasClass("auto-fold")?(Q.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),"open"):(Q.addClass("auto-fold"),setUserSetting("unfold",0),"folded"):Q.hasClass("folded")?(Q.removeClass("folded"),setUserSetting("mfold","o"),"open"):(Q.addClass("folded"),setUserSetting("mfold","f"),"folded"),B.trigger("wp-collapse-menu",{state:r})}),B.on("wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate",j),("ontouchstart"in q||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(e=f?"touchstart":"click",Q.on(e+".wp-mobile-hover",function(e){g.data("wp-responsive")||V(e.target).closest("#adminmenu").length||g.find("li.opensub").removeClass("opensub")}),g.find("a.wp-has-submenu").on(e+".wp-mobile-hover",function(e){var n=V(this).parent();g.data("wp-responsive")||n.hasClass("opensub")||n.hasClass("wp-menu-open")&&!(n.width()<40)||(e.preventDefault(),K(n),g.find("li.opensub").removeClass("opensub"),n.addClass("opensub"))})),f||h||(g.find("li.wp-has-submenu").hoverIntent({over:function(){var e=V(this),n=e.find(".wp-submenu"),n=parseInt(n.css("top"),10);isNaN(n)||-5<n||g.data("wp-responsive")||(K(e),g.find("li.opensub").removeClass("opensub"),e.addClass("opensub"))},out:function(){g.data("wp-responsive")||V(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),g.on("focus.adminmenu",".wp-submenu a",function(e){g.data("wp-responsive")||V(e.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(e){g.data("wp-responsive")||V(e.target).closest("li.menu-top").removeClass("opensub")}).find("li.wp-has-submenu.wp-not-current-submenu").on("focusin.adminmenu",function(){K(V(this))})),U.length||(U=V(".wrap h1, .wrap h2").first()),V("div.updated, div.error, div.notice").not(".inline, .below-h2").insertAfter(U),B.on("wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error",z),screenMeta.init(),Q.on("click","tbody > tr > .check-column :checkbox",function(e){if("undefined"==e.shiftKey)return!0;if(e.shiftKey){if(!d)return!0;t=V(d).closest("form").find(":checkbox").filter(":visible:enabled"),i=t.index(d),o=t.index(this),s=V(this).prop("checked"),0<i&&0<o&&i!=o&&(i<o?t.slice(i,o):t.slice(o,i)).prop("checked",function(){return!!V(this).closest("tr").is(":visible")&&s})}var n=V(d=this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked");return V(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===n.length}),!0}),Q.on("click.wp-toggle-checkboxes","thead .check-column :checkbox, tfoot .check-column :checkbox",function(e){var n=V(this),t=n.closest("table"),i=n.prop("checked"),o=e.shiftKey||n.data("wp-toggle");t.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!V(this).is(":hidden,:disabled")&&(o?!V(this).prop("checked"):!!i)}),t.children("thead,  tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!o&&!!i})}),V("#wpbody-content").on({focusin:function(){clearTimeout(n),a=V(this).find(".row-actions"),V(".row-actions").not(this).removeClass("visible"),a.addClass("visible")},focusout:function(){n=setTimeout(function(){a.removeClass("visible")},30)}},".has-row-actions"),V("tbody").on("click",".toggle-row",function(){V(this).closest("tr").toggleClass("is-expanded")}),V("#default-password-nag-no").click(function(){return setUserSetting("default_password_nag","hide"),V("div.default-password-nag").hide(),!1}),V("#newcontent").bind("keydown.wpevent_InsertTab",function(e){var n,t,i,o,s=e.target;if(27==e.keyCode)return e.preventDefault(),void V(s).data("tab-out",!0);9!=e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||(V(s).data("tab-out")?V(s).data("tab-out",!1):(n=s.selectionStart,t=s.selectionEnd,i=s.value,document.selection?(s.focus(),document.selection.createRange().text="\t"):0<=n&&(o=this.scrollTop,s.value=i.substring(0,n).concat("\t",i.substring(t)),s.selectionStart=s.selectionEnd=n+1,this.scrollTop=o),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()))}),u.length&&u.closest("form").submit(function(){-1==V('select[name="action"]').val()&&-1==V('select[name="action2"]').val()&&u.val()==p&&u.val("1")}),V('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function(){V('select[name^="action"]').val("-1")}),V("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(e){e.target.scrollIntoView&&e.target.scrollIntoView(!1)}),(U=V("form.wp-upload-form")).length&&(c=U.find('input[type="submit"]'),l=U.find('input[type="file"]'),N(),l.on("change",N)),f||(H.on("scroll.pin-menu",O),B.on("tinymce-editor-init.pin-menu",function(e,n){n.on("wp-autoresize",P)})),q.wpResponsive={init:function(){var e=this;B.on("wp-responsive-activate.wp-responsive",function(){e.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){e.deactivate()}),V("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),V("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(e){e.preventDefault(),S.find(".hover").removeClass("hover"),w.toggleClass("wp-responsive-open"),w.hasClass("wp-responsive-open")?(V(this).find("a").attr("aria-expanded","true"),V("#adminmenu a:first").focus()):V(this).find("a").attr("aria-expanded","false")}),g.on("click.wp-responsive","li.wp-has-submenu > a",function(e){g.data("wp-responsive")&&(V(this).parent("li").toggleClass("selected"),e.preventDefault())}),e.trigger(),B.on("wp-window-resized.wp-responsive",V.proxy(this.trigger,this)),H.on("load.wp-responsive",function(){(-1<navigator.userAgent.indexOf("AppleWebKit/")?H.width():q.innerWidth)<=782&&e.disableSortables()})},activate:function(){L(),Q.hasClass("auto-fold")||Q.addClass("auto-fold"),g.data("wp-responsive",1),this.disableSortables()},deactivate:function(){L(),g.removeData("wp-responsive"),this.enableSortables()},trigger:function(){var e=R();e&&(e<=782?y||(B.trigger("wp-responsive-activate"),y=!0):y&&(B.trigger("wp-responsive-deactivate"),y=!1),e<=480?this.enableOverlay():this.disableOverlay())},enableOverlay:function(){0===b.length&&(b=V('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){k.find(".menupop.hover").removeClass("hover"),V(this).hide()})),C.on("click.wp-responsive",function(){b.show()})},disableOverlay:function(){C.off("click.wp-responsive"),b.hide()},disableSortables:function(){if(x.length)try{x.sortable("disable")}catch(e){}},enableSortables:function(){if(x.length)try{x.sortable("enable")}catch(e){}}},V(document).ajaxComplete(function(){F()}),B.on("wp-window-resized.set-menu-state",_),B.on("wp-menu-state-set wp-collapse-menu",function(e,n){var t=V("#collapse-button"),i="true",o=commonL10n.collapseMenu;"folded"===n.state&&(i="false",o=commonL10n.expandMenu),t.attr({"aria-expanded":i,"aria-label":o})}),q.wpResponsive.init(),L(),_(),j(),z(),F(),B.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu",L),V(".wp-initial-focus").focus()}),H.on("resize.wp-fire-once",function(){q.clearTimeout(e),e=q.setTimeout(t,200)}),"-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)&&((n=document.createElement("style")).appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(n))}(jQuery,window);
     1var showNotice,adminMenu,columns,validateForm,screenMeta;!function(V,q){var e,n,B=V(document),H=V(q),Q=V(document.body);function t(){B.trigger("wp-window-resized")}adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}},columns={init:function(){var t=this;V(".hide-column-tog","#adv-settings").click(function(){var e=V(this),n=e.val();e.prop("checked")?t.checked(n):t.unchecked(n),columns.saveManageColumnsState()})},saveManageColumnsState:function(){var e=this.hidden();V.post(ajaxurl,{action:"hidden-columns",hidden:e,screenoptionnonce:V("#screenoptionnonce").val(),page:pagenow})},checked:function(e){V(".column-"+e).removeClass("hidden"),this.colSpanChange(1)},unchecked:function(e){V(".column-"+e).addClass("hidden"),this.colSpanChange(-1)},hidden:function(){return V(".manage-column[id]").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return V(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(e,e.length-5)}).get().join(",")}},colSpanChange:function(e){var n=V("table").find(".colspanchange");n.length&&(e=parseInt(n.attr("colspan"),10)+e,n.attr("colspan",e.toString()))}},B.ready(function(){columns.init()}),validateForm=function(e){return!V(e).find(".form-required").filter(function(){return""===V("input:visible",this).val()}).addClass("form-invalid").find("input:visible").change(function(){V(this).closest(".form-invalid").removeClass("form-invalid")}).length},showNotice={warn:function(){var e=commonL10n.warnDelete||"";return!!confirm(e)},note:function(e){alert(e)}},screenMeta={element:null,toggles:null,page:null,init:function(){this.element=V("#screen-meta"),this.toggles=V("#screen-meta-links").find(".show-settings"),this.page=V("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(){var e=V("#"+V(this).attr("aria-controls"));e.length&&(e.is(":visible")?screenMeta.close(e,V(this)):screenMeta.open(e,V(this)))},open:function(e,n){V("#screen-meta-links").find(".screen-meta-toggle").not(n.parent()).css("visibility","hidden"),e.parent().show(),e.slideDown("fast",function(){e.focus(),n.addClass("screen-meta-active").attr("aria-expanded",!0)}),B.trigger("screen:options:open")},close:function(e,n){e.slideUp("fast",function(){n.removeClass("screen-meta-active").attr("aria-expanded",!1),V(".screen-meta-toggle").css("visibility",""),e.parent().hide()}),B.trigger("screen:options:close")}},V(".contextual-help-tabs").delegate("a","click",function(e){var n=V(this);if(e.preventDefault(),n.is(".active a"))return!1;V(".contextual-help-tabs .active").removeClass("active"),n.parent("li").addClass("active"),n=V(document).find(n.attr("href")),V(".help-tab-content").not(n).removeClass("active").hide(),n.addClass("active").show()}),B.ready(function(){var t,i,o,s,e,n,a,r,c,l,d=!1,u=V("input.current-page"),p=u.val(),f=/iPhone|iPad|iPod/.test(navigator.userAgent),h=-1!==navigator.userAgent.indexOf("Android"),m=V(document.documentElement).hasClass("ie8"),v=V("#adminmenuwrap"),w=V("#wpwrap"),g=V("#adminmenu"),b=V("#wp-responsive-overlay"),k=V("#wp-toolbar"),C=k.find('a[aria-haspopup="true"]'),x=V(".meta-box-sortables"),y=!1,S=V("#wpadminbar"),M=0,T=!1,D=!1,E=0,A=!1,I={window:H.height(),wpwrap:w.height(),adminbar:S.height(),menu:v.height()},U=V(".wp-header-end");function j(){var e=V("a.wp-has-current-submenu");"folded"===r?e.attr("aria-haspopup","true"):e.attr("aria-haspopup","false")}function K(e){var n=e.find(".wp-submenu"),t=e.offset().top,i=H.scrollTop(),o=t-i-30,e=t+n.height()+1,t=60+e-w.height(),i=H.height()+i-50;1<(t=o<(t=i<e-t?e-i:t)?o:t)?n.css("margin-top","-"+t+"px"):n.css("margin-top","")}function z(){V(".notice.is-dismissible").each(function(){var n=V(this),e=V('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),t=commonL10n.dismiss||"";e.find(".screen-reader-text").text(t),e.on("click.wp-dismiss-notice",function(e){e.preventDefault(),n.fadeTo(100,0,function(){n.slideUp(100,function(){n.remove()})})}),n.append(e)})}function N(){c.prop("disabled",""===l.map(function(){return V(this).val()}).get().join(""))}function O(e){var n=H.scrollTop(),e=!e||"scroll"!==e.type;if(!(f||m||g.data("wp-responsive")))if(I.menu+I.adminbar<I.window||I.menu+I.adminbar+20>I.wpwrap)W();else{if(A=!0,I.menu+I.adminbar>I.window){if(n<0)return void(T||(D=!(T=!0),v.css({position:"fixed",top:"",bottom:""})));if(n+I.window>B.height()-1)return void(D||(T=!(D=!0),v.css({position:"fixed",top:"",bottom:0})));M<n?T?(T=!1,(E=v.offset().top-I.adminbar-(n-M))+I.menu+I.adminbar<n+I.window&&(E=n+I.window-I.menu-I.adminbar),v.css({position:"absolute",top:E,bottom:""})):!D&&v.offset().top+I.menu<n+I.window&&(D=!0,v.css({position:"fixed",top:"",bottom:0})):n<M?D?(D=!1,(E=v.offset().top-I.adminbar+(M-n))+I.menu>n+I.window&&(E=n),v.css({position:"absolute",top:E,bottom:""})):!T&&v.offset().top>=n+I.adminbar&&(T=!0,v.css({position:"fixed",top:"",bottom:""})):e&&(T=D=!1,0<(E=n+I.window-I.menu-I.adminbar-1)?v.css({position:"absolute",top:E,bottom:""}):W())}M=n}}function P(){I={window:H.height(),wpwrap:w.height(),adminbar:S.height(),menu:v.height()}}function W(){!f&&A&&(T=D=A=!1,v.css({position:"",top:"",bottom:""}))}function L(){P(),g.data("wp-responsive")?(Q.removeClass("sticky-menu"),W()):I.menu+I.adminbar>I.window?(O(),Q.removeClass("sticky-menu")):(Q.addClass("sticky-menu"),W())}function F(){V(".aria-button-if-js").attr("role","button")}function R(){var e=!1;return e=q.innerWidth?Math.max(q.innerWidth,document.documentElement.clientWidth):e}function _(){var e=R()||961;r=e<=782?"responsive":Q.hasClass("folded")||Q.hasClass("auto-fold")&&e<=960&&782<e?"folded":"open",B.trigger("wp-menu-state-set",{state:r})}g.on("click.wp-submenu-head",".wp-submenu-head",function(e){V(e.target).parent().siblings("a").get(0).click()}),V("#collapse-button").on("click.collapse-menu",function(){var e=R()||961;V("#adminmenu div.wp-submenu").css("margin-top",""),r=e<960?Q.hasClass("auto-fold")?(Q.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),"open"):(Q.addClass("auto-fold"),setUserSetting("unfold",0),"folded"):Q.hasClass("folded")?(Q.removeClass("folded"),setUserSetting("mfold","o"),"open"):(Q.addClass("folded"),setUserSetting("mfold","f"),"folded"),B.trigger("wp-collapse-menu",{state:r})}),B.on("wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate",j),("ontouchstart"in q||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(e=f?"touchstart":"click",Q.on(e+".wp-mobile-hover",function(e){g.data("wp-responsive")||V(e.target).closest("#adminmenu").length||g.find("li.opensub").removeClass("opensub")}),g.find("a.wp-has-submenu").on(e+".wp-mobile-hover",function(e){var n=V(this).parent();g.data("wp-responsive")||n.hasClass("opensub")||n.hasClass("wp-menu-open")&&!(n.width()<40)||(e.preventDefault(),K(n),g.find("li.opensub").removeClass("opensub"),n.addClass("opensub"))})),f||h||(g.find("li.wp-has-submenu").hoverIntent({over:function(){var e=V(this),n=e.find(".wp-submenu"),n=parseInt(n.css("top"),10);isNaN(n)||-5<n||g.data("wp-responsive")||(K(e),g.find("li.opensub").removeClass("opensub"),e.addClass("opensub"))},out:function(){g.data("wp-responsive")||V(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),g.on("focus.adminmenu",".wp-submenu a",function(e){g.data("wp-responsive")||V(e.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(e){g.data("wp-responsive")||V(e.target).closest("li.menu-top").removeClass("opensub")}).find("li.wp-has-submenu.wp-not-current-submenu").on("focusin.adminmenu",function(){K(V(this))})),U.length||(U=V(".wrap h1, .wrap h2").first()),V("div.updated, div.error, div.notice").not(".inline, .below-h2").insertAfter(U),B.on("wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error",z),screenMeta.init(),Q.on("click","tbody > tr > .check-column :checkbox",function(e){if("undefined"==e.shiftKey)return!0;if(e.shiftKey){if(!d)return!0;t=V(d).closest("form").find(":checkbox").filter(":visible:enabled"),i=t.index(d),o=t.index(this),s=V(this).prop("checked"),0<i&&0<o&&i!=o&&(i<o?t.slice(i,o):t.slice(o,i)).prop("checked",function(){return!!V(this).closest("tr").is(":visible")&&s})}var n=V(d=this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked");return V(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===n.length}),!0}),Q.on("click.wp-toggle-checkboxes","thead .check-column :checkbox, tfoot .check-column :checkbox",function(e){var n=V(this),t=n.closest("table"),i=n.prop("checked"),o=e.shiftKey||n.data("wp-toggle");t.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!V(this).is(":hidden,:disabled")&&(o?!V(this).prop("checked"):!!i)}),t.children("thead,  tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!o&&!!i})}),V("#wpbody-content").on({focusin:function(){clearTimeout(n),a=V(this).find(".row-actions"),V(".row-actions").not(this).removeClass("visible"),a.addClass("visible")},focusout:function(){n=setTimeout(function(){a.removeClass("visible")},30)}},".has-row-actions"),V("tbody").on("click",".toggle-row",function(){V(this).closest("tr").toggleClass("is-expanded")}),V("#default-password-nag-no").click(function(){return setUserSetting("default_password_nag","hide"),V("div.default-password-nag").hide(),!1}),V("#newcontent").bind("keydown.wpevent_InsertTab",function(e){var n,t,i,o,s=e.target;if(27==e.keyCode)return e.preventDefault(),void V(s).data("tab-out",!0);9!=e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||(V(s).data("tab-out")?V(s).data("tab-out",!1):(n=s.selectionStart,t=s.selectionEnd,i=s.value,document.selection?(s.focus(),document.selection.createRange().text="\t"):0<=n&&(o=this.scrollTop,s.value=i.substring(0,n).concat("\t",i.substring(t)),s.selectionStart=s.selectionEnd=n+1,this.scrollTop=o),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()))}),u.length&&u.closest("form").submit(function(){-1==V('select[name="action"]').val()&&-1==V('select[name="action2"]').val()&&u.val()==p&&u.val("1")}),V('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function(){V('select[name^="action"]').val("-1")}),V("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(e){e.target.scrollIntoView&&e.target.scrollIntoView(!1)}),(U=V("form.wp-upload-form")).length&&(c=U.find('input[type="submit"]'),l=U.find('input[type="file"]'),N(),l.on("change",N)),f||(H.on("scroll.pin-menu",O),B.on("tinymce-editor-init.pin-menu",function(e,n){n.on("wp-autoresize",P)})),q.wpResponsive={init:function(){var e=this;B.on("wp-responsive-activate.wp-responsive",function(){e.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){e.deactivate()}),V("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),V("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(e){e.preventDefault(),S.find(".hover").removeClass("hover"),w.toggleClass("wp-responsive-open"),w.hasClass("wp-responsive-open")?(V(this).find("a").attr("aria-expanded","true"),V("#adminmenu a:first").focus()):V(this).find("a").attr("aria-expanded","false")}),g.on("click.wp-responsive","li.wp-has-submenu > a",function(e){g.data("wp-responsive")&&(V(this).parent("li").toggleClass("selected"),e.preventDefault())}),e.trigger(),B.on("wp-window-resized.wp-responsive",V.proxy(this.trigger,this)),H.on("load.wp-responsive",function(){(-1<navigator.userAgent.indexOf("AppleWebKit/")?H.width():q.innerWidth)<=782&&e.disableSortables()})},activate:function(){L(),Q.hasClass("auto-fold")||Q.addClass("auto-fold"),g.data("wp-responsive",1),this.disableSortables()},deactivate:function(){L(),g.removeData("wp-responsive"),this.enableSortables()},trigger:function(){var e=R();e&&(e<=782?y||(B.trigger("wp-responsive-activate"),y=!0):y&&(B.trigger("wp-responsive-deactivate"),y=!1),e<=480?this.enableOverlay():this.disableOverlay())},enableOverlay:function(){0===b.length&&(b=V('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){k.find(".menupop.hover").removeClass("hover"),V(this).hide()})),C.on("click.wp-responsive",function(){b.show()})},disableOverlay:function(){C.off("click.wp-responsive"),b.hide()},disableSortables:function(){if(x.length)try{x.sortable("disable")}catch(e){}},enableSortables:function(){if(x.length)try{x.sortable("enable")}catch(e){}}},V(document).ajaxComplete(function(){F()}),B.on("wp-window-resized.set-menu-state",_),B.on("wp-menu-state-set wp-collapse-menu",function(e,n){var t=V("#collapse-button"),i="true",o=commonL10n.collapseMenu;"folded"===n.state&&(i="false",o=commonL10n.expandMenu),t.attr({"aria-expanded":i,"aria-label":o})}),q.wpResponsive.init(),L(),_(),j(),z(),F(),B.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu",L),V(".wp-initial-focus").focus()}),H.on("resize.wp-fire-once",function(){q.clearTimeout(e),e=q.setTimeout(t,200)}),"-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)&&((n=document.createElement("style")).appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(n))}(jQuery,window);
  • branches/4.7/wp-includes/class-http.php

    r40553 r63334  
    945945                        // Strip all /path/../ out of the path.
    946946                        while ( strpos( $path, '../' ) > 1 ) {
    947                                 $path = preg_replace( '![^/]+/\.\./!', '', $path );
     947                                $path = preg_replace( '![^/]+/\.\./!', '', $path, -1, $segment_replacement_count );
     948                                if ( 0 === $segment_replacement_count ) {
     949                                        break;
     950                                }
    948951                        }
    949952
  • branches/4.7/wp-includes/class-oembed.php

    r38866 r63334  
    8484                        '#https?://(www\.)?instagr(\.am|am\.com)/p/.*#i'           => array( 'https://api.instagram.com/oembed',                          true  ),
    8585                        '#https?://(open|play)\.spotify\.com/.*#i'                 => array( 'https://embed.spotify.com/oembed/',                         true  ),
    86                         '#https?://(.+\.)?imgur\.com/.*#i'                         => array( 'http://api.imgur.com/oembed',                               true  ),
    8786                        '#https?://(www\.)?meetu(\.ps|p\.com)/.*#i'                => array( 'https://api.meetup.com/oembed',                             true  ),
    8887                        '#https?://(www\.)?issuu\.com/.+/docs/.+#i'                => array( 'https://issuu.com/oembed_wp',                               true  ),
    … …  
    156155                 * | Flickr       | flic.kr               |      Yes       | 3.6.0     |
    157156                 * | Spotify      | spotify.com           |      Yes       | 3.6.0     |
    158                  * | Imgur        | imgur.com             |      Yes       | 3.9.0     |
    159157                 * | Meetup.com   | meetup.com            |      Yes       | 3.9.0     |
    160158                 * | Meetup.com   | meetu.ps              |      Yes       | 3.9.0     |
    … …  
    193191                 * | Rdio         | rdio.com             |      Yes       | 3.6.0     | 4.4.1     |
    194192                 * | Rdio         | rd.io                |      Yes       | 3.6.0     | 4.4.1     |
     193                 * | Imgur        | imgur.com            |      Yes       | 3.9.0     | 7.1.3     |
    195194                 *
    196195                 * @see wp_oembed_add_provider()
  • branches/4.7/wp-includes/class-wp-query.php

    r54120 r63334  
    28872887                }
    28882888
    2889                 if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
    2890                         /** This filter is documented in wp-includes/query.php */
    2891                         $cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
    2892 
    2893                         /** This filter is documented in wp-includes/query.php */
    2894                         $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
    2895 
    2896                         /** This filter is documented in wp-includes/query.php */
    2897                         $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
    2898                         $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
    2899 
    2900                         /** This filter is documented in wp-includes/query.php */
    2901                         $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
    2902                         $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
    2903 
    2904                         /** This filter is documented in wp-includes/query.php */
    2905                         $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
    2906 
    2907                         $comments_request = "SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits";
    2908                         $comments = $wpdb->get_results($comments_request);
    2909                         // Convert to WP_Comment
    2910                         $this->comments = array_map( 'get_comment', $comments );
    2911                         $this->comment_count = count($this->comments);
    2912                 }
    2913 
    29142889                // Check post status to determine if post should be displayed.
    29152890                if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
    … …  
    29602935                }
    29612936
     2937                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
     2938                        /** This filter is documented in wp-includes/query.php */
     2939                        $cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
     2940
     2941                        /** This filter is documented in wp-includes/query.php */
     2942                        $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
     2943
     2944                        /** This filter is documented in wp-includes/query.php */
     2945                        $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
     2946                        $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
     2947
     2948                        /** This filter is documented in wp-includes/query.php */
     2949                        $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
     2950                        $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
     2951
     2952                        /** This filter is documented in wp-includes/query.php */
     2953                        $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     2954
     2955                        $comments_request = "SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits";
     2956                        $comments = $wpdb->get_results($comments_request);
     2957                        // Convert to WP_Comment
     2958                        $this->comments = array_map( 'get_comment', $comments );
     2959                        $this->comment_count = count($this->comments);
     2960                }
     2961
    29622962                // Put sticky posts at the top of the posts array
    29632963                $sticky_posts = get_option('sticky_posts');
  • branches/4.7/wp-includes/post.php

    r54120 r63334  
    40614061        do_action( 'transition_post_status', $new_status, $old_status, $post );
    40624062
    4063         /**
    4064          * Fires when a post is transitioned from one status to another.
    4065          *
    4066          * The dynamic portions of the hook name, `$new_status` and `$old status`,
    4067          * refer to the old and new post statuses, respectively.
    4068          *
    4069          * @since 2.3.0
    4070          *
    4071          * @param WP_Post $post Post object.
    4072          */
    4073         do_action( "{$old_status}_to_{$new_status}", $post );
    4074 
    4075         /**
    4076          * Fires when a post is transitioned from one status to another.
    4077          *
    4078          * The dynamic portions of the hook name, `$new_status` and `$post->post_type`,
    4079          * refer to the new post status and post type, respectively.
    4080          *
    4081          * Please note: When this action is hooked using a particular post status (like
    4082          * 'publish', as `publish_{$post->post_type}`), it will fire both when a post is
    4083          * first transitioned to that status from something else, as well as upon
    4084          * subsequent post updates (old and new status are both the same).
    4085          *
    4086          * Therefore, if you are looking to only fire a callback when a post is first
    4087          * transitioned to a status, use the {@see 'transition_post_status'} hook instead.
    4088          *
    4089          * @since 2.3.0
    4090          *
    4091          * @param int     $post_id Post ID.
    4092          * @param WP_Post $post    Post object.
    4093          */
    4094         do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
     4063        $new_status_object = get_post_status_object( $new_status );
     4064        $old_status_valid  = get_post_status_object( $old_status ) || 'new' === $old_status;
     4065        $post_type_object  = get_post_type_object( $post->post_type );
     4066
     4067        if ( $new_status_object && $old_status_valid ) {
     4068                /**
     4069                 * Fires when a post is transitioned from one status to another.
     4070                 *
     4071                 * The dynamic portions of the hook name, `$new_status` and `$old status`,
     4072                 * refer to the old and new post statuses, respectively.
     4073                 *
     4074                 * @since 2.3.0
     4075                 *
     4076                 * @param WP_Post $post Post object.
     4077                 */
     4078                do_action( "{$old_status}_to_{$new_status}", $post );
     4079        }
     4080
     4081        if ( $new_status_object && $post_type_object ) {
     4082                /**
     4083                 * Fires when a post is transitioned from one status to another.
     4084                 *
     4085                 * The dynamic portions of the hook name, `$new_status` and `$post->post_type`,
     4086                 * refer to the new post status and post type, respectively.
     4087                 *
     4088                 * Please note: When this action is hooked using a particular post status (like
     4089                 * 'publish', as `publish_{$post->post_type}`), it will fire both when a post is
     4090                 * first transitioned to that status from something else, as well as upon
     4091                 * subsequent post updates (old and new status are both the same).
     4092                 *
     4093                 * Therefore, if you are looking to only fire a callback when a post is first
     4094                 * transitioned to a status, use the {@see 'transition_post_status'} hook instead.
     4095                 *
     4096                 * @since 2.3.0
     4097                 *
     4098                 * @param int     $post_id Post ID.
     4099                 * @param WP_Post $post    Post object.
     4100                 */
     4101                do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
     4102        }
    40954103}
    40964104
  • branches/4.7/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r60175 r63334  
    549549                }
    550550
    551                 if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) && ! current_user_can( $post_type->cap->publish_posts ) ) {
     551                if ( ! empty( $request['sticky'] ) && ( ! current_user_can( $post_type->cap->edit_others_posts ) || ! current_user_can( $post_type->cap->publish_posts ) ) ) {
    552552                        return new WP_Error( 'rest_cannot_assign_sticky', __( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) );
    553553                }
    … …  
    693693                }
    694694
    695                 if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) && ! current_user_can( $post_type->cap->publish_posts ) ) {
     695                if ( isset( $request['sticky'] ) && is_sticky( $post->ID ) !== (bool) $request['sticky'] && ( ! current_user_can( $post_type->cap->edit_others_posts ) || ! current_user_can( $post_type->cap->publish_posts ) ) ) {
    696696                        return new WP_Error( 'rest_cannot_assign_sticky', __( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) );
    697697                }
Note: See TracChangeset for help on using the changeset viewer.