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

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