Public Post Preview - Version 2.7.0

Version Description

(2018-09-14): = * Initial support for Gutenberg. * Block robots for public post previews. Props @westonruter.

Download this release

Release Info

Developer ocean90
Plugin Icon 128x128 Public Post Preview
Version 2.7.0
Comparing to
See all releases

Code changes from version 2.6.0 to 2.7.0

js/gutenberg-integration.js ADDED
@@ -0,0 +1 @@
 
1
+ this.publicPostPreview=this.publicPostPreview||{},this.publicPostPreview.main=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=70)}([function(t,e){var r=t.exports={version:"2.5.4"};"number"==typeof __e&&(__e=r)},function(t,e){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e,r){t.exports=!r(8)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,r){var n=r(12),o=r(57),i=r(39),c=Object.defineProperty;e.f=r(3)?Object.defineProperty:function(t,e,r){if(n(t),e=i(e,!0),n(r),o)try{return c(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},function(t,e,r){var n=r(1),o=r(0),i=r(58),c=r(10),a=r(2),u=function(t,e,r){var s,f,l,p=t&u.F,h=t&u.G,d=t&u.S,v=t&u.P,b=t&u.B,y=t&u.W,g=h?o:o[e]||(o[e]={}),w=g.prototype,m=h?n:d?n[e]:(n[e]||{}).prototype;for(s in h&&(r=e),r)(f=!p&&m&&void 0!==m[s])&&a(g,s)||(l=f?m[s]:r[s],g[s]=h&&"function"!=typeof m[s]?r[s]:b&&f?i(l,n):y&&m[s]==l?function(t){var e=function(e,r,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,r)}return new t(e,r,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):v&&"function"==typeof l?i(Function.call,l):l,v&&((g.virtual||(g.virtual={}))[s]=l,t&u.R&&w&&!w[s]&&c(w,s,l)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,r){var n=r(35)("wks"),o=r(18),i=r(1).Symbol,c="function"==typeof i;(t.exports=function(t){return n[t]||(n[t]=c&&i[t]||(c?i:o)("Symbol."+t))}).store=n},function(t,e,r){var n=r(54),o=r(38);t.exports=function(t){return n(o(t))}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,r){var n=r(4),o=r(20);t.exports=r(3)?function(t,e,r){return n.f(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e,r){var n=r(9);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,r){"use strict";(function(t){r.d(e,"a",function(){return c});var n=r(59),o=void 0!==t?t:{},i=Object(n.a)(o),c=(i.flush,i.hydrate,i.cx,i.merge,i.getRegisteredStyles,i.injectGlobal,i.keyframes,i.css);i.sheet,i.caches}).call(this,r(45))},function(t,e,r){var n=r(78);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},function(t,e,r){var n=r(84);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},function(t,e,r){var n=r(44)(Object,"create");t.exports=n},function(t,e){e.f={}.propertyIsEnumerable},function(t,e){var r=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+n).toString(36))}},function(t,e,r){var n=r(55),o=r(34);t.exports=Object.keys||function(t){return n(t,o)}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e,r){var n=r(108),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,e,r){var n=r(22).Symbol;t.exports=n},function(t,e,r){var n=r(46),o=r(105),i="[object Symbol]";t.exports=function(t){return"symbol"==typeof t||o(t)&&n(t)==i}},function(t,e){var r=Array.isArray;t.exports=r},function(t,e,r){var n=r(1),o=r(0),i=r(31),c=r(27),a=r(4).f;t.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:n.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:c.f(t)})}},function(t,e,r){e.f=r(6)},function(t,e,r){var n=r(4).f,o=r(2),i=r(6)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},function(t,e,r){var n=r(12),o=r(134),i=r(34),c=r(36)("IE_PROTO"),a=function(){},u=function(){var t,e=r(56)("iframe"),n=i.length;for(e.style.display="none",r(133).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;n--;)delete u.prototype[i[n]];return u()};t.exports=Object.create||function(t,e){var r;return null!==t?(a.prototype=n(t),r=new a,a.prototype=null,r[c]=t):r=u(),void 0===e?r:o(r,e)}},function(t,e){t.exports={}},function(t,e){t.exports=!0},function(t,e,r){var n=r(38);t.exports=function(t){return Object(n(t))}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,r){var n=r(1),o=n["__core-js_shared__"]||(n["__core-js_shared__"]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e,r){var n=r(35)("keys"),o=r(18);t.exports=function(t){return n[t]||(n[t]=o(t))}},function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,r){var n=r(9);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){!function(){t.exports=this.wp.editPost}()},function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,r){var n=r(97),o=r(92);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){var n=r(23),o=r(107),i=r(106),c="[object Null]",a="[object Undefined]",u=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?a:c:u&&u in Object(t)?o(t):i(t)}},function(t,e,r){var n=r(17),o=r(20),i=r(7),c=r(39),a=r(2),u=r(57),s=Object.getOwnPropertyDescriptor;e.f=r(3)?s:function(t,e){if(t=i(t),e=c(e,!0),u)try{return s(t,e)}catch(t){}if(a(t,e))return o(!n.f.call(t,e),t[e])}},function(t,e,r){var n=r(55),o=r(34).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},function(t,e,r){t.exports=r(10)},function(t,e,r){"use strict";var n=r(31),o=r(5),i=r(49),c=r(10),a=r(30),u=r(135),s=r(28),f=r(52),l=r(6)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,r,d,v,b,y){u(r,e,d);var g,w,m,x=function(t){if(!p&&t in j)return j[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},_=e+" Iterator",O="values"==v,k=!1,j=t.prototype,C=j[l]||j["@@iterator"]||v&&j[v],S=C||x(v),A=v?O?x("entries"):S:void 0,E="Array"==e&&j.entries||C;if(E&&(m=f(E.call(new t)))!==Object.prototype&&m.next&&(s(m,_,!0),n||"function"==typeof m[l]||c(m,l,h)),O&&C&&"values"!==C.name&&(k=!0,S=function(){return C.call(this)}),n&&!y||!p&&!k&&j[l]||c(j,l,S),a[e]=S,a[_]=h,v)if(g={values:O?S:x("values"),keys:b?S:x("keys"),entries:A},y)for(w in g)w in j||i(j,w,g[w]);else o(o.P+o.F*(p||k),e,g);return g}},function(t,e,r){"use strict";e.__esModule=!0;var n=c(r(139)),o=c(r(128)),i="function"==typeof o.default&&"symbol"==typeof n.default?function(t){return typeof t}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":typeof t};function c(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof o.default&&"symbol"===i(n.default)?function(t){return void 0===t?"undefined":i(t)}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":void 0===t?"undefined":i(t)}},function(t,e,r){var n=r(2),o=r(32),i=r(36)("IE_PROTO"),c=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),n(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e,r){var n=r(53);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t,e,r){var n=r(2),o=r(7),i=r(148)(!1),c=r(36)("IE_PROTO");t.exports=function(t,e){var r,a=o(t),u=0,s=[];for(r in a)r!=c&&n(a,r)&&s.push(r);for(;e.length>u;)n(a,r=e[u++])&&(~i(s,r)||s.push(r));return s}},function(t,e,r){var n=r(9),o=r(1).document,i=n(o)&&n(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,r){t.exports=!r(3)&&!r(8)(function(){return 7!=Object.defineProperty(r(56)("div"),"a",{get:function(){return 7}}).a})},function(t,e,r){var n=r(150);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,r){"use strict";var n=function(t){var e={};return function(r){return void 0===e[r]&&(e[r]=t(r)),e[r]}},o={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var i=function(t){for(var e,r=t.length,n=r^r,o=0;r>=4;)e=1540483477*(65535&(e=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(e>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(e=1540483477*(65535&(e^=e>>>24))+((1540483477*(e>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),((n^=n>>>15)>>>0).toString(36)},c=function t(e){function r(t,e,r){var o=e.trim().split(v);e=o;var i=o.length,c=t.length;switch(c){case 0:case 1:var a=0;for(t=0===c?"":t[0]+" ";a<i;++a)e[a]=n(t,e[a],r).trim();break;default:var u=a=0;for(e=[];a<i;++a)for(var s=0;s<c;++s)e[u++]=n(t[s]+" ",o[a],r).trim()}return e}function n(t,e,r){var n=e.charCodeAt(0);switch(33>n&&(n=(e=e.trim()).charCodeAt(0)),n){case 38:return e.replace(b,"$1"+t.trim());case 58:return t.trim()+e.replace(b,"$1"+t.trim());default:if(0<1*r&&0<e.indexOf("\f"))return e.replace(b,(58===t.charCodeAt(0)?"":"$1")+t.trim())}return t+e}function o(t,e,r,n){var c=t+";",a=2*e+3*r+4*n;if(944===a){t=c.indexOf(":",9)+1;var u=c.substring(t,c.length-1).trim();return u=c.substring(0,t).trim()+u+";",1===P||2===P&&i(u,1)?"-webkit-"+u+u:u}if(0===P||2===P&&!i(c,1))return c;switch(a){case 1015:return 97===c.charCodeAt(10)?"-webkit-"+c+c:c;case 951:return 116===c.charCodeAt(3)?"-webkit-"+c+c:c;case 963:return 110===c.charCodeAt(5)?"-webkit-"+c+c:c;case 1009:if(100!==c.charCodeAt(4))break;case 969:case 942:return"-webkit-"+c+c;case 978:return"-webkit-"+c+"-moz-"+c+c;case 1019:case 983:return"-webkit-"+c+"-moz-"+c+"-ms-"+c+c;case 883:if(45===c.charCodeAt(8))return"-webkit-"+c+c;if(0<c.indexOf("image-set(",11))return c.replace(C,"$1-webkit-$2")+c;break;case 932:if(45===c.charCodeAt(4))switch(c.charCodeAt(5)){case 103:return"-webkit-box-"+c.replace("-grow","")+"-webkit-"+c+"-ms-"+c.replace("grow","positive")+c;case 115:return"-webkit-"+c+"-ms-"+c.replace("shrink","negative")+c;case 98:return"-webkit-"+c+"-ms-"+c.replace("basis","preferred-size")+c}return"-webkit-"+c+"-ms-"+c+c;case 964:return"-webkit-"+c+"-ms-flex-"+c+c;case 1023:if(99!==c.charCodeAt(8))break;return"-webkit-box-pack"+(u=c.substring(c.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+c+"-ms-flex-pack"+u+c;case 1005:return h.test(c)?c.replace(p,":-webkit-")+c.replace(p,":-moz-")+c:c;case 1e3:switch(e=(u=c.substring(13).trim()).indexOf("-")+1,u.charCodeAt(0)+u.charCodeAt(e)){case 226:u=c.replace(m,"tb");break;case 232:u=c.replace(m,"tb-rl");break;case 220:u=c.replace(m,"lr");break;default:return c}return"-webkit-"+c+"-ms-"+u+c;case 1017:if(-1===c.indexOf("sticky",9))break;case 975:switch(e=(c=t).length-10,a=(u=(33===c.charCodeAt(e)?c.substring(0,e):c).substring(t.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|u.charCodeAt(7))){case 203:if(111>u.charCodeAt(8))break;case 115:c=c.replace(u,"-webkit-"+u)+";"+c;break;case 207:case 102:c=c.replace(u,"-webkit-"+(102<a?"inline-":"")+"box")+";"+c.replace(u,"-webkit-"+u)+";"+c.replace(u,"-ms-"+u+"box")+";"+c}return c+";";case 938:if(45===c.charCodeAt(5))switch(c.charCodeAt(6)){case 105:return"-webkit-"+c+"-webkit-box-"+(u=c.replace("-items",""))+"-ms-flex-"+u+c;case 115:return"-webkit-"+c+"-ms-flex-item-"+c.replace(O,"")+c;default:return"-webkit-"+c+"-ms-flex-line-pack"+c.replace("align-content","").replace(O,"")+c}break;case 973:case 989:if(45!==c.charCodeAt(3)||122===c.charCodeAt(4))break;case 931:case 953:if(!0===j.test(t))return 115===(u=t.substring(t.indexOf(":")+1)).charCodeAt(0)?o(t.replace("stretch","fill-available"),e,r,n).replace(":fill-available",":stretch"):c.replace(u,"-webkit-"+u)+c.replace(u,"-moz-"+u.replace("fill-",""))+c;break;case 962:if(c="-webkit-"+c+(102===c.charCodeAt(5)?"-ms-"+c:"")+c,211===r+n&&105===c.charCodeAt(13)&&0<c.indexOf("transform",10))return c.substring(0,c.indexOf(";",27)+1).replace(d,"$1-webkit-$2")+c}return c}function i(t,e){var r=t.indexOf(1===e?":":"{"),n=t.substring(0,3!==e?r:10);return r=t.substring(r+1,t.length-1),I(2!==e?n:n.replace(k,"$1"),r,e)}function c(t,e){var r=o(e,e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2));return r!==e+";"?r.replace(_," or ($1)").substring(4):"("+e+")"}function a(t,e,r,n,o,i,c,a,u,f){for(var l,p=0,h=e;p<F;++p)switch(l=T[p].call(s,t,h,r,n,o,i,c,a,u,f)){case void 0:case!1:case!0:case null:break;default:h=l}if(h!==e)return h}function u(t){return void 0!==(t=t.prefix)&&(I=null,t?"function"!=typeof t?P=1:(P=2,I=t):P=0),u}function s(e,n){if(void 0!==this&&this.constructor===s)return t(e);var u=e;if(33>u.charCodeAt(0)&&(u=u.trim()),u=[u],0<F){var p=a(-1,n,u,u,A,S,0,0,0,0);void 0!==p&&"string"==typeof p&&(n=p)}var h=function t(e,n,u,s,p){for(var h,d,v,b,m,_=0,O=0,k=0,j=0,C=0,T=0,I=v=h=0,z=0,L=0,R=0,$=0,G=u.length,U=G-1,D="",H="",V="",W="";z<G;){if(d=u.charCodeAt(z),z===U&&0!==O+j+k+_&&(0!==O&&(d=47===O?10:47),j=k=_=0,G++,U++),0===O+j+k+_){if(z===U&&(0<L&&(D=D.replace(l,"")),0<D.trim().length)){switch(d){case 32:case 9:case 59:case 13:case 10:break;default:D+=u.charAt(z)}d=59}switch(d){case 123:for(h=(D=D.trim()).charCodeAt(0),v=1,$=++z;z<G;){switch(d=u.charCodeAt(z)){case 123:v++;break;case 125:v--;break;case 47:switch(d=u.charCodeAt(z+1)){case 42:case 47:t:{for(I=z+1;I<U;++I)switch(u.charCodeAt(I)){case 47:if(42===d&&42===u.charCodeAt(I-1)&&z+2!==I){z=I+1;break t}break;case 10:if(47===d){z=I+1;break t}}z=I}}break;case 91:d++;case 40:d++;case 34:case 39:for(;z++<U&&u.charCodeAt(z)!==d;);}if(0===v)break;z++}switch(v=u.substring($,z),0===h&&(h=(D=D.replace(f,"").trim()).charCodeAt(0)),h){case 64:switch(0<L&&(D=D.replace(l,"")),d=D.charCodeAt(1)){case 100:case 109:case 115:case 45:L=n;break;default:L=M}if($=(v=t(n,L,v,d,p+1)).length,0<F&&(m=a(3,v,L=r(M,D,R),n,A,S,$,d,p,s),D=L.join(""),void 0!==m&&0===($=(v=m.trim()).length)&&(d=0,v="")),0<$)switch(d){case 115:D=D.replace(x,c);case 100:case 109:case 45:v=D+"{"+v+"}";break;case 107:v=(D=D.replace(y,"$1 $2"))+"{"+v+"}",v=1===P||2===P&&i("@"+v,3)?"@-webkit-"+v+"@"+v:"@"+v;break;default:v=D+v,112===s&&(H+=v,v="")}else v="";break;default:v=t(n,r(n,D,R),v,s,p+1)}V+=v,v=R=L=I=h=0,D="",d=u.charCodeAt(++z);break;case 125:case 59:if(1<($=(D=(0<L?D.replace(l,""):D).trim()).length))switch(0===I&&(h=D.charCodeAt(0),45===h||96<h&&123>h)&&($=(D=D.replace(" ",":")).length),0<F&&void 0!==(m=a(1,D,n,e,A,S,H.length,s,p,s))&&0===($=(D=m.trim()).length)&&(D="\0\0"),h=D.charCodeAt(0),d=D.charCodeAt(1),h){case 0:break;case 64:if(105===d||99===d){W+=D+u.charAt(z);break}default:58!==D.charCodeAt($-1)&&(H+=o(D,h,d,D.charCodeAt(2)))}R=L=I=h=0,D="",d=u.charCodeAt(++z)}}switch(d){case 13:case 10:47===O?O=0:0===1+h&&107!==s&&0<D.length&&(L=1,D+="\0"),0<F*N&&a(0,D,n,e,A,S,H.length,s,p,s),S=1,A++;break;case 59:case 125:if(0===O+j+k+_){S++;break}default:switch(S++,b=u.charAt(z),d){case 9:case 32:if(0===j+_+O)switch(C){case 44:case 58:case 9:case 32:b="";break;default:32!==d&&(b=" ")}break;case 0:b="\\0";break;case 12:b="\\f";break;case 11:b="\\v";break;case 38:0===j+O+_&&(L=R=1,b="\f"+b);break;case 108:if(0===j+O+_+E&&0<I)switch(z-I){case 2:112===C&&58===u.charCodeAt(z-3)&&(E=C);case 8:111===T&&(E=T)}break;case 58:0===j+O+_&&(I=z);break;case 44:0===O+k+j+_&&(L=1,b+="\r");break;case 34:case 39:0===O&&(j=j===d?0:0===j?d:j);break;case 91:0===j+O+k&&_++;break;case 93:0===j+O+k&&_--;break;case 41:0===j+O+_&&k--;break;case 40:if(0===j+O+_){if(0===h)switch(2*C+3*T){case 533:break;default:h=1}k++}break;case 64:0===O+k+j+_+I+v&&(v=1);break;case 42:case 47:if(!(0<j+_+k))switch(O){case 0:switch(2*d+3*u.charCodeAt(z+1)){case 235:O=47;break;case 220:$=z,O=42}break;case 42:47===d&&42===C&&$+2!==z&&(33===u.charCodeAt($+2)&&(H+=u.substring($,z+1)),b="",O=0)}}0===O&&(D+=b)}T=C,C=d,z++}if(0<($=H.length)){if(L=n,0<F&&void 0!==(m=a(2,H,L,e,A,S,$,s,p,s))&&0===(H=m).length)return W+H+V;if(H=L.join(",")+"{"+H+"}",0!=P*E){switch(2!==P||i(H,2)||(E=0),E){case 111:H=H.replace(w,":-moz-$1")+H;break;case 112:H=H.replace(g,"::-webkit-input-$1")+H.replace(g,"::-moz-$1")+H.replace(g,":-ms-input-$1")+H}E=0}}return W+H+V}(M,u,n,0,0);return 0<F&&void 0!==(p=a(-2,h,u,u,A,S,h.length,0,0,0))&&(h=p),E=0,S=A=1,h}var f=/^\0+/g,l=/[\0\r\f]/g,p=/: */g,h=/zoo|gra/,d=/([,: ])(transform)/g,v=/,\r+?/g,b=/([\t\r\n ])*\f?&/g,y=/@(k\w+)\s*(\S*)\s*/,g=/::(place)/g,w=/:(read-only)/g,m=/[svh]\w+-[tblr]{2}/,x=/\(\s*(.*)\s*\)/g,_=/([\s\S]*?);/g,O=/-self|flex-/g,k=/[^]*?(:[rp][el]a[\w-]+)[^]*/,j=/stretch|:\s*\w+\-(?:conte|avail)/,C=/([^-])(image-set\()/,S=1,A=1,E=0,P=1,M=[],T=[],F=0,I=null,N=0;return s.use=function t(e){switch(e){case void 0:case null:F=T.length=0;break;default:switch(e.constructor){case Array:for(var r=0,n=e.length;r<n;++r)t(e[r]);break;case Function:T[F++]=e;break;case Boolean:N=0|!!e}}return t},s.set=u,void 0!==e&&u(e),s},a=r(61),u=r.n(a),s=/[A-Z]|^ms/g,f=n(function(t){return t.replace(s,"-$&").toLowerCase()}),l=function(t,e){return null==e||"boolean"==typeof e?"":1===o[t]||45===t.charCodeAt(1)||isNaN(e)||0===e?e:e+"px"},p=function t(e){for(var r=e.length,n=0,o="";n<r;n++){var i=e[n];if(null!=i){var c=void 0;switch(typeof i){case"boolean":break;case"function":0,c=t([i()]);break;case"object":if(Array.isArray(i))c=t(i);else for(var a in c="",i)i[a]&&a&&(c&&(c+=" "),c+=a);break;default:c=i}c&&(o&&(o+=" "),o+=c)}}return o},h="undefined"!=typeof document;function d(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key||""),void 0!==t.nonce&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),(void 0!==t.container?t.container:document.head).appendChild(e),e}var v=function(){function t(t){this.isSpeedy=!0,this.tags=[],this.ctr=0,this.opts=t}var e=t.prototype;return e.inject=function(){if(this.injected)throw new Error("already injected!");this.tags[0]=d(this.opts),this.injected=!0},e.speedy=function(t){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!t},e.insert=function(t,e){if(this.isSpeedy){var r=function(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}(this.tags[this.tags.length-1]);try{r.insertRule(t,r.cssRules.length)}catch(t){0}}else{var n=d(this.opts);this.tags.push(n),n.appendChild(document.createTextNode(t+(e||"")))}this.ctr++,this.ctr%65e3==0&&this.tags.push(d(this.opts))},e.flush=function(){this.tags.forEach(function(t){return t.parentNode.removeChild(t)}),this.tags=[],this.ctr=0,this.injected=!1},t}();e.a=function(t,e){if(void 0!==t.__SECRET_EMOTION__)return t.__SECRET_EMOTION__;void 0===e&&(e={});var r,n,o=e.key||"css",a=u()(function(t){r+=t,h&&d.insert(t,y)});void 0!==e.prefix&&(n={prefix:e.prefix});var s={registered:{},inserted:{},nonce:e.nonce,key:o},d=new v(e);h&&d.inject();var b=new c(n);b.use(e.stylisPlugins)(a);var y="";function g(t,e){if(null==t)return"";switch(typeof t){case"boolean":return"";case"function":if(void 0!==t.__emotion_styles){var r=t.toString();return r}return g.call(this,void 0===this?t():t(this.mergedProps,this.context),e);case"object":return function(t){if(x.has(t))return x.get(t);var e="";return Array.isArray(t)?t.forEach(function(t){e+=g.call(this,t,!1)},this):Object.keys(t).forEach(function(r){"object"!=typeof t[r]?void 0!==s.registered[t[r]]?e+=r+"{"+s.registered[t[r]]+"}":e+=f(r)+":"+l(r,t[r])+";":Array.isArray(t[r])&&"string"==typeof t[r][0]&&void 0===s.registered[t[r][0]]?t[r].forEach(function(t){e+=f(r)+":"+l(r,t)+";"}):e+=r+"{"+g.call(this,t[r],!1)+"}"},this),x.set(t,e),e}.call(this,t);default:var n=s.registered[t];return!1===e&&void 0!==n?n:t}}var w,m,x=new WeakMap,_=/label:\s*([^\s;\n{]+)\s*;/g,O=function(t){var e=!0,r="",n="";null==t||void 0===t.raw?(e=!1,r+=g.call(this,t,!1)):r+=t[0];for(var o=arguments.length,c=new Array(o>1?o-1:0),a=1;a<o;a++)c[a-1]=arguments[a];return c.forEach(function(n,o){r+=g.call(this,n,46===r.charCodeAt(r.length-1)),!0===e&&void 0!==t[o+1]&&(r+=t[o+1])},this),m=r,r=r.replace(_,function(t,e){return n+="-"+e,""}),w=function(t,e){return i(t+e)+e}(r,n),r};function k(t,e){void 0===s.inserted[w]&&(r="",b(t,e),s.inserted[w]=r)}var j=function(){var t=O.apply(this,arguments),e=o+"-"+w;return void 0===s.registered[e]&&(s.registered[e]=m),k("."+e,t),e};function C(t,e){var r="";return e.split(" ").forEach(function(e){void 0!==s.registered[e]?t.push(e):r+=e+" "}),r}function S(t,e){var r=[],n=C(r,t);return r.length<2?t:n+j(r,e)}function A(t){s.inserted[t]=!0}if(h){var E=document.querySelectorAll("[data-emotion-"+o+"]");Array.prototype.forEach.call(E,function(t){d.tags[0].parentNode.insertBefore(t,d.tags[0]),t.getAttribute("data-emotion-"+o).split(" ").forEach(A)})}var P={flush:function(){h&&(d.flush(),d.inject()),s.inserted={},s.registered={}},hydrate:function(t){t.forEach(A)},cx:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return S(p(e))},merge:S,getRegisteredStyles:C,injectGlobal:function(){k("",O.apply(this,arguments))},keyframes:function(){var t=O.apply(this,arguments),e="animation-"+w;return k("","@keyframes "+e+"{"+t+"}"),e},css:j,sheet:d,caches:s};return t.__SECRET_EMOTION__=P,P}},function(t,e){!function(){t.exports=this.wp.data}()},function(t,e,r){t.exports=function(){"use strict";return function(t){function e(e){if(e)try{t(e+"}")}catch(t){}}return function(r,n,o,i,c,a,u,s,f,l){switch(r){case 1:if(0===f&&64===n.charCodeAt(0))return t(n+";"),"";break;case 2:if(0===s)return n+"/*|*/";break;case 3:switch(s){case 102:case 112:return t(o[0]+n),"";default:return n+(0===l?"/*|*/":"")}case-2:n.split("/*|*/}").forEach(e)}}}}()},function(t,e,r){var n=r(111);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},function(t,e,r){"use strict";e.__esModule=!0;var n=c(r(118)),o=c(r(114)),i=c(r(51));function c(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":(0,i.default)(e)));t.prototype=(0,o.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(n.default?(0,n.default)(t,e):t.__proto__=e)}},function(t,e,r){"use strict";e.__esModule=!0;var n,o=r(51),i=(n=o)&&n.__esModule?n:{default:n};e.default=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":(0,i.default)(e))&&"function"!=typeof e?t:e}},function(t,e,r){"use strict";e.__esModule=!0;var n,o=r(142),i=(n=o)&&n.__esModule?n:{default:n};e.default=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),(0,i.default)(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}()},function(t,e,r){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,r){t.exports={default:r(145),__esModule:!0}},function(t,e,r){"use strict";e.__esModule=!0;var n,o=r(153),i=(n=o)&&n.__esModule?n:{default:n};e.default=i.default||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}},function(t,e){!function(){t.exports=this.wp.plugins}()},function(t,e,r){"use strict";r.r(e);var n=r(69),o=r(68),i=r.n(o),c=r(67),a=r.n(c),u=r(66),s=r.n(u),f=r(65),l=r.n(f),p=r(64),h=r.n(p),d=r(63),v=r.n(d),b=r(62),y=r.n(b),g=r(13),w=r(11),m=r(42),x=r(41),_=r(60),O=r(40),k=r(21),j=window,C=j.ajaxurl,S=j.DSPublicPostPreviewData,A=Object(g.a)("flex-direction:column;align-items:stretch;margin-top:10px;"),E=Object(g.a)("width:100%;margin-right:12px;"),P=Object(g.a)("font-style:italic;color:#666;margin:.2em 0 0 !important;"),M=Object(g.a)("display:flex;justify-content:flex-start;align-items:center;margin:0;"),T=function(t){function e(t){s()(this,e);var r=h()(this,(e.__proto__||a()(e)).call(this,t));return r.state={previewEnabled:S.previewEnabled,previewUrl:S.previewUrl,hasCopied:!1},r.previewUrlInput=React.createRef(),r.onChange=r.onChange.bind(r),r.onPreviewUrlInputFocus=r.onPreviewUrlInputFocus.bind(r),r}return v()(e,t),l()(e,[{key:"onChange",value:function(t){var e=this;this.request({checked:t,post_ID:this.props.postId},function(){e.setState({previewEnabled:!e.state.previewEnabled})})}},{key:"onPreviewUrlInputFocus",value:function(){this.previewUrlInput.current.focus(),this.previewUrlInput.current.select()}},{key:"request",value:function(t,e){jQuery.ajax({type:"POST",url:C,data:i()({action:"public-post-preview",_ajax_nonce:S.nonce},t),success:e})}},{key:"render",value:function(){var t=this,e=this.state,r=e.previewEnabled,n=e.previewUrl,o=e.hasCopied,i=o?Object(w.__)("Permalink copied","public-post-preview"):Object(w.__)("Copy the preview URL","public-post-preview");return wp.element.createElement(x.Fragment,null,wp.element.createElement(O.PluginPostStatusInfo,null,wp.element.createElement(m.CheckboxControl,{label:Object(w.__)("Enable public preview","public-post-preview"),checked:r,onChange:this.onChange})),r&&wp.element.createElement(O.PluginPostStatusInfo,{className:A},wp.element.createElement("p",{className:M},wp.element.createElement("label",{htmlFor:"public-post-preview-url",className:"screen-reader-text"},Object(w.__)("Preview URL","public-post-preview")),wp.element.createElement("input",{ref:this.previewUrlInput,type:"text",id:"public-post-preview-url",className:E,value:n,readOnly:!0,onFocus:this.onPreviewUrlInputFocus}),wp.element.createElement(m.ClipboardButton,{text:n,label:i,onCopy:function(){return t.setState({hasCopied:!0})},onFinishCopy:function(){return t.setState({hasCopied:!1})},"aria-disabled":o,icon:wp.element.createElement("svg",{width:"20",height:"20",viewBox:"0 0 14 16","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",focusable:"false"},wp.element.createElement("path",{fillRule:"evenodd",d:"M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"}))})),wp.element.createElement("p",{className:P},Object(w.__)("Copy and share this preview link.","public-post-preview"))))}}]),e}(x.Component),F=Object(k.compose)([Object(_.withSelect)(function(t){var e=t("core").getPostType,r=t("core/editor"),n=r.getCurrentPostId,o=r.getEditedPostAttribute,i=e(o("type"));return{postId:n(),status:o("status"),isViewable:y()(i,["viewable"],!1)}}),Object(k.ifCondition)(function(t){return t.isViewable}),Object(k.ifCondition)(function(t){var e=t.status;return-1===["auto-draft","publish","private"].indexOf(e)})])(T);Object(n.registerPlugin)("public-post-preview",{render:F})},function(t,e,r){var n=r(24),o=1/0;t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-o?"-0":e}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},function(t,e,r){var n=r(23),o=r(72),i=r(25),c=r(24),a=1/0,u=n?n.prototype:void 0,s=u?u.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(c(e))return s?s.call(e):"";var r=e+"";return"0"==r&&1/e==-a?"-0":r}},function(t,e,r){var n=r(73);t.exports=function(t){return null==t?"":n(t)}},function(t,e,r){var n=r(14);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},function(t,e,r){var n=r(14);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(14);t.exports=function(t){return n(this,t).get(t)}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(14);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e,r){var n=r(44)(r(22),"Map");t.exports=n},function(t,e,r){var n=r(15);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},function(t,e,r){var n=r(15);t.exports=function(t){return n(this.__data__,t)>-1}},function(t,e,r){var n=r(15);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,r){var n=r(15),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,r){var n=r(86),o=r(85),i=r(83),c=r(82),a=r(81);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=c,u.prototype.set=a,t.exports=u},function(t,e,r){var n=r(16),o="__lodash_hash_undefined__";t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?o:e,this}},function(t,e,r){var n=r(16),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},function(t,e,r){var n=r(16),o="__lodash_hash_undefined__",i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return r===o?void 0:r}return i.call(e,t)?e[t]:void 0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e){var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e,r){var n=r(22)["__core-js_shared__"];t.exports=n},function(t,e,r){var n,o=r(94),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},function(t,e,r){var n=r(46),o=r(43),i="[object AsyncFunction]",c="[object Function]",a="[object GeneratorFunction]",u="[object Proxy]";t.exports=function(t){if(!o(t))return!1;var e=n(t);return e==c||e==a||e==i||e==u}},function(t,e,r){var n=r(96),o=r(95),i=r(43),c=r(93),a=/^\[object .+?Constructor\]$/,u=Function.prototype,s=Object.prototype,f=u.toString,l=s.hasOwnProperty,p=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?p:a).test(c(t))}},function(t,e,r){var n=r(16);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(t,e,r){var n=r(98),o=r(91),i=r(90),c=r(89),a=r(88);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=c,u.prototype.set=a,t.exports=u},function(t,e,r){var n=r(99),o=r(87),i=r(80);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},function(t,e,r){var n=r(100),o=r(79),i=r(77),c=r(76),a=r(75);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=c,u.prototype.set=a,t.exports=u},function(t,e,r){var n=r(101),o="Expected a function";function i(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(o);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var c=t.apply(this,n);return r.cache=i.set(o,c)||i,c};return r.cache=new(i.Cache||n),r}i.Cache=n,t.exports=i},function(t,e,r){var n=r(102),o=500;t.exports=function(t){var e=n(t,function(t){return r.size===o&&r.clear(),t}),r=e.cache;return e}},function(t,e,r){var n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,i=r(103)(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(n,function(t,r,n,i){e.push(n?i.replace(o,"$1"):r||t)}),e});t.exports=i},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},function(t,e,r){var n=r(23),o=Object.prototype,i=o.hasOwnProperty,c=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=c.call(t);return n&&(e?t[a]=r:delete t[a]),o}},function(t,e,r){(function(e){var r="object"==typeof e&&e&&e.Object===Object&&e;t.exports=r}).call(this,r(45))},function(t,e,r){var n=r(25),o=r(24),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||c.test(t)||!i.test(t)||null!=e&&t in Object(e)}},function(t,e,r){var n=r(25),o=r(109),i=r(104),c=r(74);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(c(t))}},function(t,e,r){var n=r(110),o=r(71);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},function(t,e,r){var n=r(5);n(n.S,"Object",{create:r(29)})},function(t,e,r){r(112);var n=r(0).Object;t.exports=function(t,e){return n.create(t,e)}},function(t,e,r){t.exports={default:r(113),__esModule:!0}},function(t,e,r){var n=r(9),o=r(12),i=function(t,e){if(o(t),!n(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,n){try{(n=r(58)(Function.call,r(47).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,r){return i(t,r),e?t.__proto__=r:n(t,r),t}}({},!1):void 0),check:i}},function(t,e,r){var n=r(5);n(n.S,"Object",{setPrototypeOf:r(115).set})},function(t,e,r){r(116),t.exports=r(0).Object.setPrototypeOf},function(t,e,r){t.exports={default:r(117),__esModule:!0}},function(t,e,r){r(26)("observable")},function(t,e,r){r(26)("asyncIterator")},function(t,e){},function(t,e,r){var n=r(7),o=r(48).f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return c.slice()}}(t):o(n(t))}},function(t,e,r){var n=r(53);t.exports=Array.isArray||function(t){return"Array"==n(t)}},function(t,e,r){var n=r(19),o=r(33),i=r(17);t.exports=function(t){var e=n(t),r=o.f;if(r)for(var c,a=r(t),u=i.f,s=0;a.length>s;)u.call(t,c=a[s++])&&e.push(c);return e}},function(t,e,r){var n=r(18)("meta"),o=r(9),i=r(2),c=r(4).f,a=0,u=Object.isExtensible||function(){return!0},s=!r(8)(function(){return u(Object.preventExtensions({}))}),f=function(t){c(t,n,{value:{i:"O"+ ++a,w:{}}})},l=t.exports={KEY:n,NEED:!1,fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,n)){if(!u(t))return"F";if(!e)return"E";f(t)}return t[n].i},getWeak:function(t,e){if(!i(t,n)){if(!u(t))return!0;if(!e)return!1;f(t)}return t[n].w},onFreeze:function(t){return s&&l.NEED&&u(t)&&!i(t,n)&&f(t),t}}},function(t,e,r){"use strict";var n=r(1),o=r(2),i=r(3),c=r(5),a=r(49),u=r(125).KEY,s=r(8),f=r(35),l=r(28),p=r(18),h=r(6),d=r(27),v=r(26),b=r(124),y=r(123),g=r(12),w=r(9),m=r(7),x=r(39),_=r(20),O=r(29),k=r(122),j=r(47),C=r(4),S=r(19),A=j.f,E=C.f,P=k.f,M=n.Symbol,T=n.JSON,F=T&&T.stringify,I=h("_hidden"),N=h("toPrimitive"),z={}.propertyIsEnumerable,L=f("symbol-registry"),R=f("symbols"),$=f("op-symbols"),G=Object.prototype,U="function"==typeof M,D=n.QObject,H=!D||!D.prototype||!D.prototype.findChild,V=i&&s(function(){return 7!=O(E({},"a",{get:function(){return E(this,"a",{value:7}).a}})).a})?function(t,e,r){var n=A(G,e);n&&delete G[e],E(t,e,r),n&&t!==G&&E(G,e,n)}:E,W=function(t){var e=R[t]=O(M.prototype);return e._k=t,e},B=U&&"symbol"==typeof M.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof M},q=function(t,e,r){return t===G&&q($,e,r),g(t),e=x(e,!0),g(r),o(R,e)?(r.enumerable?(o(t,I)&&t[I][e]&&(t[I][e]=!1),r=O(r,{enumerable:_(0,!1)})):(o(t,I)||E(t,I,_(1,{})),t[I][e]=!0),V(t,e,r)):E(t,e,r)},J=function(t,e){g(t);for(var r,n=b(e=m(e)),o=0,i=n.length;i>o;)q(t,r=n[o++],e[r]);return t},K=function(t){var e=z.call(this,t=x(t,!0));return!(this===G&&o(R,t)&&!o($,t))&&(!(e||!o(this,t)||!o(R,t)||o(this,I)&&this[I][t])||e)},Q=function(t,e){if(t=m(t),e=x(e,!0),t!==G||!o(R,e)||o($,e)){var r=A(t,e);return!r||!o(R,e)||o(t,I)&&t[I][e]||(r.enumerable=!0),r}},Y=function(t){for(var e,r=P(m(t)),n=[],i=0;r.length>i;)o(R,e=r[i++])||e==I||e==u||n.push(e);return n},Z=function(t){for(var e,r=t===G,n=P(r?$:m(t)),i=[],c=0;n.length>c;)!o(R,e=n[c++])||r&&!o(G,e)||i.push(R[e]);return i};U||(a((M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(r){this===G&&e.call($,r),o(this,I)&&o(this[I],t)&&(this[I][t]=!1),V(this,t,_(1,r))};return i&&H&&V(G,t,{configurable:!0,set:e}),W(t)}).prototype,"toString",function(){return this._k}),j.f=Q,C.f=q,r(48).f=k.f=Y,r(17).f=K,r(33).f=Z,i&&!r(31)&&a(G,"propertyIsEnumerable",K,!0),d.f=function(t){return W(h(t))}),c(c.G+c.W+c.F*!U,{Symbol:M});for(var X="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;X.length>tt;)h(X[tt++]);for(var et=S(h.store),rt=0;et.length>rt;)v(et[rt++]);c(c.S+c.F*!U,"Symbol",{for:function(t){return o(L,t+="")?L[t]:L[t]=M(t)},keyFor:function(t){if(!B(t))throw TypeError(t+" is not a symbol!");for(var e in L)if(L[e]===t)return e},useSetter:function(){H=!0},useSimple:function(){H=!1}}),c(c.S+c.F*!U,"Object",{create:function(t,e){return void 0===e?O(t):J(O(t),e)},defineProperty:q,defineProperties:J,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Y,getOwnPropertySymbols:Z}),T&&c(c.S+c.F*(!U||s(function(){var t=M();return"[null]"!=F([t])||"{}"!=F({a:t})||"{}"!=F(Object(t))})),"JSON",{stringify:function(t){for(var e,r,n=[t],o=1;arguments.length>o;)n.push(arguments[o++]);if(r=e=n[1],(w(e)||void 0!==t)&&!B(t))return y(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!B(e))return e}),n[1]=e,F.apply(T,n)}}),M.prototype[N]||r(10)(M.prototype,N,M.prototype.valueOf),l(M,"Symbol"),l(Math,"Math",!0),l(n.JSON,"JSON",!0)},function(t,e,r){r(126),r(121),r(120),r(119),t.exports=r(0).Symbol},function(t,e,r){t.exports={default:r(127),__esModule:!0}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e){t.exports=function(){}},function(t,e,r){"use strict";var n=r(130),o=r(129),i=r(30),c=r(7);t.exports=r(50)(Array,"Array",function(t,e){this._t=c(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):o(0,"keys"==e?r:"values"==e?t[r]:[r,t[r]])},"values"),i.Arguments=i.Array,n("keys"),n("values"),n("entries")},function(t,e,r){r(131);for(var n=r(1),o=r(10),i=r(30),c=r(6)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<a.length;u++){var s=a[u],f=n[s],l=f&&f.prototype;l&&!l[c]&&o(l,c,s),i[s]=i.Array}},function(t,e,r){var n=r(1).document;t.exports=n&&n.documentElement},function(t,e,r){var n=r(4),o=r(12),i=r(19);t.exports=r(3)?Object.defineProperties:function(t,e){o(t);for(var r,c=i(e),a=c.length,u=0;a>u;)n.f(t,r=c[u++],e[r]);return t}},function(t,e,r){"use strict";var n=r(29),o=r(20),i=r(28),c={};r(10)(c,r(6)("iterator"),function(){return this}),t.exports=function(t,e,r){t.prototype=n(c,{next:o(1,r)}),i(t,e+" Iterator")}},function(t,e,r){var n=r(37),o=r(38);t.exports=function(t){return function(e,r){var i,c,a=String(o(e)),u=n(r),s=a.length;return u<0||u>=s?t?"":void 0:(i=a.charCodeAt(u))<55296||i>56319||u+1===s||(c=a.charCodeAt(u+1))<56320||c>57343?t?a.charAt(u):i:t?a.slice(u,u+2):c-56320+(i-55296<<10)+65536}}},function(t,e,r){"use strict";var n=r(136)(!0);r(50)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,r=this._i;return r>=e.length?{value:void 0,done:!0}:(t=n(e,r),this._i+=t.length,{value:t,done:!1})})},function(t,e,r){r(137),r(132),t.exports=r(27).f("iterator")},function(t,e,r){t.exports={default:r(138),__esModule:!0}},function(t,e,r){var n=r(5);n(n.S+n.F*!r(3),"Object",{defineProperty:r(4).f})},function(t,e,r){r(140);var n=r(0).Object;t.exports=function(t,e,r){return n.defineProperty(t,e,r)}},function(t,e,r){t.exports={default:r(141),__esModule:!0}},function(t,e,r){var n=r(5),o=r(0),i=r(8);t.exports=function(t,e){var r=(o.Object||{})[t]||Object[t],c={};c[t]=e(r),n(n.S+n.F*i(function(){r(1)}),"Object",c)}},function(t,e,r){var n=r(32),o=r(52);r(143)("getPrototypeOf",function(){return function(t){return o(n(t))}})},function(t,e,r){r(144),t.exports=r(0).Object.getPrototypeOf},function(t,e,r){var n=r(37),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=n(t))<0?o(t+e,0):i(t,e)}},function(t,e,r){var n=r(37),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,e,r){var n=r(7),o=r(147),i=r(146);t.exports=function(t){return function(e,r,c){var a,u=n(e),s=o(u.length),f=i(c,s);if(t&&r!=r){for(;s>f;)if((a=u[f++])!=a)return!0}else for(;s>f;f++)if((t||f in u)&&u[f]===r)return t||f||0;return!t&&-1}}},function(t,e,r){"use strict";var n=r(19),o=r(33),i=r(17),c=r(32),a=r(54),u=Object.assign;t.exports=!u||r(8)(function(){var t={},e={},r=Symbol(),n="abcdefghijklmnopqrst";return t[r]=7,n.split("").forEach(function(t){e[t]=t}),7!=u({},t)[r]||Object.keys(u({},e)).join("")!=n})?function(t,e){for(var r=c(t),u=arguments.length,s=1,f=o.f,l=i.f;u>s;)for(var p,h=a(arguments[s++]),d=f?n(h).concat(f(h)):n(h),v=d.length,b=0;v>b;)l.call(h,p=d[b++])&&(r[p]=h[p]);return r}:u},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,r){var n=r(5);n(n.S+n.F,"Object",{assign:r(149)})},function(t,e,r){r(151),t.exports=r(0).Object.assign},function(t,e,r){t.exports={default:r(152),__esModule:!0}}]);
js/public-post-preview.dev.js DELETED
@@ -1,111 +0,0 @@
1
- ( function( $ ) {
2
- DSPublicPostPreview = {
3
-
4
- /**
5
- * Initializes the plugin.
6
- *
7
- * @since 2.0.0
8
- */
9
- initialize : function() {
10
- var t = this;
11
-
12
- t.checkbox = $( '#public-post-preview' );
13
- t.link = $( '#public-post-preview-link' );
14
- t.nonce = $( '#public_post_preview_wpnonce' );
15
- t.status = $( '#public-post-preview-ajax' );
16
-
17
- if ( ! t.checkbox.prop( 'checked' ) )
18
- t.link.hide();
19
-
20
- t.checkbox.bind( 'change', function() {
21
- t.change();
22
- } );
23
- },
24
-
25
- /**
26
- * Handles a checkbox change.
27
- *
28
- * @since 2.0.0
29
- */
30
- change : function() {
31
- var t = this,
32
- checked = t.checkbox.prop( 'checked' ) ? 1 : 0;
33
-
34
- // Toggle visibility of the link
35
- t.link.toggle();
36
-
37
- // Disable the checkbox, to prevent double AJAX requests
38
- t.checkbox.prop( 'disabled', 'disabled' );
39
-
40
- t.request(
41
- {
42
- _ajax_nonce : t.nonce.val(),
43
- checked : checked,
44
- post_ID : $( '#post_ID' ).val()
45
- },
46
- function( data ) {
47
- // data is '1' if it's a successful request
48
- if ( data ) {
49
- if ( checked ) {
50
- t.status.text( DSPublicPostPreviewL10n.enabled );
51
- t._pulsate( t.status, 'green' );
52
- } else {
53
- t.status.text( DSPublicPostPreviewL10n.disabled );
54
- t._pulsate( t.status, 'red' );
55
- }
56
- }
57
-
58
- // Enable the checkbox again
59
- t.checkbox.prop('disabled', '');
60
- }
61
- );
62
- },
63
-
64
- /**
65
- * Does the AJAX request.
66
- *
67
- * @since 2.0.0
68
- *
69
- * @param {Object} data The data to send.
70
- * @param {Object} callback Callback function for a successfull request.
71
- */
72
- request : function( data, callback ) {
73
- $.ajax( {
74
- type: 'POST',
75
- url: ajaxurl,
76
- data: $.extend(
77
- data,
78
- {
79
- action: 'public-post-preview'
80
- }
81
- ),
82
- success : callback
83
- } );
84
- },
85
-
86
- /**
87
- * Helper for a pulse effect.
88
- *
89
- * @since 2.0.0
90
- *
91
- * @param {Object} e The element.
92
- * @param {String} color The text color of the element.
93
- */
94
- _pulsate : function( e, color ) {
95
- e.css( 'color', color )
96
- .animate( { opacity: 0 }, 600, 'linear' )
97
- .animate( { opacity: 1 }, 600, 'linear' )
98
- .animate( { opacity: 0 }, 600, 'linear' )
99
- .animate( { opacity: 1 }, 600, 'linear' )
100
- .animate( { opacity: 0 }, 600, 'linear', function() {
101
- e.text( '' );
102
- } );
103
- }
104
- };
105
-
106
- // Document is ready.
107
- $( function() {
108
- DSPublicPostPreview.initialize();
109
- } );
110
-
111
- } )( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/public-post-preview.js CHANGED
@@ -32,7 +32,7 @@
32
  */
33
  change : function() {
34
  var t = this,
35
- checked = t.checkbox.prop( 'checked' ) ? 1 : 0;
36
 
37
  // Toggle visibility of the link
38
  t.link.toggle();
32
  */
33
  change : function() {
34
  var t = this,
35
+ checked = t.checkbox.prop( 'checked' ) ? 'true' : 'false';
36
 
37
  // Toggle visibility of the link
38
  t.link.toggle();
js/public-post-preview.min.js CHANGED
@@ -1 +1 @@
1
- (function(a){DSPublicPostPreview={initialize:function(){var b=this;b.checkbox=a("#public-post-preview");b.link=a("#public-post-preview-link");b.nonce=a("#public_post_preview_wpnonce");b.status=a("#public-post-preview-ajax");b.status.css("opacity",0);b.checkbox.bind("change",function(){b.change();});b.link.find("input").on("focus",function(){a(this).select();});},change:function(){var b=this,c=b.checkbox.prop("checked")?1:0;b.link.toggle();b.checkbox.prop("disabled","disabled");b.request({_ajax_nonce:b.nonce.val(),checked:c,post_ID:a("#post_ID").val()},function(d){if(d){if(c){b.status.text(DSPublicPostPreviewL10n.enabled);b._pulsate(b.status,"green");}else{b.status.text(DSPublicPostPreviewL10n.disabled);b._pulsate(b.status,"red");}}b.checkbox.prop("disabled","");});},request:function(b,c){a.ajax({type:"POST",url:ajaxurl,data:a.extend(b,{action:"public-post-preview"}),success:c});},_pulsate:function(c,b){c.css("color",b).animate({opacity:1},600,"linear").animate({opacity:0},600,"linear",function(){c.empty();});}};a(DSPublicPostPreview.initialize());})(jQuery);
1
+ (function(a){DSPublicPostPreview={initialize:function(){var b=this;b.checkbox=a("#public-post-preview");b.link=a("#public-post-preview-link");b.nonce=a("#public_post_preview_wpnonce");b.status=a("#public-post-preview-ajax");b.status.css("opacity",0);b.checkbox.bind("change",function(){b.change();});b.link.find("input").on("focus",function(){a(this).select();});},change:function(){var b=this,c=b.checkbox.prop("checked")?"true":"false";b.link.toggle();b.checkbox.prop("disabled","disabled");b.request({_ajax_nonce:b.nonce.val(),checked:c,post_ID:a("#post_ID").val()},function(d){if(d){if(c){b.status.text(DSPublicPostPreviewL10n.enabled);b._pulsate(b.status,"green");}else{b.status.text(DSPublicPostPreviewL10n.disabled);b._pulsate(b.status,"red");}}b.checkbox.prop("disabled","");});},request:function(b,c){a.ajax({type:"POST",url:ajaxurl,data:a.extend(b,{action:"public-post-preview"}),success:c});},_pulsate:function(c,b){c.css("color",b).animate({opacity:1},600,"linear").animate({opacity:0},600,"linear",function(){c.empty();});}};a(DSPublicPostPreview.initialize());})(jQuery);
languages/public-post-preview.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
3
+ $generated_i18n_strings = array(
4
+ // Reference: js/src/components/preview-toggle/index.js:100
5
+ __( 'Permalink copied', 'public-post-preview' ),
6
+
7
+ // Reference: js/src/components/preview-toggle/index.js:100
8
+ __( 'Copy the preview URL', 'public-post-preview' ),
9
+
10
+ // Reference: js/src/components/preview-toggle/index.js:106
11
+ __( 'Enable public preview', 'public-post-preview' ),
12
+
13
+ // Reference: js/src/components/preview-toggle/index.js:114
14
+ __( 'Preview URL', 'public-post-preview' ),
15
+
16
+ // Reference: js/src/components/preview-toggle/index.js:134
17
+ __( 'Copy and share this preview link.', 'public-post-preview' )
18
+ );
19
+ /* THIS IS THE END OF THE GENERATED FILE */
languages/public-post-preview.pot ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Content-Type: text/plain; charset=utf-8\n"
4
+ "X-Generator: babel-plugin-makepot\n"
5
+
6
+ #: js/src/components/preview-toggle/index.js:100
7
+ msgid "Permalink copied"
8
+ msgstr ""
9
+
10
+ #: js/src/components/preview-toggle/index.js:100
11
+ msgid "Copy the preview URL"
12
+ msgstr ""
13
+
14
+ #: js/src/components/preview-toggle/index.js:106
15
+ msgid "Enable public preview"
16
+ msgstr ""
17
+
18
+ #: js/src/components/preview-toggle/index.js:114
19
+ msgid "Preview URL"
20
+ msgstr ""
21
+
22
+ #: js/src/components/preview-toggle/index.js:134
23
+ msgid "Copy and share this preview link."
24
+ msgstr ""
public-post-preview.php CHANGED
@@ -1,33 +1,31 @@
1
  <?php
2
  /**
3
  * Plugin Name: Public Post Preview
4
- * Version: 2.6.0
5
  * Description: Enables you to give a link to anonymous users for public preview of any post type before it is published.
6
  * Author: Dominik Schilling
7
- * Author URI: http://wphelper.de/
8
  * Plugin URI: https://dominikschilling.de/wp-plugins/public-post-preview/en/
9
- *
10
  * Text Domain: public-post-preview
11
- *
12
  * License: GPLv2 or later
13
  *
14
  * Previously (2009-2011) maintained by Jonathan Dingman and Matt Martz.
15
  *
16
- * Copyright (C) 2012-2017 Dominik Schilling
17
  *
18
- * This program is free software; you can redistribute it and/or
19
- * modify it under the terms of the GNU General Public License
20
- * as published by the Free Software Foundation; either version 2
21
- * of the License, or (at your option) any later version.
22
  *
23
- * This program is distributed in the hope that it will be useful,
24
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- * GNU General Public License for more details.
27
  *
28
- * You should have received a copy of the GNU General Public License
29
- * along with this program; if not, write to the Free Software
30
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31
  */
32
 
33
  /**
@@ -63,7 +61,7 @@ class DS_Public_Post_Preview {
63
  add_action( 'post_submitbox_misc_actions', array( __CLASS__, 'post_submitbox_misc_actions' ) );
64
  add_action( 'save_post', array( __CLASS__, 'register_public_preview' ), 20, 2 );
65
  add_action( 'wp_ajax_public-post-preview', array( __CLASS__, 'ajax_register_public_preview' ) );
66
- add_action( 'admin_enqueue_scripts' , array( __CLASS__, 'enqueue_script' ) );
67
  add_filter( 'display_post_states', array( __CLASS__, 'display_preview_state' ), 20, 2 );
68
  }
69
  }
@@ -89,24 +87,54 @@ class DS_Public_Post_Preview {
89
  return;
90
  }
91
 
92
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
 
 
 
 
 
 
 
93
 
94
- wp_enqueue_script(
95
- 'public-post-preview',
96
- plugins_url( "js/public-post-preview$suffix.js", __FILE__ ),
97
- array( 'jquery' ),
98
- '20160403',
99
- true
100
- );
 
 
 
101
 
102
- wp_localize_script(
103
- 'public-post-preview',
104
- 'DSPublicPostPreviewL10n',
105
- array(
106
- 'enabled' => __( 'Enabled!', 'public-post-preview' ),
107
- 'disabled' => __( 'Disabled!', 'public-post-preview' ),
108
- )
109
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
111
 
112
  /**
@@ -187,10 +215,9 @@ class DS_Public_Post_Preview {
187
  $post = get_post();
188
  }
189
 
190
- wp_nonce_field( 'public_post_preview', 'public_post_preview_wpnonce' );
191
 
192
- $preview_post_ids = self::get_preview_post_ids();
193
- $enabled = in_array( $post->ID, $preview_post_ids );
194
  ?>
195
  <label><input type="checkbox"<?php checked( $enabled ); ?> name="public_post_preview" id="public-post-preview" value="1" />
196
  <?php _e( 'Enable public preview', 'public-post-preview' ); ?> <span id="public-post-preview-ajax"></span></label>
@@ -204,6 +231,19 @@ class DS_Public_Post_Preview {
204
  <?php
205
  }
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  /**
208
  * Returns the public preview link.
209
  *
@@ -220,25 +260,25 @@ class DS_Public_Post_Preview {
220
  public static function get_preview_link( $post ) {
221
  if ( 'page' == $post->post_type ) {
222
  $args = array(
223
- 'page_id' => $post->ID,
224
  );
225
- } else if ( 'post' == $post->post_type ) {
226
  $args = array(
227
- 'p' => $post->ID,
228
  );
229
  } else {
230
  $args = array(
231
- 'p' => $post->ID,
232
- 'post_type' => $post->post_type,
233
  );
234
  }
235
 
236
  $args['preview'] = true;
237
- $args['_ppp'] = self::create_nonce( 'public_post_preview_' . $post->ID );
238
 
239
  $link = add_query_arg( $args, home_url( '/' ) );
240
 
241
- return apply_filters( 'ppp_preview_link', $link, $post->ID, $post );
242
  }
243
 
244
  /**
@@ -298,7 +338,7 @@ class DS_Public_Post_Preview {
298
  * @return bool Returns false on a failure, true on a success.
299
  */
300
  public static function unregister_public_preview_on_status_change( $new_status, $old_status, $post ) {
301
- $disallowed_status = self::get_published_statuses();
302
  $disallowed_status[] = 'trash';
303
 
304
  if ( in_array( $new_status, $disallowed_status ) ) {
@@ -318,7 +358,7 @@ class DS_Public_Post_Preview {
318
  * @return bool Returns false on a failure, true on a success.
319
  */
320
  public static function unregister_public_preview_on_edit( $post_id, $post ) {
321
- $disallowed_status = self::get_published_statuses();
322
  $disallowed_status[] = 'trash';
323
 
324
  if ( in_array( $post->post_status, $disallowed_status ) ) {
@@ -356,36 +396,37 @@ class DS_Public_Post_Preview {
356
  * @since 2.0.0
357
  */
358
  public static function ajax_register_public_preview() {
359
- check_ajax_referer( 'public_post_preview' );
360
-
361
  $preview_post_id = (int) $_POST['post_ID'];
 
 
 
362
  $post = get_post( $preview_post_id );
363
 
364
- if ( ( 'page' == $post->post_type && ! current_user_can( 'edit_page', $preview_post_id ) ) || ! current_user_can( 'edit_post', $preview_post_id ) ) {
365
- wp_die( 0 );
366
  }
367
 
368
  if ( in_array( $post->post_status, self::get_published_statuses() ) ) {
369
- wp_die( 0 );
370
  }
371
 
372
  $preview_post_ids = self::get_preview_post_ids();
373
 
374
- if ( empty( $_POST['checked'] ) && in_array( $preview_post_id, $preview_post_ids ) ) {
375
  $preview_post_ids = array_diff( $preview_post_ids, (array) $preview_post_id );
376
- } elseif ( ! empty( $_POST['checked'] ) && ! in_array( $preview_post_id, $preview_post_ids ) ) {
377
  $preview_post_ids = array_merge( $preview_post_ids, (array) $preview_post_id );
378
  } else {
379
- wp_die( 0 );
380
  }
381
 
382
  $ret = self::set_preview_post_ids( $preview_post_ids );
383
 
384
  if ( ! $ret ) {
385
- wp_die( 0 );
386
  }
387
 
388
- wp_die( 1 );
389
  }
390
 
391
  /**
@@ -423,6 +464,7 @@ class DS_Public_Post_Preview {
423
  if ( ! headers_sent() ) {
424
  nocache_headers();
425
  }
 
426
 
427
  add_filter( 'posts_results', array( __CLASS__, 'set_post_to_publish' ), 10, 2 );
428
  }
1
  <?php
2
  /**
3
  * Plugin Name: Public Post Preview
4
+ * Version: 2.7.0
5
  * Description: Enables you to give a link to anonymous users for public preview of any post type before it is published.
6
  * Author: Dominik Schilling
7
+ * Author URI: https://wphelper.de/
8
  * Plugin URI: https://dominikschilling.de/wp-plugins/public-post-preview/en/
 
9
  * Text Domain: public-post-preview
 
10
  * License: GPLv2 or later
11
  *
12
  * Previously (2009-2011) maintained by Jonathan Dingman and Matt Martz.
13
  *
14
+ * Copyright (C) 2012-2018 Dominik Schilling
15
  *
16
+ * This program is free software; you can redistribute it and/or
17
+ * modify it under the terms of the GNU General Public License
18
+ * as published by the Free Software Foundation; either version 2
19
+ * of the License, or (at your option) any later version.
20
  *
21
+ * This program is distributed in the hope that it will be useful,
22
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ * GNU General Public License for more details.
25
  *
26
+ * You should have received a copy of the GNU General Public License
27
+ * along with this program; if not, write to the Free Software
28
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
  */
30
 
31
  /**
61
  add_action( 'post_submitbox_misc_actions', array( __CLASS__, 'post_submitbox_misc_actions' ) );
62
  add_action( 'save_post', array( __CLASS__, 'register_public_preview' ), 20, 2 );
63
  add_action( 'wp_ajax_public-post-preview', array( __CLASS__, 'ajax_register_public_preview' ) );
64
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_script' ) );
65
  add_filter( 'display_post_states', array( __CLASS__, 'display_preview_state' ), 20, 2 );
66
  }
67
  }
87
  return;
88
  }
89
 
90
+ if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) {
91
+ wp_enqueue_script(
92
+ 'public-post-preview-gutenberg',
93
+ plugins_url( 'js/gutenberg-integration.js', __FILE__ ),
94
+ array( 'wp-edit-post' ),
95
+ '20180914',
96
+ true
97
+ );
98
 
99
+ $post = get_post();
100
+ wp_localize_script(
101
+ 'public-post-preview-gutenberg',
102
+ 'DSPublicPostPreviewData',
103
+ array(
104
+ 'previewEnabled' => self::is_public_preview_enabled( $post ),
105
+ 'previewUrl' => self::get_preview_link( $post ),
106
+ 'nonce' => wp_create_nonce( 'public-post-preview_' . $post->ID ),
107
+ )
108
+ );
109
 
110
+ if ( function_exists( 'gutenberg_get_jed_locale_data' ) ) {
111
+ $locale_data = gutenberg_get_jed_locale_data( 'public-post-preview' );
112
+ wp_add_inline_script(
113
+ 'public-post-preview-gutenberg',
114
+ 'wp.i18n.setLocaleData( ' . wp_json_encode( $locale_data ) . ', "public-post-preview" );',
115
+ 'before'
116
+ );
117
+ }
118
+ } else {
119
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
120
+
121
+ wp_enqueue_script(
122
+ 'public-post-preview',
123
+ plugins_url( "js/public-post-preview$suffix.js", __FILE__ ),
124
+ array( 'jquery' ),
125
+ '20180914',
126
+ true
127
+ );
128
+
129
+ wp_localize_script(
130
+ 'public-post-preview',
131
+ 'DSPublicPostPreviewL10n',
132
+ array(
133
+ 'enabled' => __( 'Enabled!', 'public-post-preview' ),
134
+ 'disabled' => __( 'Disabled!', 'public-post-preview' ),
135
+ )
136
+ );
137
+ }
138
  }
139
 
140
  /**
215
  $post = get_post();
216
  }
217
 
218
+ wp_nonce_field( 'public-post-preview_' . $post->ID, 'public_post_preview_wpnonce' );
219
 
220
+ $enabled = self::is_public_preview_enabled( $post );
 
221
  ?>
222
  <label><input type="checkbox"<?php checked( $enabled ); ?> name="public_post_preview" id="public-post-preview" value="1" />
223
  <?php _e( 'Enable public preview', 'public-post-preview' ); ?> <span id="public-post-preview-ajax"></span></label>
231
  <?php
232
  }
233
 
234
+ /**
235
+ * Checks if a public preview is enabled for a post.
236
+ *
237
+ * @since 2.7.0
238
+ *
239
+ * @param WP_Post $post The post object.
240
+ * @return bool True if a public preview is enabled, false if not.
241
+ */
242
+ private static function is_public_preview_enabled( $post ) {
243
+ $preview_post_ids = self::get_preview_post_ids();
244
+ return in_array( $post->ID, $preview_post_ids, true );
245
+ }
246
+
247
  /**
248
  * Returns the public preview link.
249
  *
260
  public static function get_preview_link( $post ) {
261
  if ( 'page' == $post->post_type ) {
262
  $args = array(
263
+ 'page_id' => $post->ID,
264
  );
265
+ } elseif ( 'post' == $post->post_type ) {
266
  $args = array(
267
+ 'p' => $post->ID,
268
  );
269
  } else {
270
  $args = array(
271
+ 'p' => $post->ID,
272
+ 'post_type' => $post->post_type,
273
  );
274
  }
275
 
276
  $args['preview'] = true;
277
+ $args['_ppp'] = self::create_nonce( 'public_post_preview_' . $post->ID );
278
 
279
  $link = add_query_arg( $args, home_url( '/' ) );
280
 
281
+ return apply_filters( 'ppp_preview_link', $link, $post->ID, $post );
282
  }
283
 
284
  /**
338
  * @return bool Returns false on a failure, true on a success.
339
  */
340
  public static function unregister_public_preview_on_status_change( $new_status, $old_status, $post ) {
341
+ $disallowed_status = self::get_published_statuses();
342
  $disallowed_status[] = 'trash';
343
 
344
  if ( in_array( $new_status, $disallowed_status ) ) {
358
  * @return bool Returns false on a failure, true on a success.
359
  */
360
  public static function unregister_public_preview_on_edit( $post_id, $post ) {
361
+ $disallowed_status = self::get_published_statuses();
362
  $disallowed_status[] = 'trash';
363
 
364
  if ( in_array( $post->post_status, $disallowed_status ) ) {
396
  * @since 2.0.0
397
  */
398
  public static function ajax_register_public_preview() {
 
 
399
  $preview_post_id = (int) $_POST['post_ID'];
400
+
401
+ check_ajax_referer( 'public-post-preview_' . $preview_post_id );
402
+
403
  $post = get_post( $preview_post_id );
404
 
405
+ if ( ! current_user_can( 'edit_post', $preview_post_id ) ) {
406
+ wp_send_json_error( 'cannot_edit' );
407
  }
408
 
409
  if ( in_array( $post->post_status, self::get_published_statuses() ) ) {
410
+ wp_send_json_error( 'invalid_post_status' );
411
  }
412
 
413
  $preview_post_ids = self::get_preview_post_ids();
414
 
415
+ if ( 'false' === $_POST['checked'] && in_array( $preview_post_id, $preview_post_ids ) ) {
416
  $preview_post_ids = array_diff( $preview_post_ids, (array) $preview_post_id );
417
+ } elseif ( 'true' === $_POST['checked'] && ! in_array( $preview_post_id, $preview_post_ids ) ) {
418
  $preview_post_ids = array_merge( $preview_post_ids, (array) $preview_post_id );
419
  } else {
420
+ wp_send_json_error( 'unknown_status' );
421
  }
422
 
423
  $ret = self::set_preview_post_ids( $preview_post_ids );
424
 
425
  if ( ! $ret ) {
426
+ wp_send_json_error( 'not_saved' );
427
  }
428
 
429
+ wp_send_json_success();
430
  }
431
 
432
  /**
464
  if ( ! headers_sent() ) {
465
  nocache_headers();
466
  }
467
+ add_action( 'wp_head', 'wp_no_robots' );
468
 
469
  add_filter( 'posts_results', array( __CLASS__, 'set_post_to_publish' ), 10, 2 );
470
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ocean90
3
  Tags: public, post, preview, posts, custom post types, draft
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
- Stable tag: 2.6.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -71,6 +71,10 @@ function my_nonce_life() {
71
  Or use the [Public Post Preview Configurator](https://wordpress.org/plugins/public-post-preview-configurator/).
72
 
73
  == Change Log ==
 
 
 
 
74
  = 2.6.0 (2017-04-27): =
75
  * Make `DS_Public_Post_Preview::get_preview_link()` public. Props [@rcstr](https://github.com/rcstr).
76
  * Send no-cache headers for public post previews.
3
  Tags: public, post, preview, posts, custom post types, draft
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
+ Stable tag: 2.7.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
71
  Or use the [Public Post Preview Configurator](https://wordpress.org/plugins/public-post-preview-configurator/).
72
 
73
  == Change Log ==
74
+ = 2.7.0 (2018-09-14): =
75
+ * Initial support for Gutenberg.
76
+ * Block robots for public post previews. Props [@westonruter](https://github.com/westonruter).
77
+
78
  = 2.6.0 (2017-04-27): =
79
  * Make `DS_Public_Post_Preview::get_preview_link()` public. Props [@rcstr](https://github.com/rcstr).
80
  * Send no-cache headers for public post previews.