WordPress/wp-includes/js/api-request.min.js

1 line
768 B
JavaScript

!function(d){var s=window.wpApiSettings;function n(e){return e=n.buildAjaxOptions(e),n.transport(e)}n.buildAjaxOptions=function(e){var n,t,a,p,r,o=e.url,i=e.path;if("string"==typeof e.namespace&&"string"==typeof e.endpoint&&(t=e.namespace.replace(/^\/|\/$/g,""),i=(n=e.endpoint.replace(/^\//,""))?t+"/"+n:t),"string"==typeof i&&(t=s.root,i=i.replace(/^\//,""),"string"==typeof t&&-1!==t.indexOf("?")&&(i=i.replace("?","&")),o=t+i),p=!(e.data&&e.data._wpnonce),a=e.headers||{},p)for(r in a)if(a.hasOwnProperty(r)&&"x-wp-nonce"===r.toLowerCase()){p=!1;break}return p&&(a=d.extend({"X-WP-Nonce":s.nonce},a)),delete(e=d.extend({},e,{headers:a,url:o})).path,delete e.namespace,delete e.endpoint,e},n.transport=d.ajax,window.wp=window.wp||{},window.wp.apiRequest=n}(jQuery);