Post Expirator - Version 2.7.2

Version Description

Download this release

Release Info

Developer andergmartins
Plugin Icon 128x128 Post Expirator
Version 2.7.2
Comparing to
See all releases

Code changes from version 2.7.1 to 2.7.2

assets/css/settings.css CHANGED
@@ -15,10 +15,6 @@ ul.pe-list > li {
15
  padding: 5px;
16
  }
17
 
18
- tr.pe-event {
19
- background-color: #ddd !important;
20
- }
21
-
22
  #pe-settings-tabs fieldset {
23
  border: 1px solid black;
24
  border-radius: 6px;
@@ -139,3 +135,21 @@ footer .dashicons.dashicons-star-filled {
139
  footer .pp-pressshack-logo img {
140
  width: 170px;
141
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  padding: 5px;
16
  }
17
 
 
 
 
 
18
  #pe-settings-tabs fieldset {
19
  border: 1px solid black;
20
  border-radius: 6px;
135
  footer .pp-pressshack-logo img {
136
  width: 170px;
137
  }
138
+
139
+ .form-table .widefat th {
140
+ padding-left: 20px;
141
+ font-weight: 400;
142
+ }
143
+
144
+ .form-table .widefat .pe-date-column,
145
+ .form-table .widefat .pe-event-column {
146
+ width: 20%;
147
+ }
148
+
149
+ span.post-expiration-attributes {
150
+ color: #adadad;
151
+ }
152
+
153
+ .pe-event-post {
154
+ cursor: help;
155
+ }
assets/js/gutenberg-panel.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e){var t={};function a(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){e.exports=a(1)},function(e,t,a){"use strict";var n,r,o,i,s,c,u,l,p,d,f,g,y,m,b,v,x,h,E,w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}n=window.wp,r=window.postExpiratorPanelConfig,o=n.plugins.registerPlugin,i=n.editPost.PluginDocumentSettingPanel,s=n.components,c=s.PanelRow,u=s.DateTimePicker,l=s.CheckboxControl,p=s.SelectControl,d=s.FormTokenField,f=s.Spinner,g=n.element,y=g.Fragment,m=g.Component,b=n.htmlEntities.decodeEntities,v=lodash,x=v.isEmpty,h=v.keys,E=v.compact,o("postexpirator-sidebar",{render:function(e){function t(){T(this,t);var e=S(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={categoriesList:[],catIdVsName:[]},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),P(t,[{key:"componentWillMount",value:function(){var e=this,t=(this.state.attributes,n.data.select("core/editor").getEditedPostAttribute("meta")),a=n.data.select("core/editor").getCurrentPostType(),o=function(e){return n.data.dispatch("core/editor").editPost({meta:e})},i=!1,s=new Date,c=this.getExpireType(t),u=[];c.includes("category")&&(u=this.getCategories(t)),t["_expiration-date-status"]&&"saved"===t["_expiration-date-status"]&&(i=!0);var l=60*s.getTimezoneOffset(),p=60*r.timezone_offset;t["_expiration-date"]?s.setTime(1e3*(t["_expiration-date"]+l+p)):(u=r.default_categories,r.default_date&&s.setTime(1e3*(parseInt(r.default_date)+l+p)));var d=r.defaults.taxonomy||"category";this.setState({enabled:i,date:s,expireAction:c,categories:u,taxonomy:d}),o({"_expiration-date-status":i?"saved":""}),o({"_expiration-date":s.getTime()/1e3}),o({"_expiration-date-type":c}),o({"_expiration-date-categories":u});var f=[],g=[];!d&&"post"===a||"category"===d?n.apiFetch({path:n.url.addQueryArgs("wp/v2/categories",{per_page:-1})}).then((function(t){t.forEach((function(e){f[e.name]=e,g[e.id]=e.name})),e.setState({categoriesList:f,catIdVsName:g,taxonomy:r.strings.category})})):"page"!==a&&n.apiFetch({path:n.url.addQueryArgs("wp/v2/taxonomies/"+d,{context:"edit"})}).then((function(t){n.apiFetch({path:n.url.addQueryArgs("wp/v2/"+t.rest_base,{context:"edit"})}).then((function(a){a.forEach((function(e){f[b(e.name)]=e,g[e.id]=b(e.name)})),e.setState({categoriesList:f,catIdVsName:g,taxonomy:b(t.name)})}))}))}},{key:"componentDidUpdate",value:function(){var e=this.state,t=e.enabled,a=e.date,r=e.expireAction,o=e.categories,i=e.attribute,s=function(e){return n.data.dispatch("core/editor").editPost({meta:e})},c=n.data.select("core/editor").getEditedPostAttribute("meta");switch(i){case"enabled":s({"_expiration-date-status":t?"saved":""}),c["_expiration-date"]||s({"_expiration-date":this.getDate(a)});break;case"date":"string"==typeof a&&s({"_expiration-date":this.getDate(a)});break;case"action":s({"_expiration-date-type":r}),r.includes("category")||s({"_expiration-date-categories":[]});break;case"category":s({"_expiration-date-categories":o})}}},{key:"render",value:function(){var e=this,t=this.state,a=t.categoriesList,o=t.catIdVsName,s=this.state,g=s.enabled,m=s.date,b=s.expireAction,v=s.categories,w=s.taxonomy,P=n.data.select("core/editor").getCurrentPostType(),T=[{label:r.strings.draft,value:"draft"},{label:r.strings.delete,value:"delete"},{label:r.strings.trash,value:"trash"},{label:r.strings.private,value:"private"},{label:r.strings.stick,value:"stick"},{label:r.strings.unstick,value:"unstick"}];"page"!==P&&(T=_.union(T,[{label:r.strings.categoryReplace,value:"category"},{label:r.strings.categoryAdd,value:"category-add"},{label:r.strings.categoryRemove,value:"category-remove"}]));var S=v&&E(v.map((function(e){return o[e]||!1})));return"string"==typeof S&&(S=[]),React.createElement(i,{title:r.strings.postExpirator,icon:"calendar",initialOpen:g,className:"post-expirator-panel"},React.createElement(c,null,React.createElement(l,{label:r.strings.enablePostExpiration,checked:g,onChange:function(t){e.setState({enabled:!g,attribute:"enabled"})}})),g&&React.createElement(y,null,React.createElement(c,null,React.createElement(u,{currentDate:m,onChange:function(t){return e.setState({date:t,attribute:"date"})},is_12_hours:r.is_12_hours})),React.createElement(p,{label:r.strings.howToExpire,value:b,options:T,onChange:function(t){e.setState({expireAction:t,attribute:"action"})}}),b.includes("category")&&(x(h(a))&&React.createElement(y,null,r.strings.loading+" ("+w+")",React.createElement(f,null))||React.createElement(d,{label:r.strings.expirationCategories+" ("+w+")",value:S,suggestions:Object.keys(a),onChange:function(t){e.setState({categories:e.selectCategories(t),attribute:"category"})},maxSuggestions:10}))))}},{key:"getExpireType",value:function(e){var t=e["_expiration-date-type"],a=e["_expiration-date-options"]&&e["_expiration-date-options"].expireType;return t||a||(r&&r.defaults&&r.defaults.expireType?r.defaults.expireType:"draft")}},{key:"getCategories",value:function(e){var t=e["_expiration-date-categories"]&&e["_expiration-date-categories"],a=e["_expiration-date-options"]&&e["_expiration-date-options"].category;return"object"===(void 0===t?"undefined":w(t))&&t.length>0?t:(a&&void 0!==a&&"object"!==(void 0===a?"undefined":w(a))&&(categories=[a]),a)}},{key:"selectCategories",value:function(e){var t=this.state,a=t.categoriesList;if(t.catIdVsName,!e.some((function(e){return"string"==typeof e&&!a[e]})))return e.map((function(e){return"string"==typeof e?a[e]:e})).map((function(e){return e.id}))}},{key:"getDate",value:function(e){var t=new Date,a=60*(new Date).getTimezoneOffset(),n=60*r.timezone_offset;return t.setTime(Date.parse(e)),t.setTime(t.getTime()-1e3*(a+n)),t.getTime()/1e3}}]),t}(m)})}]);
2
  //# sourceMappingURL=gutenberg-panel.js.map
1
+ !function(e){var t={};function a(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){e.exports=a(1)},function(e,t,a){"use strict";var n,r,o,i,s,c,u,l,p,d,f,g,y,m,b,v,x,h,E,w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}n=window.wp,r=window.postExpiratorPanelConfig,o=n.plugins.registerPlugin,i=n.editPost.PluginDocumentSettingPanel,s=n.components,c=s.PanelRow,u=s.DateTimePicker,l=s.CheckboxControl,p=s.SelectControl,d=s.FormTokenField,f=s.Spinner,g=n.element,y=g.Fragment,m=g.Component,b=n.htmlEntities.decodeEntities,v=lodash,x=v.isEmpty,h=v.keys,E=v.compact,o("postexpirator-sidebar",{render:function(e){function t(){T(this,t);var e=S(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={categoriesList:[],catIdVsName:[]},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),P(t,[{key:"componentWillMount",value:function(){var e=this,t=(this.state.attributes,n.data.select("core/editor").getEditedPostAttribute("meta")),a=n.data.select("core/editor").getCurrentPostType(),o=function(e){return n.data.dispatch("core/editor").editPost({meta:e})},i=!1,s=new Date,c=this.getExpireType(t),u=[];c.includes("category")&&(u=this.getCategories(t)),t["_expiration-date-status"]&&"saved"===t["_expiration-date-status"]&&(i=!0);var l=60*s.getTimezoneOffset(),p=60*r.timezone_offset;t["_expiration-date"]?s.setTime(1e3*(t["_expiration-date"]+l+p)):(u=r.default_categories,r.default_date&&s.setTime(1e3*(parseInt(r.default_date)+l+p)),i=!1);var d=r.defaults.taxonomy||"category";this.setState({enabled:i,date:s,expireAction:c,categories:u,taxonomy:d}),o({"_expiration-date-status":i?"saved":""}),o({"_expiration-date":s.getTime()/1e3}),o({"_expiration-date-type":c}),o({"_expiration-date-categories":u});var f=[],g=[];!d&&"post"===a||"category"===d?n.apiFetch({path:n.url.addQueryArgs("wp/v2/categories",{per_page:-1})}).then((function(t){t.forEach((function(e){f[e.name]=e,g[e.id]=e.name})),e.setState({categoriesList:f,catIdVsName:g,taxonomy:r.strings.category})})):"page"!==a&&n.apiFetch({path:n.url.addQueryArgs("wp/v2/taxonomies/"+d,{context:"edit"})}).then((function(t){n.apiFetch({path:n.url.addQueryArgs("wp/v2/"+t.rest_base,{context:"edit"})}).then((function(a){a.forEach((function(e){f[b(e.name)]=e,g[e.id]=b(e.name)})),e.setState({categoriesList:f,catIdVsName:g,taxonomy:b(t.name)})}))}))}},{key:"componentDidUpdate",value:function(){var e=this.state,t=e.enabled,a=e.date,r=e.expireAction,o=e.categories,i=e.attribute,s=function(e){return n.data.dispatch("core/editor").editPost({meta:e})},c=n.data.select("core/editor").getEditedPostAttribute("meta");switch(i){case"enabled":s({"_expiration-date-status":t?"saved":""}),c["_expiration-date"]||s({"_expiration-date":this.getDate(a)});break;case"date":"string"==typeof a&&s({"_expiration-date":this.getDate(a)});break;case"action":s({"_expiration-date-type":r}),r.includes("category")||s({"_expiration-date-categories":[]});break;case"category":s({"_expiration-date-categories":o})}}},{key:"render",value:function(){var e=this,t=this.state,a=t.categoriesList,o=t.catIdVsName,s=this.state,g=s.enabled,m=s.date,b=s.expireAction,v=s.categories,w=s.taxonomy,P=n.data.select("core/editor").getCurrentPostType(),T=[{label:r.strings.draft,value:"draft"},{label:r.strings.delete,value:"delete"},{label:r.strings.trash,value:"trash"},{label:r.strings.private,value:"private"},{label:r.strings.stick,value:"stick"},{label:r.strings.unstick,value:"unstick"}];"page"!==P&&(T=_.union(T,[{label:r.strings.categoryReplace,value:"category"},{label:r.strings.categoryAdd,value:"category-add"},{label:r.strings.categoryRemove,value:"category-remove"}]));var S=v&&E(v.map((function(e){return o[e]||!1})));return"string"==typeof S&&(S=[]),React.createElement(i,{title:r.strings.postExpirator,icon:"calendar",initialOpen:g,className:"post-expirator-panel"},React.createElement(c,null,React.createElement(l,{label:r.strings.enablePostExpiration,checked:g,onChange:function(t){e.setState({enabled:!g,attribute:"enabled"})}})),g&&React.createElement(y,null,React.createElement(c,null,React.createElement(u,{currentDate:m,onChange:function(t){return e.setState({date:t,attribute:"date"})},is_12_hours:r.is_12_hours})),React.createElement(p,{label:r.strings.howToExpire,value:b,options:T,onChange:function(t){e.setState({expireAction:t,attribute:"action"})}}),b.includes("category")&&(x(h(a))&&React.createElement(y,null,r.strings.loading+" ("+w+")",React.createElement(f,null))||React.createElement(d,{label:r.strings.expirationCategories+" ("+w+")",value:S,suggestions:Object.keys(a),onChange:function(t){e.setState({categories:e.selectCategories(t),attribute:"category"})},maxSuggestions:10}))))}},{key:"getExpireType",value:function(e){var t=e["_expiration-date-type"],a=e["_expiration-date-options"]&&e["_expiration-date-options"].expireType;return t||a||(r&&r.defaults&&r.defaults.expireType?r.defaults.expireType:"draft")}},{key:"getCategories",value:function(e){var t=e["_expiration-date-categories"]&&e["_expiration-date-categories"],a=e["_expiration-date-options"]&&e["_expiration-date-options"].category;return"object"===(void 0===t?"undefined":w(t))&&t.length>0?t:(a&&void 0!==a&&"object"!==(void 0===a?"undefined":w(a))&&(categories=[a]),a)}},{key:"selectCategories",value:function(e){var t=this.state,a=t.categoriesList;if(t.catIdVsName,!e.some((function(e){return"string"==typeof e&&!a[e]})))return e.map((function(e){return"string"==typeof e?a[e]:e})).map((function(e){return e.id}))}},{key:"getDate",value:function(e){var t=new Date,a=60*(new Date).getTimezoneOffset(),n=60*r.timezone_offset;return t.setTime(Date.parse(e)),t.setTime(t.getTime()-1e3*(a+n)),t.getTime()/1e3}}]),t}(m)})}]);
2
  //# sourceMappingURL=gutenberg-panel.js.map
assets/js/gutenberg-panel.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/jsx/gutenberg-panel.jsx"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","wp","config","registerPlugin","PluginDocumentSettingPanel","PanelRow","DateTimePicker","CheckboxControl","SelectControl","FormTokenField","Spinner","Fragment","Component","decodeEntities","isEmpty","keys","compact","window","postExpiratorPanelConfig","plugins","editPost","components","element","htmlEntities","lodash","render","arguments","state","categoriesList","catIdVsName","postMeta","this","attributes","data","select","getEditedPostAttribute","postType","getCurrentPostType","setPostMeta","newMeta","dispatch","meta","enabled","date","Date","expireAction","getExpireType","categories","includes","getCategories","browserTimezoneOffset","getTimezoneOffset","wpTimezoneOffset","timezone_offset","setTime","default_categories","default_date","parseInt","taxonomy","defaults","setState","getTime","apiFetch","path","url","addQueryArgs","per_page","then","list","forEach","cat","id","strings","category","context","taxAttributes","rest_base","terms","term","attribute","getDate","actionsList","label","draft","delete","trash","private","stick","unstick","_","union","categoryReplace","categoryAdd","categoryRemove","selectedCats","map","title","postExpirator","icon","initialOpen","className","enablePostExpiration","checked","onChange","currentDate","is_12_hours","howToExpire","options","loading","expirationCategories","suggestions","selectCategories","maxSuggestions","typeNew","typeOld","expireType","categoriesNew","categoriesOld","length","tokens","some","token","newDate","parse"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS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AIsF,EAAgBtF,EAAS,gCAAkCA,EAAS,+BACpEuF,EAAgBvF,EAAS,6BAA+BA,EAAS,4BAAT,SAE5D,MAA6B,iBAAzB,IAAOsF,EAAP,cAAOA,KAA8BA,EAAcE,OAAS,EACrDF,GAGPC,QAA0C,IAAlBA,GAA0D,iBAAzB,IAAOA,EAAP,cAAOA,MAChEtE,WAAa,CAACsE,IAGXA,KAlQI,uCAuQEE,GAAQ,MACiBxF,KAAKJ,MAApCC,EADc,EACdA,eAMP,GAPqB,EACEC,aAED0F,EAAOC,MAAK,SAAUC,GACxC,MAAwB,iBAAVA,IAAuB7F,EAAe6F,MAWxD,OAJiBF,EAAOxB,KAAI,SAAU0B,GAClC,MAAwB,iBAAVA,EAAqB7F,EAAe6F,GAASA,KAG7C1B,KAAI,SAACzB,GAAD,OAASA,EAAIC,QAtRxB,8BAyRP5B,GACJ,IAAI+E,EAAU,IAAI9E,KACdM,EAAyD,IAAjC,IAAIN,MAAOO,oBACnCC,EAA4C,GAAzBlD,EAAOmD,gBAG9B,OAFAqE,EAAQpE,QAAQV,KAAK+E,MAAMhF,IAC3B+E,EAAQpE,QAAQoE,EAAQ7D,UAAyD,KAA5CX,EAAwBE,IACpDsE,EAAQ7D,UAAa,QA/RnB,GASgBjD","file":"gutenberg-panel.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","(function (wp, config) {\n\n const {registerPlugin} = wp.plugins;\n const {PluginDocumentSettingPanel} = wp.editPost;\n const {PanelRow, DateTimePicker, CheckboxControl, SelectControl, FormTokenField, Spinner} = wp.components;\n const {Fragment, Component} = wp.element;\n const {decodeEntities} = wp.htmlEntities;\n const {isEmpty, keys, compact} = lodash;\n\n class PostExpiratorSidebar extends Component {\n constructor() {\n super(...arguments);\n\n this.state = {\n categoriesList: [],\n catIdVsName: [],\n }\n }\n\n componentWillMount() {\n const {attributes} = this.state;\n\n const postMeta = wp.data.select('core/editor').getEditedPostAttribute('meta');\n const postType = wp.data.select('core/editor').getCurrentPostType();\n const setPostMeta = (newMeta) => wp.data.dispatch('core/editor').editPost({meta: newMeta});\n\n let enabled = false;\n let date = new Date();\n\n let expireAction = this.getExpireType(postMeta);\n\n let categories = [];\n if (expireAction.includes('category')) {\n categories = this.getCategories(postMeta);\n }\n\n if (postMeta['_expiration-date-status'] && postMeta['_expiration-date-status'] === 'saved') {\n enabled = true;\n }\n\n let browserTimezoneOffset = date.getTimezoneOffset() * 60;\n let wpTimezoneOffset = config.timezone_offset * 60;\n\n if (postMeta['_expiration-date']) {\n date.setTime((postMeta['_expiration-date'] + browserTimezoneOffset + wpTimezoneOffset) * 1000);\n } else {\n categories = config.default_categories;\n if (config.default_date) {\n date.setTime((parseInt(config.default_date) + browserTimezoneOffset + wpTimezoneOffset) * 1000);\n }\n }\n\n let taxonomy = config.defaults.taxonomy || 'category';\n\n this.setState({\n enabled: enabled,\n date: date,\n expireAction: expireAction,\n categories: categories,\n taxonomy: taxonomy,\n });\n\n // Force all the metadata to be saved. Required for making sure the default settings are stored correctly.\n setPostMeta({'_expiration-date-status': (enabled ? 'saved' : '')});\n setPostMeta({'_expiration-date': (date.getTime()) / 1000});\n setPostMeta({'_expiration-date-type': expireAction});\n setPostMeta({'_expiration-date-categories': categories});\n\n let categoriesList = [];\n let catIdVsName = [];\n\n if ((!taxonomy && postType === 'post') || taxonomy === 'category') {\n wp.apiFetch({\n path: wp.url.addQueryArgs('wp/v2/categories', {per_page: -1}),\n }).then((list) => {\n list.forEach(cat => {\n categoriesList[cat.name] = cat;\n catIdVsName[cat.id] = cat.name;\n });\n this.setState({categoriesList: categoriesList, catIdVsName: catIdVsName, taxonomy: config.strings.category});\n });\n } else if (postType !== 'page') {\n wp.apiFetch({\n path: wp.url.addQueryArgs(`wp/v2/taxonomies/${taxonomy}`, {context: 'edit'}),\n }).then((taxAttributes) => {\n // fetch all terms\n wp.apiFetch({\n path: wp.url.addQueryArgs(`wp/v2/${taxAttributes.rest_base}`, {context: 'edit'}),\n }).then((terms) => {\n terms.forEach(term => {\n categoriesList[decodeEntities(term.name)] = term;\n catIdVsName[term.id] = decodeEntities(term.name);\n });\n this.setState({\n categoriesList: categoriesList,\n catIdVsName: catIdVsName,\n taxonomy: decodeEntities(taxAttributes.name)\n });\n });\n });\n }\n\n }\n\n componentDidUpdate() {\n const {enabled, date, expireAction, categories, attribute} = this.state;\n const setPostMeta = (newMeta) => wp.data.dispatch('core/editor').editPost({meta: newMeta});\n const postMeta = wp.data.select('core/editor').getEditedPostAttribute('meta');\n\n switch (attribute) {\n case 'enabled':\n setPostMeta({'_expiration-date-status': (enabled ? 'saved' : '')});\n // if date is not set when the checkbox is enabled, set it to the default date\n // this is to prevent the user from having to click the date to set it\n if (!postMeta['_expiration-date']) {\n setPostMeta({'_expiration-date': this.getDate(date)});\n }\n break;\n case 'date':\n if (typeof date === 'string') {\n setPostMeta({'_expiration-date': this.getDate(date)});\n }\n break;\n case 'action':\n setPostMeta({'_expiration-date-type': expireAction});\n if (!expireAction.includes('category')) {\n setPostMeta({'_expiration-date-categories': []});\n }\n break;\n case 'category':\n setPostMeta({'_expiration-date-categories': categories});\n break;\n }\n\n }\n\n render() {\n const {categoriesList, catIdVsName} = this.state;\n const {enabled, date, expireAction, categories, taxonomy} = this.state;\n\n const postType = wp.data.select('core/editor').getCurrentPostType();\n\n let actionsList = [\n {label: config.strings.draft, value: 'draft'},\n {label: config.strings.delete, value: 'delete'},\n {label: config.strings.trash, value: 'trash'},\n {label: config.strings.private, value: 'private'},\n {label: config.strings.stick, value: 'stick'},\n {label: config.strings.unstick, value: 'unstick'},\n ];\n\n if (postType !== 'page') {\n actionsList = _.union(actionsList, [\n {label: config.strings.categoryReplace, value: 'category'},\n {label: config.strings.categoryAdd, value: 'category-add'},\n {label: config.strings.categoryRemove, value: 'category-remove'},\n ]);\n }\n\n let selectedCats = categories && compact(categories.map((id) => catIdVsName[id] || false));\n if (typeof selectedCats === 'string') {\n selectedCats = [];\n }\n\n return (\n <PluginDocumentSettingPanel title={config.strings.postExpirator} icon=\"calendar\"\n initialOpen={enabled} className={'post-expirator-panel'}>\n <PanelRow>\n <CheckboxControl\n label={config.strings.enablePostExpiration}\n checked={enabled}\n onChange={(value) => {\n this.setState({enabled: !enabled, attribute: 'enabled'})\n }}\n />\n </PanelRow>\n {enabled && (\n <Fragment>\n <PanelRow>\n <DateTimePicker\n currentDate={date}\n onChange={(value) => this.setState({date: value, attribute: 'date'})}\n is_12_hours={config.is_12_hours}\n />\n </PanelRow>\n <SelectControl\n label={config.strings.howToExpire}\n value={expireAction}\n options={actionsList}\n onChange={(value) => {\n this.setState({expireAction: value, attribute: 'action'})\n }}\n />\n {expireAction.includes('category') &&\n (\n (isEmpty(keys(categoriesList)) && (\n <Fragment>\n {config.strings.loading + ` (${taxonomy})`}\n <Spinner/>\n </Fragment>\n ))\n ||\n (\n <FormTokenField\n label={config.strings.expirationCategories + ` (${taxonomy})`}\n value={selectedCats}\n suggestions={Object.keys(categoriesList)}\n onChange={(value) => {\n this.setState({\n categories: this.selectCategories(value),\n attribute: 'category'\n })\n }}\n maxSuggestions={10}\n />\n )\n )}\n </Fragment>\n )}\n </PluginDocumentSettingPanel>\n );\n }\n\n // what action to take on expiration\n getExpireType(postMeta) {\n let typeNew = postMeta['_expiration-date-type'];\n let typeOld = postMeta['_expiration-date-options'] && postMeta['_expiration-date-options']['expireType'];\n\n\n\n if (typeNew) {\n return typeNew;\n }\n\n if (typeOld) {\n return typeOld;\n }\n\n if (config && config.defaults && config.defaults.expireType) {\n return config.defaults.expireType;\n }\n\n return 'draft';\n }\n\n // what categories to add/remove/replace\n getCategories(postMeta) {\n let categoriesNew = postMeta['_expiration-date-categories'] && postMeta['_expiration-date-categories'];\n let categoriesOld = postMeta['_expiration-date-options'] && postMeta['_expiration-date-options']['category'];\n\n if (typeof categoriesNew === 'object' && categoriesNew.length > 0) {\n return categoriesNew;\n }\n\n if (categoriesOld && typeof categoriesOld !== 'undefined' && typeof categoriesOld !== 'object') {\n categories = [categoriesOld];\n }\n\n return categoriesOld;\n\n }\n\n // fired for the autocomplete\n selectCategories(tokens) {\n const {categoriesList, catIdVsName} = this.state;\n\n var hasNoSuggestion = tokens.some(function (token) {\n return typeof token === 'string' && !categoriesList[token];\n });\n\n if (hasNoSuggestion) {\n return;\n }\n\n var categories = tokens.map(function (token) {\n return typeof token === 'string' ? categoriesList[token] : token;\n })\n\n return categories.map((cat) => cat.id);\n }\n\n getDate(date) {\n let newDate = new Date();\n let browserTimezoneOffset = new Date().getTimezoneOffset() * 60;\n let wpTimezoneOffset = config.timezone_offset * 60;\n newDate.setTime(Date.parse(date));\n newDate.setTime(newDate.getTime() - (browserTimezoneOffset + wpTimezoneOffset) * 1000);\n return ((newDate.getTime()) / 1000);\n }\n\n }\n\n registerPlugin('postexpirator-sidebar', {\n render: PostExpiratorSidebar\n });\n\n\n})(window.wp, window.postExpiratorPanelConfig);\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/jsx/gutenberg-panel.jsx"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","wp","config","registerPlugin","PluginDocumentSettingPanel","PanelRow","DateTimePicker","CheckboxControl","SelectControl","FormTokenField","Spinner","Fragment","Component","decodeEntities","isEmpty","keys","compact","window","postExpiratorPanelConfig","plugins","editPost","components","element","htmlEntities","lodash","render","arguments","state","categoriesList","catIdVsName","postMeta","this","attributes","data","select","getEditedPostAttribute","postType","getCurrentPostType","setPostMeta","newMeta","dispatch","meta","enabled","date","Date","expireAction","getExpireType","categories","includes","getCategories","browserTimezoneOffset","getTimezoneOffset","wpTimezoneOffset","timezone_offset","setTime","default_categories","default_date","parseInt","taxonomy","defaults","setState","getTime","apiFetch","path","url","addQueryArgs","per_page","then","list","forEach","cat","id","strings","category","context","taxAttributes","rest_base","terms","term","attribute","getDate","actionsList","label","draft","delete","trash","private","stick","unstick","_","union","categoryReplace","categoryAdd","categoryRemove","selectedCats","map","title","postExpirator","icon","initialOpen","className","enablePostExpiration","checked","onChange","currentDate","is_12_hours","howToExpire","options","loading","expirationCategories","suggestions","selectCategories","maxSuggestions","typeNew","typeOld","expireType","categoriesNew","categoriesOld","length","tokens","some","token","newDate","parse"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC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EE,GAAQ,MACiBxF,KAAKJ,MAApCC,EADc,EACdA,eAMP,GAPqB,EACEC,aAED0F,EAAOC,MAAK,SAAUC,GACxC,MAAwB,iBAAVA,IAAuB7F,EAAe6F,MAWxD,OAJiBF,EAAOxB,KAAI,SAAU0B,GAClC,MAAwB,iBAAVA,EAAqB7F,EAAe6F,GAASA,KAG7C1B,KAAI,SAACzB,GAAD,OAASA,EAAIC,QAxRxB,8BA2RP5B,GACJ,IAAI+E,EAAU,IAAI9E,KACdM,EAAyD,IAAjC,IAAIN,MAAOO,oBACnCC,EAA4C,GAAzBlD,EAAOmD,gBAG9B,OAFAqE,EAAQpE,QAAQV,KAAK+E,MAAMhF,IAC3B+E,EAAQpE,QAAQoE,EAAQ7D,UAAyD,KAA5CX,EAAwBE,IACpDsE,EAAQ7D,UAAa,QAjSnB,GASgBjD","file":"gutenberg-panel.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","(function (wp, config) {\n\n const {registerPlugin} = wp.plugins;\n const {PluginDocumentSettingPanel} = wp.editPost;\n const {PanelRow, DateTimePicker, CheckboxControl, SelectControl, FormTokenField, Spinner} = wp.components;\n const {Fragment, Component} = wp.element;\n const {decodeEntities} = wp.htmlEntities;\n const {isEmpty, keys, compact} = lodash;\n\n class PostExpiratorSidebar extends Component {\n constructor() {\n super(...arguments);\n\n this.state = {\n categoriesList: [],\n catIdVsName: [],\n }\n }\n\n componentWillMount() {\n const {attributes} = this.state;\n\n const postMeta = wp.data.select('core/editor').getEditedPostAttribute('meta');\n const postType = wp.data.select('core/editor').getCurrentPostType();\n const setPostMeta = (newMeta) => wp.data.dispatch('core/editor').editPost({meta: newMeta});\n\n let enabled = false;\n let date = new Date();\n\n let expireAction = this.getExpireType(postMeta);\n\n let categories = [];\n if (expireAction.includes('category')) {\n categories = this.getCategories(postMeta);\n }\n\n if (postMeta['_expiration-date-status'] && postMeta['_expiration-date-status'] === 'saved') {\n enabled = true;\n }\n\n let browserTimezoneOffset = date.getTimezoneOffset() * 60;\n let wpTimezoneOffset = config.timezone_offset * 60;\n\n if (postMeta['_expiration-date']) {\n date.setTime((postMeta['_expiration-date'] + browserTimezoneOffset + wpTimezoneOffset) * 1000);\n } else {\n categories = config.default_categories;\n if (config.default_date) {\n date.setTime((parseInt(config.default_date) + browserTimezoneOffset + wpTimezoneOffset) * 1000);\n }\n // If the date is not set, we\n enabled = false;\n }\n\n let taxonomy = config.defaults.taxonomy || 'category';\n\n this.setState({\n enabled: enabled,\n date: date,\n expireAction: expireAction,\n categories: categories,\n taxonomy: taxonomy,\n });\n\n // Force all the metadata to be saved. Required for making sure the default settings are stored correctly.\n setPostMeta({'_expiration-date-status': (enabled ? 'saved' : '')});\n setPostMeta({'_expiration-date': (date.getTime()) / 1000});\n setPostMeta({'_expiration-date-type': expireAction});\n setPostMeta({'_expiration-date-categories': categories});\n\n let categoriesList = [];\n let catIdVsName = [];\n\n if ((!taxonomy && postType === 'post') || taxonomy === 'category') {\n wp.apiFetch({\n path: wp.url.addQueryArgs('wp/v2/categories', {per_page: -1}),\n }).then((list) => {\n list.forEach(cat => {\n categoriesList[cat.name] = cat;\n catIdVsName[cat.id] = cat.name;\n });\n this.setState({categoriesList: categoriesList, catIdVsName: catIdVsName, taxonomy: config.strings.category});\n });\n } else if (postType !== 'page') {\n wp.apiFetch({\n path: wp.url.addQueryArgs(`wp/v2/taxonomies/${taxonomy}`, {context: 'edit'}),\n }).then((taxAttributes) => {\n // fetch all terms\n wp.apiFetch({\n path: wp.url.addQueryArgs(`wp/v2/${taxAttributes.rest_base}`, {context: 'edit'}),\n }).then((terms) => {\n terms.forEach(term => {\n categoriesList[decodeEntities(term.name)] = term;\n catIdVsName[term.id] = decodeEntities(term.name);\n });\n this.setState({\n categoriesList: categoriesList,\n catIdVsName: catIdVsName,\n taxonomy: decodeEntities(taxAttributes.name)\n });\n });\n });\n }\n\n }\n\n componentDidUpdate() {\n const {enabled, date, expireAction, categories, attribute} = this.state;\n const setPostMeta = (newMeta) => wp.data.dispatch('core/editor').editPost({meta: newMeta});\n const postMeta = wp.data.select('core/editor').getEditedPostAttribute('meta');\n\n switch (attribute) {\n case 'enabled':\n setPostMeta({'_expiration-date-status': (enabled ? 'saved' : '')});\n // if date is not set when the checkbox is enabled, set it to the default date\n // this is to prevent the user from having to click the date to set it\n if (!postMeta['_expiration-date']) {\n setPostMeta({'_expiration-date': this.getDate(date)});\n }\n break;\n case 'date':\n if (typeof date === 'string') {\n setPostMeta({'_expiration-date': this.getDate(date)});\n }\n break;\n case 'action':\n setPostMeta({'_expiration-date-type': expireAction});\n if (!expireAction.includes('category')) {\n setPostMeta({'_expiration-date-categories': []});\n }\n break;\n case 'category':\n setPostMeta({'_expiration-date-categories': categories});\n break;\n }\n\n }\n\n render() {\n const {categoriesList, catIdVsName} = this.state;\n const {enabled, date, expireAction, categories, taxonomy} = this.state;\n\n const postType = wp.data.select('core/editor').getCurrentPostType();\n\n let actionsList = [\n {label: config.strings.draft, value: 'draft'},\n {label: config.strings.delete, value: 'delete'},\n {label: config.strings.trash, value: 'trash'},\n {label: config.strings.private, value: 'private'},\n {label: config.strings.stick, value: 'stick'},\n {label: config.strings.unstick, value: 'unstick'},\n ];\n\n if (postType !== 'page') {\n actionsList = _.union(actionsList, [\n {label: config.strings.categoryReplace, value: 'category'},\n {label: config.strings.categoryAdd, value: 'category-add'},\n {label: config.strings.categoryRemove, value: 'category-remove'},\n ]);\n }\n\n let selectedCats = categories && compact(categories.map((id) => catIdVsName[id] || false));\n if (typeof selectedCats === 'string') {\n selectedCats = [];\n }\n\n return (\n <PluginDocumentSettingPanel title={config.strings.postExpirator} icon=\"calendar\"\n initialOpen={enabled} className={'post-expirator-panel'}>\n <PanelRow>\n <CheckboxControl\n label={config.strings.enablePostExpiration}\n checked={enabled}\n onChange={(value) => {\n this.setState({enabled: !enabled, attribute: 'enabled'})\n }}\n />\n </PanelRow>\n {enabled && (\n <Fragment>\n <PanelRow>\n <DateTimePicker\n currentDate={date}\n onChange={(value) => this.setState({date: value, attribute: 'date'})}\n is_12_hours={config.is_12_hours}\n />\n </PanelRow>\n <SelectControl\n label={config.strings.howToExpire}\n value={expireAction}\n options={actionsList}\n onChange={(value) => {\n this.setState({expireAction: value, attribute: 'action'})\n }}\n />\n {expireAction.includes('category') &&\n (\n (isEmpty(keys(categoriesList)) && (\n <Fragment>\n {config.strings.loading + ` (${taxonomy})`}\n <Spinner/>\n </Fragment>\n ))\n ||\n (\n <FormTokenField\n label={config.strings.expirationCategories + ` (${taxonomy})`}\n value={selectedCats}\n suggestions={Object.keys(categoriesList)}\n onChange={(value) => {\n this.setState({\n categories: this.selectCategories(value),\n attribute: 'category'\n })\n }}\n maxSuggestions={10}\n />\n )\n )}\n </Fragment>\n )}\n </PluginDocumentSettingPanel>\n );\n }\n\n // what action to take on expiration\n getExpireType(postMeta) {\n let typeNew = postMeta['_expiration-date-type'];\n let typeOld = postMeta['_expiration-date-options'] && postMeta['_expiration-date-options']['expireType'];\n\n\n\n if (typeNew) {\n return typeNew;\n }\n\n if (typeOld) {\n return typeOld;\n }\n\n if (config && config.defaults && config.defaults.expireType) {\n return config.defaults.expireType;\n }\n\n return 'draft';\n }\n\n // what categories to add/remove/replace\n getCategories(postMeta) {\n let categoriesNew = postMeta['_expiration-date-categories'] && postMeta['_expiration-date-categories'];\n let categoriesOld = postMeta['_expiration-date-options'] && postMeta['_expiration-date-options']['category'];\n\n if (typeof categoriesNew === 'object' && categoriesNew.length > 0) {\n return categoriesNew;\n }\n\n if (categoriesOld && typeof categoriesOld !== 'undefined' && typeof categoriesOld !== 'object') {\n categories = [categoriesOld];\n }\n\n return categoriesOld;\n\n }\n\n // fired for the autocomplete\n selectCategories(tokens) {\n const {categoriesList, catIdVsName} = this.state;\n\n var hasNoSuggestion = tokens.some(function (token) {\n return typeof token === 'string' && !categoriesList[token];\n });\n\n if (hasNoSuggestion) {\n return;\n }\n\n var categories = tokens.map(function (token) {\n return typeof token === 'string' ? categoriesList[token] : token;\n })\n\n return categories.map((cat) => cat.id);\n }\n\n getDate(date) {\n let newDate = new Date();\n let browserTimezoneOffset = new Date().getTimezoneOffset() * 60;\n let wpTimezoneOffset = config.timezone_offset * 60;\n newDate.setTime(Date.parse(date));\n newDate.setTime(newDate.getTime() - (browserTimezoneOffset + wpTimezoneOffset) * 1000);\n return ((newDate.getTime()) / 1000);\n }\n\n }\n\n registerPlugin('postexpirator-sidebar', {\n render: PostExpiratorSidebar\n });\n\n\n})(window.wp, window.postExpiratorPanelConfig);\n"],"sourceRoot":""}
assets/jsx/gutenberg-panel.jsx CHANGED
@@ -48,6 +48,9 @@
48
  if (config.default_date) {
49
  date.setTime((parseInt(config.default_date) + browserTimezoneOffset + wpTimezoneOffset) * 1000);
50
  }
 
 
 
51
  }
52
 
53
  let taxonomy = config.defaults.taxonomy || 'category';
48
  if (config.default_date) {
49
  date.setTime((parseInt(config.default_date) + browserTimezoneOffset + wpTimezoneOffset) * 1000);
50
  }
51
+
52
+ // If the date is not set
53
+ enabled = false;
54
  }
55
 
56
  let taxonomy = config.defaults.taxonomy || 'category';
classes/CronFacade.class.php CHANGED
@@ -49,27 +49,13 @@ class PostExpirator_CronFacade
49
  {
50
  $events = self::get_plugin_cron_events();
51
 
52
- foreach ($events as $time => $value) {
53
- foreach ($value as $eventkey => $eventvalue) {
54
- $arrkey = array_keys($eventvalue);
55
- $firstArgsUid = null;
56
 
57
- foreach ($arrkey as $eventguid) {
58
- if (is_null($firstArgsUid)) {
59
- $firstArgsUid = $eventguid;
60
- }
61
- }
62
-
63
- if (
64
- isset($eventvalue[$firstArgsUid])
65
- && isset($eventvalue[$firstArgsUid]['args'])
66
- && isset($eventvalue[$firstArgsUid]['args'][0])
67
- && ! empty($eventvalue[$firstArgsUid]['args'][0])
68
- ) {
69
- $post = get_post((int)$eventvalue[$firstArgsUid]['args'][0]);
70
-
71
- if (! empty($post) && ! is_wp_error($post) && is_object($post)) {
72
- if ($post->ID === $post_id) {
73
  return true;
74
  }
75
  }
49
  {
50
  $events = self::get_plugin_cron_events();
51
 
52
+ foreach ($events as $event) {
53
+ foreach ($event as $eventValue) {
54
+ $eventValueKeys = array_keys($eventValue);
 
55
 
56
+ foreach ($eventValueKeys as $eventGUID) {
57
+ if (! empty($eventValue[$eventGUID]['args'])) {
58
+ if ((int)$eventValue[$eventGUID]['args'][0] === (int)$post_id) {
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  return true;
60
  }
61
  }
classes/Display.class.php CHANGED
@@ -11,16 +11,12 @@ class PostExpirator_Display
11
  */
12
  private static $instance = null;
13
 
14
- private $renamingWarningInstance = null;
15
-
16
  /**
17
  * Constructor.
18
  */
19
  private function __construct()
20
  {
21
  $this->hooks();
22
-
23
- $this->renamingWarningInstance = new PostExpirator_RenamingWarning();
24
  }
25
 
26
  /**
@@ -46,7 +42,6 @@ class PostExpirator_Display
46
 
47
  public function init()
48
  {
49
- $this->renamingWarningInstance->init();
50
  }
51
 
52
  /**
@@ -88,7 +83,7 @@ class PostExpirator_Display
88
  PostExpirator_Facade::load_assets('settings');
89
 
90
  $allowed_tabs = array('general', 'defaults', 'display', 'editor', 'diagnostics', 'viewdebug', 'advanced');
91
- $tab = isset($_GET['tab']) ? $_GET['tab'] : '';
92
  if (empty($tab) || ! in_array($tab, $allowed_tabs, true)) {
93
  $tab = 'general';
94
  }
@@ -113,17 +108,15 @@ class PostExpirator_Display
113
  */
114
  private function menu_editor()
115
  {
116
- if (isset($_POST['expirationdateSaveEditor']) && $_POST['expirationdateSaveEditor']) {
117
  if (! isset($_POST['_postExpiratorMenuEditor_nonce']) || ! wp_verify_nonce(
118
- $_POST['_postExpiratorMenuEditor_nonce'],
119
  'postexpirator_menu_editor'
120
  )) {
121
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
122
  exit;
123
  } else {
124
- // Filter Content
125
- $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
126
- update_option('expirationdateGutenbergSupport', $_POST['gutenberg-support']);
127
  }
128
  }
129
 
@@ -135,9 +128,9 @@ class PostExpirator_Display
135
  */
136
  private function menu_display()
137
  {
138
- if (isset($_POST['expirationdateSaveDisplay']) && $_POST['expirationdateSaveDisplay']) {
139
  if (! isset($_POST['_postExpiratorMenuDisplay_nonce']) || ! wp_verify_nonce(
140
- $_POST['_postExpiratorMenuDisplay_nonce'],
141
  'postexpirator_menu_display'
142
  )) {
143
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
@@ -146,9 +139,11 @@ class PostExpirator_Display
146
  // Filter Content
147
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
148
 
 
149
  update_option('expirationdateDisplayFooter', $_POST['expired-display-footer']);
150
  update_option('expirationdateFooterContents', $_POST['expired-footer-contents']);
151
  update_option('expirationdateFooterStyle', $_POST['expired-footer-style']);
 
152
  }
153
  }
154
 
@@ -162,7 +157,7 @@ class PostExpirator_Display
162
  {
163
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
164
  if (! isset($_POST['_postExpiratorMenuDiagnostics_nonce']) || ! wp_verify_nonce(
165
- $_POST['_postExpiratorMenuDiagnostics_nonce'],
166
  'postexpirator_menu_diagnostics'
167
  )) {
168
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
@@ -218,7 +213,7 @@ class PostExpirator_Display
218
 
219
  if (isset($_POST['expirationdateSaveDefaults'])) {
220
  if (! isset($_POST['_postExpiratorMenuDefaults_nonce']) || ! wp_verify_nonce(
221
- $_POST['_postExpiratorMenuDefaults_nonce'],
222
  'postexpirator_menu_defaults'
223
  )) {
224
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
@@ -227,31 +222,33 @@ class PostExpirator_Display
227
  // Filter Content
228
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
229
 
 
230
  foreach ($types as $type) {
231
  if (isset($_POST['expirationdate_expiretype-' . $type])) {
232
- $defaults[$type]['expireType'] = $_POST['expirationdate_expiretype-' . $type];
233
  }
234
  if (isset($_POST['expirationdate_autoenable-' . $type])) {
235
  $defaults[$type]['autoEnable'] = intval($_POST['expirationdate_autoenable-' . $type]);
236
  }
237
  if (isset($_POST['expirationdate_taxonomy-' . $type])) {
238
- $defaults[$type]['taxonomy'] = $_POST['expirationdate_taxonomy-' . $type];
239
  }
240
  if (isset($_POST['expirationdate_activemeta-' . $type])) {
241
- $defaults[$type]['activeMetaBox'] = $_POST['expirationdate_activemeta-' . $type];
242
  }
243
- $defaults[$type]['emailnotification'] = trim($_POST['expirationdate_emailnotification-' . $type]);
244
 
245
  if (isset($_POST['expired-default-date-' . $type])) {
246
- $defaults[$type]['default-expire-type'] = $_POST['expired-default-date-' . $type];
247
  }
248
  if (isset($_POST['expired-custom-date-' . $type])) {
249
- $defaults[$type]['default-custom-date'] = $_POST['expired-custom-date-' . $type];
250
  }
251
 
252
  // Save Settings
253
  update_option('expirationdateDefaults' . ucfirst($type), $defaults[$type]);
254
  }
 
255
  echo "<div id='message' class='updated fade'><p>";
256
  _e('Saved Options!', 'post-expirator');
257
  echo '</p></div>';
@@ -266,10 +263,10 @@ class PostExpirator_Display
266
  */
267
  private function menu_general()
268
  {
269
- if (isset($_POST['expirationdateSave']) && $_POST['expirationdateSave']) {
270
  if (
271
  ! isset($_POST['_postExpiratorMenuGeneral_nonce']) || ! wp_verify_nonce(
272
- $_POST['_postExpiratorMenuGeneral_nonce'],
273
  'postexpirator_menu_general'
274
  )
275
  ) {
@@ -279,18 +276,18 @@ class PostExpirator_Display
279
  // Filter Content
280
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
281
 
282
- update_option('expirationdateDefaultDateFormat', $_POST['expired-default-date-format']);
283
- update_option('expirationdateDefaultTimeFormat', $_POST['expired-default-time-format']);
284
- update_option('expirationdateEmailNotification', $_POST['expired-email-notification']);
285
- update_option('expirationdateEmailNotificationAdmins', $_POST['expired-email-notification-admins']);
286
- update_option('expirationdateEmailNotificationList', trim($_POST['expired-email-notification-list']));
287
  update_option(
288
  'expirationdateCategoryDefaults',
289
- isset($_POST['expirationdate_category']) ? $_POST['expirationdate_category'] : array()
290
  );
291
- update_option('expirationdateDefaultDate', $_POST['expired-default-expiration-date']);
292
- if ($_POST['expired-custom-expiration-date']) {
293
- update_option('expirationdateDefaultDateCustom', $_POST['expired-custom-expiration-date']);
294
  }
295
 
296
  if (! isset($_POST['allow-user-roles']) || ! is_array($_POST['allow-user-roles'])) {
@@ -328,10 +325,10 @@ class PostExpirator_Display
328
  */
329
  private function menu_advanced()
330
  {
331
- if (isset($_POST['expirationdateSave']) && $_POST['expirationdateSave']) {
332
  if (
333
  ! isset($_POST['_postExpiratorMenuAdvanced_nonce']) || ! wp_verify_nonce(
334
- $_POST['_postExpiratorMenuAdvanced_nonce'],
335
  'postexpirator_menu_advanced'
336
  )
337
  ) {
@@ -341,7 +338,7 @@ class PostExpirator_Display
341
  // Filter Content
342
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
343
 
344
- update_option('expirationdateGutenbergSupport', $_POST['gutenberg-support']);
345
  update_option('expirationdatePreserveData', (int)$_POST['expired-preserve-data-deactivating']);
346
 
347
  if (! isset($_POST['allow-user-roles']) || ! is_array($_POST['allow-user-roles'])) {
11
  */
12
  private static $instance = null;
13
 
 
 
14
  /**
15
  * Constructor.
16
  */
17
  private function __construct()
18
  {
19
  $this->hooks();
 
 
20
  }
21
 
22
  /**
42
 
43
  public function init()
44
  {
 
45
  }
46
 
47
  /**
83
  PostExpirator_Facade::load_assets('settings');
84
 
85
  $allowed_tabs = array('general', 'defaults', 'display', 'editor', 'diagnostics', 'viewdebug', 'advanced');
86
+ $tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : '';
87
  if (empty($tab) || ! in_array($tab, $allowed_tabs, true)) {
88
  $tab = 'general';
89
  }
108
  */
109
  private function menu_editor()
110
  {
111
+ if (isset($_POST['expirationdateSaveEditor']) && sanitize_key($_POST['expirationdateSaveEditor'])) {
112
  if (! isset($_POST['_postExpiratorMenuEditor_nonce']) || ! wp_verify_nonce(
113
+ sanitize_key($_POST['_postExpiratorMenuEditor_nonce']),
114
  'postexpirator_menu_editor'
115
  )) {
116
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
117
  exit;
118
  } else {
119
+ update_option('expirationdateGutenbergSupport', sanitize_text_field($_POST['gutenberg-support']));
 
 
120
  }
121
  }
122
 
128
  */
129
  private function menu_display()
130
  {
131
+ if (isset($_POST['expirationdateSaveDisplay']) && sanitize_key($_POST['expirationdateSaveDisplay'])) {
132
  if (! isset($_POST['_postExpiratorMenuDisplay_nonce']) || ! wp_verify_nonce(
133
+ sanitize_key($_POST['_postExpiratorMenuDisplay_nonce']),
134
  'postexpirator_menu_display'
135
  )) {
136
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
139
  // Filter Content
140
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
141
 
142
+ // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
143
  update_option('expirationdateDisplayFooter', $_POST['expired-display-footer']);
144
  update_option('expirationdateFooterContents', $_POST['expired-footer-contents']);
145
  update_option('expirationdateFooterStyle', $_POST['expired-footer-style']);
146
+ // phpcs:enable
147
  }
148
  }
149
 
157
  {
158
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
159
  if (! isset($_POST['_postExpiratorMenuDiagnostics_nonce']) || ! wp_verify_nonce(
160
+ sanitize_key($_POST['_postExpiratorMenuDiagnostics_nonce']),
161
  'postexpirator_menu_diagnostics'
162
  )) {
163
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
213
 
214
  if (isset($_POST['expirationdateSaveDefaults'])) {
215
  if (! isset($_POST['_postExpiratorMenuDefaults_nonce']) || ! wp_verify_nonce(
216
+ sanitize_key($_POST['_postExpiratorMenuDefaults_nonce']),
217
  'postexpirator_menu_defaults'
218
  )) {
219
  print 'Form Validation Failure: Sorry, your nonce did not verify.';
222
  // Filter Content
223
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
224
 
225
+ // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
226
  foreach ($types as $type) {
227
  if (isset($_POST['expirationdate_expiretype-' . $type])) {
228
+ $defaults[$type]['expireType'] = sanitize_key($_POST['expirationdate_expiretype-' . $type]);
229
  }
230
  if (isset($_POST['expirationdate_autoenable-' . $type])) {
231
  $defaults[$type]['autoEnable'] = intval($_POST['expirationdate_autoenable-' . $type]);
232
  }
233
  if (isset($_POST['expirationdate_taxonomy-' . $type])) {
234
+ $defaults[$type]['taxonomy'] = sanitize_text_field($_POST['expirationdate_taxonomy-' . $type]);
235
  }
236
  if (isset($_POST['expirationdate_activemeta-' . $type])) {
237
+ $defaults[$type]['activeMetaBox'] = sanitize_text_field($_POST['expirationdate_activemeta-' . $type]);
238
  }
239
+ $defaults[$type]['emailnotification'] = trim(sanitize_text_field($_POST['expirationdate_emailnotification-' . $type]));
240
 
241
  if (isset($_POST['expired-default-date-' . $type])) {
242
+ $defaults[$type]['default-expire-type'] = sanitize_text_field($_POST['expired-default-date-' . $type]);
243
  }
244
  if (isset($_POST['expired-custom-date-' . $type])) {
245
+ $defaults[$type]['default-custom-date'] = sanitize_text_field($_POST['expired-custom-date-' . $type]);
246
  }
247
 
248
  // Save Settings
249
  update_option('expirationdateDefaults' . ucfirst($type), $defaults[$type]);
250
  }
251
+ // phpcs:enable
252
  echo "<div id='message' class='updated fade'><p>";
253
  _e('Saved Options!', 'post-expirator');
254
  echo '</p></div>';
263
  */
264
  private function menu_general()
265
  {
266
+ if (isset($_POST['expirationdateSave']) && ! empty($_POST['expirationdateSave'])) {
267
  if (
268
  ! isset($_POST['_postExpiratorMenuGeneral_nonce']) || ! wp_verify_nonce(
269
+ sanitize_key($_POST['_postExpiratorMenuGeneral_nonce']),
270
  'postexpirator_menu_general'
271
  )
272
  ) {
276
  // Filter Content
277
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
278
 
279
+ update_option('expirationdateDefaultDateFormat', sanitize_text_field($_POST['expired-default-date-format']));
280
+ update_option('expirationdateDefaultTimeFormat', sanitize_text_field($_POST['expired-default-time-format']));
281
+ update_option('expirationdateEmailNotification', sanitize_text_field($_POST['expired-email-notification']));
282
+ update_option('expirationdateEmailNotificationAdmins', sanitize_text_field($_POST['expired-email-notification-admins']));
283
+ update_option('expirationdateEmailNotificationList', trim(sanitize_text_field($_POST['expired-email-notification-list'])));
284
  update_option(
285
  'expirationdateCategoryDefaults',
286
+ isset($_POST['expirationdate_category']) ? sanitize_text_field($_POST['expirationdate_category']) : array()
287
  );
288
+ update_option('expirationdateDefaultDate', sanitize_text_field($_POST['expired-default-expiration-date']));
289
+ if (!empty($_POST['expired-custom-expiration-date'])) {
290
+ update_option('expirationdateDefaultDateCustom', sanitize_text_field($_POST['expired-custom-expiration-date']));
291
  }
292
 
293
  if (! isset($_POST['allow-user-roles']) || ! is_array($_POST['allow-user-roles'])) {
325
  */
326
  private function menu_advanced()
327
  {
328
+ if (isset($_POST['expirationdateSave']) && ! empty($_POST['expirationdateSave'])) {
329
  if (
330
  ! isset($_POST['_postExpiratorMenuAdvanced_nonce']) || ! wp_verify_nonce(
331
+ sanitize_key($_POST['_postExpiratorMenuAdvanced_nonce']),
332
  'postexpirator_menu_advanced'
333
  )
334
  ) {
338
  // Filter Content
339
  $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
340
 
341
+ update_option('expirationdateGutenbergSupport', sanitize_text_field($_POST['gutenberg-support']));
342
  update_option('expirationdatePreserveData', (int)$_POST['expired-preserve-data-deactivating']);
343
 
344
  if (! isset($_POST['allow-user-roles']) || ! is_array($_POST['allow-user-roles'])) {
classes/Facade.class.php CHANGED
@@ -179,14 +179,13 @@ class PostExpirator_Facade
179
  }
180
 
181
  /**
182
- * Get the expire type, categories etc.
183
  *
184
  * Keeps in mind the old (classic editor) and new (gutenberg) structure.
185
  */
186
  public static function get_expire_principles($id)
187
  {
188
  $expireType = $categories = $taxonomyName = $expireStatus = '';
189
-
190
  $expireTypeNew = get_post_meta($id, '_expiration-date-type', true);
191
  if (! empty($expireTypeNew)) {
192
  $expireType = $expireTypeNew;
@@ -224,7 +223,7 @@ class PostExpirator_Facade
224
  'expireType' => $expireType,
225
  'category' => $categories,
226
  'categoryTaxonomy' => $taxonomyName,
227
- 'enabled' => $expireStatus === 'saved',
228
  );
229
  }
230
 
@@ -523,6 +522,9 @@ class PostExpirator_Facade
523
 
524
  public static function is_expiration_enabled_for_post($post_id)
525
  {
526
- return get_post_meta($post_id, '_expiration-date-status', true) === 'saved';
 
 
 
527
  }
528
  }
179
  }
180
 
181
  /**
182
+ * Get the expiry type, categories etc.
183
  *
184
  * Keeps in mind the old (classic editor) and new (gutenberg) structure.
185
  */
186
  public static function get_expire_principles($id)
187
  {
188
  $expireType = $categories = $taxonomyName = $expireStatus = '';
 
189
  $expireTypeNew = get_post_meta($id, '_expiration-date-type', true);
190
  if (! empty($expireTypeNew)) {
191
  $expireType = $expireTypeNew;
223
  'expireType' => $expireType,
224
  'category' => $categories,
225
  'categoryTaxonomy' => $taxonomyName,
226
+ 'enabled' => self::is_expiration_enabled_for_post($id),
227
  );
228
  }
229
 
522
 
523
  public static function is_expiration_enabled_for_post($post_id)
524
  {
525
+ $statusEnabled = get_post_meta($post_id, '_expiration-date-status', true) === 'saved';
526
+ $date = (int)get_post_meta($post_id, '_expiration-date', true);
527
+
528
+ return $statusEnabled && false === empty($date);
529
  }
530
  }
classes/RenamingWarning.class.php DELETED
@@ -1,239 +0,0 @@
1
- <?php
2
-
3
- use PublishPress\WordPressReviews\ReviewsController;
4
-
5
- /**
6
- * WordPress reviews functions.
7
- */
8
- class PostExpirator_RenamingWarning
9
- {
10
- private $pluginSlug = 'post-expirator';
11
-
12
- private $iconUrl = '';
13
-
14
- private $pluginName = 'PublishPress Future';
15
-
16
- private $nonceAction = 'publishpress-future-dismiss-naming-notice';
17
-
18
- private $metaDismissed = 'publishpress-future-naming-notice-dismiss';
19
-
20
- public function init()
21
- {
22
- $this->iconUrl = POSTEXPIRATOR_BASEURL . 'assets/images/publishpress-future-256.png';
23
-
24
- $this->addHooks();
25
- }
26
-
27
- /**
28
- * Hook into relevant WP actions.
29
- */
30
- private function addHooks()
31
- {
32
- if (defined('DOING_AJAX') && DOING_AJAX) {
33
- add_action("wp_ajax_publishpress-future-naming-notice-dismiss", [$this, 'ajaxHandler']);
34
- }
35
-
36
- if ($this->showTheNotice()) {
37
- add_action('admin_notices', [$this, 'renderAdminNotices']);
38
- add_action('network_admin_notices', [$this, 'renderAdminNotices']);
39
- add_action('user_admin_notices', [$this, 'renderAdminNotices']);
40
-
41
- add_action('admin_enqueue_scripts', [$this, 'enqueueStyle']);
42
- }
43
- }
44
-
45
- /**
46
- * @return bool
47
- */
48
- private function showTheNotice()
49
- {
50
- if (!is_admin() || !$this->currentUserIsAdministrator()) {
51
- return false;
52
- }
53
-
54
- global $pagenow;
55
-
56
- if ($pagenow === 'admin.php' && isset($_GET['page'])) {
57
- if ($_GET['page'] === 'publishpress-future') {
58
- return true;
59
- }
60
- }
61
-
62
- return false;
63
- }
64
-
65
- private function currentUserIsAdministrator()
66
- {
67
- $currentUser = get_current_user_id();
68
- $currentUser = get_user_by('ID', $currentUser);
69
-
70
- if (empty($currentUser) || ! is_object($currentUser) && is_wp_error($currentUser)) {
71
- return false;
72
- }
73
-
74
- return in_array('administrator', $currentUser->roles);
75
- }
76
-
77
- /**
78
- * Render admin notices if available.
79
- */
80
- public function renderAdminNotices()
81
- {
82
- if ($this->hideNotices()) {
83
- return;
84
- }
85
-
86
- // Used to anonymously distinguish unique site+user combinations in terms of effectiveness of each trigger.
87
- $uuid = wp_hash(home_url() . '-' . get_current_user_id());
88
- ?>
89
-
90
- <script type="text/javascript">
91
- (function ($) {
92
- function dismiss(reason) {
93
- $.ajax({
94
- method: "POST",
95
- dataType: "json",
96
- url: ajaxurl,
97
- data: {
98
- action: 'publishpress-future-naming-notice-dismiss',
99
- nonce: '<?php echo esc_attr(wp_create_nonce($this->nonceAction)); ?>',
100
- reason: reason
101
- }
102
- });
103
- }
104
-
105
- $(document)
106
- .on('click', '.<?php echo esc_attr($this->pluginSlug); ?>-naming-notice .<?php echo esc_attr("$this->pluginSlug-dismiss"); ?>', function (event) {
107
- var $this = $(this),
108
- reason = $this.data('reason'),
109
- notice = $this.parents('.<?php echo esc_attr($this->pluginSlug); ?>-naming-notice');
110
-
111
- notice.fadeTo(100, 0, function () {
112
- notice.slideUp(100, function () {
113
- notice.remove();
114
- });
115
- });
116
-
117
- dismiss(reason);
118
- })
119
- .ready(function () {
120
- setTimeout(function () {
121
- $('.<?php echo esc_attr($this->pluginSlug); ?>-naming-notice button.notice-dismiss').click(function (event) {
122
- dismiss('acknowledge');
123
- });
124
- }, 1000);
125
- });
126
- }(jQuery));
127
- </script>
128
-
129
- <div class="notice notice-success is-dismissible <?php
130
- echo esc_attr("$this->pluginSlug-naming-notice"); ?>">
131
- <?php
132
- if (! empty($this->iconUrl)) : ?>
133
- <img src="<?php
134
- echo esc_url($this->iconUrl); ?>" class="notice-icon" alt="<?php
135
- echo esc_attr($this->pluginName); ?> logo"/>
136
- <?php
137
- endif; ?>
138
-
139
- <p><?php echo sprintf(
140
- esc_html__('Thanks for using Post Expirator. This plugin has a new name: "PublishPress Future". Nothing else has changed with the plugin. If you have any questions, please %sclick this link and talk with us%s.', 'post-expirator'),
141
- '<a href="mailto:help@publishpress.com">',
142
- '</a>'
143
- ); ?></p>
144
-
145
- <a href="#" class="button <?php echo esc_attr("$this->pluginSlug-dismiss"); ?>" data-reason="maybe_later">
146
- <?php esc_html_e('Dismiss', $this->pluginSlug); ?>
147
- </a>
148
- </div>
149
- <?php
150
- }
151
-
152
- /**
153
- * Checks if notices should be shown.
154
- *
155
- * @return bool
156
- */
157
- private function hideNotices()
158
- {
159
- $dismissMeta = (int)get_user_meta(get_current_user_id(), $this->metaDismissed, true);
160
- $conditions = [
161
- $dismissMeta === 1,
162
- ];
163
-
164
- return in_array(true, $conditions);
165
- }
166
-
167
- public function enqueueStyle()
168
- {
169
- wp_register_style('publishpress-future-naming-notice', false);
170
- wp_enqueue_style('publishpress-future-naming-notice');
171
- wp_add_inline_style(
172
- 'publishpress-future-naming-notice',
173
- "
174
- .{$this->pluginSlug}-naming-notice {
175
- min-height: 90px;
176
- }
177
-
178
- .{$this->pluginSlug}-naming-notice .button,
179
- .{$this->pluginSlug}-naming-notice p {
180
- font-size: 15px;
181
- }
182
-
183
- .{$this->pluginSlug}-naming-notice .button:not(.notice-dismiss) {
184
- border-width: 1px;
185
- }
186
-
187
- .{$this->pluginSlug}-naming-notice .button.button-primary {
188
- background-color: #655897;
189
- border-color: #3d355c;
190
- color: #fff;
191
- }
192
-
193
- .{$this->pluginSlug}-naming-notice .notice-icon {
194
- float: right;
195
- height: 70px;
196
- margin-top: 10px;
197
- margin-left: 10px;
198
- }
199
-
200
- @media (max-width:1700px) {
201
- .{$this->pluginSlug}-naming-notice {
202
- min-height: 110px;
203
- }
204
-
205
- .{$this->pluginSlug}-naming-notice .notice-icon {
206
- height: 90px;
207
- }
208
- }
209
-
210
- @media (max-width:1000px) {
211
- .{$this->pluginSlug}-naming-notice .notice-icon {
212
- height: 70px;
213
- min-height: 90px;
214
- }
215
- }
216
- "
217
- );
218
- }
219
-
220
- /**
221
- * The function called by the ajax request.
222
- */
223
- public function ajaxHandler()
224
- {
225
- if (! wp_verify_nonce($_REQUEST['nonce'], $this->nonceAction)) {
226
- wp_send_json_error();
227
- }
228
-
229
- try {
230
- $userId = get_current_user_id();
231
-
232
- update_user_meta($userId, $this->metaDismissed, 1);
233
-
234
- wp_send_json_success();
235
- } catch (Exception $e) {
236
- wp_send_json_error($e);
237
- }
238
- }
239
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
composer.lock CHANGED
@@ -244,16 +244,16 @@
244
  },
245
  {
246
  "name": "antecedent/patchwork",
247
- "version": "2.1.17",
248
  "source": {
249
  "type": "git",
250
  "url": "https://github.com/antecedent/patchwork.git",
251
- "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0"
252
  },
253
  "dist": {
254
  "type": "zip",
255
- "url": "https://api.github.com/repos/antecedent/patchwork/zipball/df5aba175a44c2996ced4edf8ec9f9081b5348c0",
256
- "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0",
257
  "shasum": ""
258
  },
259
  "require": {
@@ -286,9 +286,9 @@
286
  ],
287
  "support": {
288
  "issues": "https://github.com/antecedent/patchwork/issues",
289
- "source": "https://github.com/antecedent/patchwork/tree/2.1.17"
290
  },
291
- "time": "2021-10-21T14:22:43+00:00"
292
  },
293
  {
294
  "name": "behat/gherkin",
@@ -411,16 +411,16 @@
411
  },
412
  {
413
  "name": "codeception/codeception",
414
- "version": "4.1.27",
415
  "source": {
416
  "type": "git",
417
  "url": "https://github.com/Codeception/Codeception.git",
418
- "reference": "2d9a11e6f487e3bcc17e22b7552fb6a10cec5c7c"
419
  },
420
  "dist": {
421
  "type": "zip",
422
- "url": "https://api.github.com/repos/Codeception/Codeception/zipball/2d9a11e6f487e3bcc17e22b7552fb6a10cec5c7c",
423
- "reference": "2d9a11e6f487e3bcc17e22b7552fb6a10cec5c7c",
424
  "shasum": ""
425
  },
426
  "require": {
@@ -497,7 +497,7 @@
497
  ],
498
  "support": {
499
  "issues": "https://github.com/Codeception/Codeception/issues",
500
- "source": "https://github.com/Codeception/Codeception/tree/4.1.27"
501
  },
502
  "funding": [
503
  {
@@ -505,7 +505,7 @@
505
  "type": "open_collective"
506
  }
507
  ],
508
- "time": "2021-12-22T06:40:46+00:00"
509
  },
510
  {
511
  "name": "codeception/lib-asserts",
@@ -1094,16 +1094,16 @@
1094
  },
1095
  {
1096
  "name": "codeception/stub",
1097
- "version": "4.0.0",
1098
  "source": {
1099
  "type": "git",
1100
  "url": "https://github.com/Codeception/Stub.git",
1101
- "reference": "4c9cf3e19bd5f064e08e7f3ba6be651c218dc6ae"
1102
  },
1103
  "dist": {
1104
  "type": "zip",
1105
- "url": "https://api.github.com/repos/Codeception/Stub/zipball/4c9cf3e19bd5f064e08e7f3ba6be651c218dc6ae",
1106
- "reference": "4c9cf3e19bd5f064e08e7f3ba6be651c218dc6ae",
1107
  "shasum": ""
1108
  },
1109
  "require": {
@@ -1126,9 +1126,9 @@
1126
  "description": "Flexible Stub wrapper for PHPUnit's Mock Builder",
1127
  "support": {
1128
  "issues": "https://github.com/Codeception/Stub/issues",
1129
- "source": "https://github.com/Codeception/Stub/tree/4.0.0"
1130
  },
1131
- "time": "2021-12-07T14:39:17+00:00"
1132
  },
1133
  {
1134
  "name": "codeception/util-universalframework",
@@ -1169,16 +1169,16 @@
1169
  },
1170
  {
1171
  "name": "composer/package-versions-deprecated",
1172
- "version": "1.11.99.4",
1173
  "source": {
1174
  "type": "git",
1175
  "url": "https://github.com/composer/package-versions-deprecated.git",
1176
- "reference": "b174585d1fe49ceed21928a945138948cb394600"
1177
  },
1178
  "dist": {
1179
  "type": "zip",
1180
- "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600",
1181
- "reference": "b174585d1fe49ceed21928a945138948cb394600",
1182
  "shasum": ""
1183
  },
1184
  "require": {
@@ -1222,7 +1222,7 @@
1222
  "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
1223
  "support": {
1224
  "issues": "https://github.com/composer/package-versions-deprecated/issues",
1225
- "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4"
1226
  },
1227
  "funding": [
1228
  {
@@ -1238,27 +1238,27 @@
1238
  "type": "tidelift"
1239
  }
1240
  ],
1241
- "time": "2021-09-13T08:41:34+00:00"
1242
  },
1243
  {
1244
  "name": "composer/pcre",
1245
- "version": "1.0.0",
1246
  "source": {
1247
  "type": "git",
1248
  "url": "https://github.com/composer/pcre.git",
1249
- "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2"
1250
  },
1251
  "dist": {
1252
  "type": "zip",
1253
- "url": "https://api.github.com/repos/composer/pcre/zipball/3d322d715c43a1ac36c7fe215fa59336265500f2",
1254
- "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2",
1255
  "shasum": ""
1256
  },
1257
  "require": {
1258
  "php": "^5.3.2 || ^7.0 || ^8.0"
1259
  },
1260
  "require-dev": {
1261
- "phpstan/phpstan": "^1",
1262
  "phpstan/phpstan-strict-rules": "^1.1",
1263
  "symfony/phpunit-bridge": "^4.2 || ^5"
1264
  },
@@ -1293,7 +1293,7 @@
1293
  ],
1294
  "support": {
1295
  "issues": "https://github.com/composer/pcre/issues",
1296
- "source": "https://github.com/composer/pcre/tree/1.0.0"
1297
  },
1298
  "funding": [
1299
  {
@@ -1309,7 +1309,7 @@
1309
  "type": "tidelift"
1310
  }
1311
  ],
1312
- "time": "2021-12-06T15:17:27+00:00"
1313
  },
1314
  {
1315
  "name": "composer/semver",
@@ -2286,32 +2286,28 @@
2286
  },
2287
  {
2288
  "name": "doctrine/lexer",
2289
- "version": "1.2.1",
2290
  "source": {
2291
  "type": "git",
2292
  "url": "https://github.com/doctrine/lexer.git",
2293
- "reference": "e864bbf5904cb8f5bb334f99209b48018522f042"
2294
  },
2295
  "dist": {
2296
  "type": "zip",
2297
- "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042",
2298
- "reference": "e864bbf5904cb8f5bb334f99209b48018522f042",
2299
  "shasum": ""
2300
  },
2301
  "require": {
2302
- "php": "^7.2 || ^8.0"
2303
  },
2304
  "require-dev": {
2305
- "doctrine/coding-standard": "^6.0",
2306
- "phpstan/phpstan": "^0.11.8",
2307
- "phpunit/phpunit": "^8.2"
 
2308
  },
2309
  "type": "library",
2310
- "extra": {
2311
- "branch-alias": {
2312
- "dev-master": "1.2.x-dev"
2313
- }
2314
- },
2315
  "autoload": {
2316
  "psr-4": {
2317
  "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
@@ -2346,7 +2342,7 @@
2346
  ],
2347
  "support": {
2348
  "issues": "https://github.com/doctrine/lexer/issues",
2349
- "source": "https://github.com/doctrine/lexer/tree/1.2.1"
2350
  },
2351
  "funding": [
2352
  {
@@ -2362,7 +2358,7 @@
2362
  "type": "tidelift"
2363
  }
2364
  ],
2365
- "time": "2020-05-25T17:44:05+00:00"
2366
  },
2367
  {
2368
  "name": "felixfbecker/advanced-json-rpc",
@@ -3085,16 +3081,16 @@
3085
  },
3086
  {
3087
  "name": "illuminate/collections",
3088
- "version": "v8.78.1",
3089
  "source": {
3090
  "type": "git",
3091
  "url": "https://github.com/illuminate/collections.git",
3092
- "reference": "e8c1cbd7a4cc8fb0e6a8978a55ef6d49c90bea59"
3093
  },
3094
  "dist": {
3095
  "type": "zip",
3096
- "url": "https://api.github.com/repos/illuminate/collections/zipball/e8c1cbd7a4cc8fb0e6a8978a55ef6d49c90bea59",
3097
- "reference": "e8c1cbd7a4cc8fb0e6a8978a55ef6d49c90bea59",
3098
  "shasum": ""
3099
  },
3100
  "require": {
@@ -3135,20 +3131,20 @@
3135
  "issues": "https://github.com/laravel/framework/issues",
3136
  "source": "https://github.com/laravel/framework"
3137
  },
3138
- "time": "2022-01-04T18:54:15+00:00"
3139
  },
3140
  {
3141
  "name": "illuminate/contracts",
3142
- "version": "v8.78.1",
3143
  "source": {
3144
  "type": "git",
3145
  "url": "https://github.com/illuminate/contracts.git",
3146
- "reference": "9baa9f781071e67d7b171775bd3be7ead13ddd29"
3147
  },
3148
  "dist": {
3149
  "type": "zip",
3150
- "url": "https://api.github.com/repos/illuminate/contracts/zipball/9baa9f781071e67d7b171775bd3be7ead13ddd29",
3151
- "reference": "9baa9f781071e67d7b171775bd3be7ead13ddd29",
3152
  "shasum": ""
3153
  },
3154
  "require": {
@@ -3183,11 +3179,11 @@
3183
  "issues": "https://github.com/laravel/framework/issues",
3184
  "source": "https://github.com/laravel/framework"
3185
  },
3186
- "time": "2021-12-14T14:40:44+00:00"
3187
  },
3188
  {
3189
  "name": "illuminate/macroable",
3190
- "version": "v8.78.1",
3191
  "source": {
3192
  "type": "git",
3193
  "url": "https://github.com/illuminate/macroable.git",
@@ -3233,16 +3229,16 @@
3233
  },
3234
  {
3235
  "name": "illuminate/support",
3236
- "version": "v8.78.1",
3237
  "source": {
3238
  "type": "git",
3239
  "url": "https://github.com/illuminate/support.git",
3240
- "reference": "0c2a4db0c60b33d30af0ae6bc2b31159d6c49361"
3241
  },
3242
  "dist": {
3243
  "type": "zip",
3244
- "url": "https://api.github.com/repos/illuminate/support/zipball/0c2a4db0c60b33d30af0ae6bc2b31159d6c49361",
3245
- "reference": "0c2a4db0c60b33d30af0ae6bc2b31159d6c49361",
3246
  "shasum": ""
3247
  },
3248
  "require": {
@@ -3254,7 +3250,7 @@
3254
  "illuminate/macroable": "^8.0",
3255
  "nesbot/carbon": "^2.53.1",
3256
  "php": "^7.3|^8.0",
3257
- "voku/portable-ascii": "^1.4.8"
3258
  },
3259
  "conflict": {
3260
  "tightenco/collect": "<5.5.33"
@@ -3265,7 +3261,7 @@
3265
  "ramsey/uuid": "Required to use Str::uuid() (^4.2.2).",
3266
  "symfony/process": "Required to use the composer class (^5.4).",
3267
  "symfony/var-dumper": "Required to use the dd function (^5.4).",
3268
- "vlucas/phpdotenv": "Required to use the Env class and env helper (^5.2)."
3269
  },
3270
  "type": "library",
3271
  "extra": {
@@ -3297,7 +3293,7 @@
3297
  "issues": "https://github.com/laravel/framework/issues",
3298
  "source": "https://github.com/laravel/framework"
3299
  },
3300
- "time": "2022-01-04T16:02:54+00:00"
3301
  },
3302
  {
3303
  "name": "justinrainbow/json-schema",
@@ -3450,16 +3446,16 @@
3450
  },
3451
  {
3452
  "name": "lucatume/wp-browser",
3453
- "version": "3.0.18",
3454
  "source": {
3455
  "type": "git",
3456
  "url": "https://github.com/lucatume/wp-browser.git",
3457
- "reference": "eff4b188a7f651ab857cbb452d49235eedbc55f1"
3458
  },
3459
  "dist": {
3460
  "type": "zip",
3461
- "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/eff4b188a7f651ab857cbb452d49235eedbc55f1",
3462
- "reference": "eff4b188a7f651ab857cbb452d49235eedbc55f1",
3463
  "shasum": ""
3464
  },
3465
  "require": {
@@ -3540,7 +3536,7 @@
3540
  ],
3541
  "support": {
3542
  "issues": "https://github.com/lucatume/wp-browser/issues",
3543
- "source": "https://github.com/lucatume/wp-browser/tree/3.0.18"
3544
  },
3545
  "funding": [
3546
  {
@@ -3548,20 +3544,20 @@
3548
  "type": "github"
3549
  }
3550
  ],
3551
- "time": "2022-01-05T09:25:36+00:00"
3552
  },
3553
  {
3554
  "name": "mck89/peast",
3555
- "version": "v1.13.10",
3556
  "source": {
3557
  "type": "git",
3558
  "url": "https://github.com/mck89/peast.git",
3559
- "reference": "05ad3e6f66e6b35aa2247ef69b1a0c23c45a567b"
3560
  },
3561
  "dist": {
3562
  "type": "zip",
3563
- "url": "https://api.github.com/repos/mck89/peast/zipball/05ad3e6f66e6b35aa2247ef69b1a0c23c45a567b",
3564
- "reference": "05ad3e6f66e6b35aa2247ef69b1a0c23c45a567b",
3565
  "shasum": ""
3566
  },
3567
  "require": {
@@ -3574,7 +3570,7 @@
3574
  "type": "library",
3575
  "extra": {
3576
  "branch-alias": {
3577
- "dev-master": "1.13.10-dev"
3578
  }
3579
  },
3580
  "autoload": {
@@ -3596,9 +3592,9 @@
3596
  "description": "Peast is PHP library that generates AST for JavaScript code",
3597
  "support": {
3598
  "issues": "https://github.com/mck89/peast/issues",
3599
- "source": "https://github.com/mck89/peast/tree/v1.13.10"
3600
  },
3601
- "time": "2021-12-24T10:38:18+00:00"
3602
  },
3603
  {
3604
  "name": "mikehaertl/php-shellcommand",
@@ -3716,16 +3712,16 @@
3716
  },
3717
  {
3718
  "name": "mustache/mustache",
3719
- "version": "v2.14.0",
3720
  "source": {
3721
  "type": "git",
3722
  "url": "https://github.com/bobthecow/mustache.php.git",
3723
- "reference": "4e2724dd40ae9499a55e7db7df82665be0ab7e34"
3724
  },
3725
  "dist": {
3726
  "type": "zip",
3727
- "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/4e2724dd40ae9499a55e7db7df82665be0ab7e34",
3728
- "reference": "4e2724dd40ae9499a55e7db7df82665be0ab7e34",
3729
  "shasum": ""
3730
  },
3731
  "require": {
@@ -3760,9 +3756,9 @@
3760
  ],
3761
  "support": {
3762
  "issues": "https://github.com/bobthecow/mustache.php/issues",
3763
- "source": "https://github.com/bobthecow/mustache.php/tree/v2.14.0"
3764
  },
3765
- "time": "2021-12-14T14:42:17+00:00"
3766
  },
3767
  {
3768
  "name": "myclabs/deep-copy",
@@ -3934,16 +3930,16 @@
3934
  },
3935
  {
3936
  "name": "nesbot/carbon",
3937
- "version": "2.55.2",
3938
  "source": {
3939
  "type": "git",
3940
  "url": "https://github.com/briannesbitt/Carbon.git",
3941
- "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2"
3942
  },
3943
  "dist": {
3944
  "type": "zip",
3945
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8c2a18ce3e67c34efc1b29f64fe61304368259a2",
3946
- "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2",
3947
  "shasum": ""
3948
  },
3949
  "require": {
@@ -3960,7 +3956,7 @@
3960
  "kylekatarnls/multi-tester": "^2.0",
3961
  "phpmd/phpmd": "^2.9",
3962
  "phpstan/extension-installer": "^1.0",
3963
- "phpstan/phpstan": "^0.12.54",
3964
  "phpunit/phpunit": "^7.5.20 || ^8.5.14",
3965
  "squizlabs/php_codesniffer": "^3.4"
3966
  },
@@ -4026,7 +4022,7 @@
4026
  "type": "tidelift"
4027
  }
4028
  ],
4029
- "time": "2021-12-03T14:59:52+00:00"
4030
  },
4031
  {
4032
  "name": "netresearch/jsonmapper",
@@ -4966,16 +4962,16 @@
4966
  },
4967
  {
4968
  "name": "phpstan/phpstan",
4969
- "version": "1.3.1",
4970
  "source": {
4971
  "type": "git",
4972
  "url": "https://github.com/phpstan/phpstan.git",
4973
- "reference": "c3e7a5837829b3cd5907b895da73a4da084a9f8f"
4974
  },
4975
  "dist": {
4976
  "type": "zip",
4977
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c3e7a5837829b3cd5907b895da73a4da084a9f8f",
4978
- "reference": "c3e7a5837829b3cd5907b895da73a4da084a9f8f",
4979
  "shasum": ""
4980
  },
4981
  "require": {
@@ -4991,7 +4987,7 @@
4991
  "type": "library",
4992
  "extra": {
4993
  "branch-alias": {
4994
- "dev-master": "1.3-dev"
4995
  }
4996
  },
4997
  "autoload": {
@@ -5006,7 +5002,7 @@
5006
  "description": "PHPStan - PHP Static Analysis Tool",
5007
  "support": {
5008
  "issues": "https://github.com/phpstan/phpstan/issues",
5009
- "source": "https://github.com/phpstan/phpstan/tree/1.3.1"
5010
  },
5011
  "funding": [
5012
  {
@@ -5026,7 +5022,7 @@
5026
  "type": "tidelift"
5027
  }
5028
  ],
5029
- "time": "2022-01-04T17:12:37+00:00"
5030
  },
5031
  {
5032
  "name": "phpunit/php-code-coverage",
@@ -5915,11 +5911,11 @@
5915
  },
5916
  {
5917
  "name": "publishpress/publishpress-plugin-builder",
5918
- "version": "v1.3.4",
5919
  "source": {
5920
  "type": "git",
5921
  "url": "https://github.com/publishpress/PublishPress-Plugin-Builder",
5922
- "reference": "fd58833743fc80aecac02c0c99b5eca1212c434d"
5923
  },
5924
  "require": {
5925
  "consolidation/robo": "^3.0",
@@ -5928,8 +5924,11 @@
5928
  "symfony/yaml": "^5"
5929
  },
5930
  "require-dev": {
5931
- "codeception/codeception": "^4.0",
5932
  "codeception/module-asserts": "^1.0.0",
 
 
 
5933
  "phpmd/phpmd": "^2.8",
5934
  "phpmetrics/phpmetrics": "^2.7",
5935
  "squizlabs/php_codesniffer": "^3.5"
@@ -5950,7 +5949,7 @@
5950
  }
5951
  ],
5952
  "description": "Robo tasks for building WordPress plugins",
5953
- "time": "2021-10-18T17:26:24+00:00"
5954
  },
5955
  {
5956
  "name": "ralouphie/getallheaders",
@@ -9188,16 +9187,16 @@
9188
  },
9189
  {
9190
  "name": "vimeo/psalm",
9191
- "version": "4.17.0",
9192
  "source": {
9193
  "type": "git",
9194
  "url": "https://github.com/vimeo/psalm.git",
9195
- "reference": "6f4707aa41c9174353a6434bba3fc8840f981d9c"
9196
  },
9197
  "dist": {
9198
  "type": "zip",
9199
- "url": "https://api.github.com/repos/vimeo/psalm/zipball/6f4707aa41c9174353a6434bba3fc8840f981d9c",
9200
- "reference": "6f4707aa41c9174353a6434bba3fc8840f981d9c",
9201
  "shasum": ""
9202
  },
9203
  "require": {
@@ -9288,22 +9287,22 @@
9288
  ],
9289
  "support": {
9290
  "issues": "https://github.com/vimeo/psalm/issues",
9291
- "source": "https://github.com/vimeo/psalm/tree/4.17.0"
9292
  },
9293
- "time": "2022-01-01T18:39:47+00:00"
9294
  },
9295
  {
9296
  "name": "voku/portable-ascii",
9297
- "version": "1.5.6",
9298
  "source": {
9299
  "type": "git",
9300
  "url": "https://github.com/voku/portable-ascii.git",
9301
- "reference": "80953678b19901e5165c56752d087fc11526017c"
9302
  },
9303
  "dist": {
9304
  "type": "zip",
9305
- "url": "https://api.github.com/repos/voku/portable-ascii/zipball/80953678b19901e5165c56752d087fc11526017c",
9306
- "reference": "80953678b19901e5165c56752d087fc11526017c",
9307
  "shasum": ""
9308
  },
9309
  "require": {
@@ -9340,7 +9339,7 @@
9340
  ],
9341
  "support": {
9342
  "issues": "https://github.com/voku/portable-ascii/issues",
9343
- "source": "https://github.com/voku/portable-ascii/tree/1.5.6"
9344
  },
9345
  "funding": [
9346
  {
@@ -9364,7 +9363,7 @@
9364
  "type": "tidelift"
9365
  }
9366
  ],
9367
- "time": "2020-11-12T00:07:28+00:00"
9368
  },
9369
  {
9370
  "name": "vria/nodiacritic",
@@ -9530,21 +9529,21 @@
9530
  },
9531
  {
9532
  "name": "wp-cli/i18n-command",
9533
- "version": "v2.2.10",
9534
  "source": {
9535
  "type": "git",
9536
  "url": "https://github.com/wp-cli/i18n-command.git",
9537
- "reference": "e9eef8aab4b5e43c3aa09bf60e1e7a9d6d30d302"
9538
  },
9539
  "dist": {
9540
  "type": "zip",
9541
- "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/e9eef8aab4b5e43c3aa09bf60e1e7a9d6d30d302",
9542
- "reference": "e9eef8aab4b5e43c3aa09bf60e1e7a9d6d30d302",
9543
  "shasum": ""
9544
  },
9545
  "require": {
9546
  "gettext/gettext": "^4.8",
9547
- "mck89/peast": "^1.13.9",
9548
  "wp-cli/wp-cli": "^2.5"
9549
  },
9550
  "require-dev": {
@@ -9557,7 +9556,7 @@
9557
  "type": "wp-cli-package",
9558
  "extra": {
9559
  "branch-alias": {
9560
- "dev-master": "2.x-dev"
9561
  },
9562
  "bundled": true,
9563
  "commands": [
@@ -9588,9 +9587,9 @@
9588
  "homepage": "https://github.com/wp-cli/i18n-command",
9589
  "support": {
9590
  "issues": "https://github.com/wp-cli/i18n-command/issues",
9591
- "source": "https://github.com/wp-cli/i18n-command/tree/v2.2.10"
9592
  },
9593
- "time": "2021-12-03T22:10:38+00:00"
9594
  },
9595
  {
9596
  "name": "wp-cli/mustangostang-spyc",
244
  },
245
  {
246
  "name": "antecedent/patchwork",
247
+ "version": "2.1.19",
248
  "source": {
249
  "type": "git",
250
  "url": "https://github.com/antecedent/patchwork.git",
251
+ "reference": "94fe587cb0a6c1695b1ddc650e877231be80b8bc"
252
  },
253
  "dist": {
254
  "type": "zip",
255
+ "url": "https://api.github.com/repos/antecedent/patchwork/zipball/94fe587cb0a6c1695b1ddc650e877231be80b8bc",
256
+ "reference": "94fe587cb0a6c1695b1ddc650e877231be80b8bc",
257
  "shasum": ""
258
  },
259
  "require": {
286
  ],
287
  "support": {
288
  "issues": "https://github.com/antecedent/patchwork/issues",
289
+ "source": "https://github.com/antecedent/patchwork/tree/2.1.19"
290
  },
291
+ "time": "2022-01-20T04:47:04+00:00"
292
  },
293
  {
294
  "name": "behat/gherkin",
411
  },
412
  {
413
  "name": "codeception/codeception",
414
+ "version": "4.1.28",
415
  "source": {
416
  "type": "git",
417
  "url": "https://github.com/Codeception/Codeception.git",
418
+ "reference": "e9bc22a3819f9d356068c0e372193ebcc9b06014"
419
  },
420
  "dist": {
421
  "type": "zip",
422
+ "url": "https://api.github.com/repos/Codeception/Codeception/zipball/e9bc22a3819f9d356068c0e372193ebcc9b06014",
423
+ "reference": "e9bc22a3819f9d356068c0e372193ebcc9b06014",
424
  "shasum": ""
425
  },
426
  "require": {
497
  ],
498
  "support": {
499
  "issues": "https://github.com/Codeception/Codeception/issues",
500
+ "source": "https://github.com/Codeception/Codeception/tree/4.1.28"
501
  },
502
  "funding": [
503
  {
505
  "type": "open_collective"
506
  }
507
  ],
508
+ "time": "2022-01-05T16:41:25+00:00"
509
  },
510
  {
511
  "name": "codeception/lib-asserts",
1094
  },
1095
  {
1096
  "name": "codeception/stub",
1097
+ "version": "4.0.1",
1098
  "source": {
1099
  "type": "git",
1100
  "url": "https://github.com/Codeception/Stub.git",
1101
+ "reference": "ce0a9e418c775ca8b737d50c2b4ac1132f3990d8"
1102
  },
1103
  "dist": {
1104
  "type": "zip",
1105
+ "url": "https://api.github.com/repos/Codeception/Stub/zipball/ce0a9e418c775ca8b737d50c2b4ac1132f3990d8",
1106
+ "reference": "ce0a9e418c775ca8b737d50c2b4ac1132f3990d8",
1107
  "shasum": ""
1108
  },
1109
  "require": {
1126
  "description": "Flexible Stub wrapper for PHPUnit's Mock Builder",
1127
  "support": {
1128
  "issues": "https://github.com/Codeception/Stub/issues",
1129
+ "source": "https://github.com/Codeception/Stub/tree/4.0.1"
1130
  },
1131
+ "time": "2022-01-08T09:35:36+00:00"
1132
  },
1133
  {
1134
  "name": "codeception/util-universalframework",
1169
  },
1170
  {
1171
  "name": "composer/package-versions-deprecated",
1172
+ "version": "1.11.99.5",
1173
  "source": {
1174
  "type": "git",
1175
  "url": "https://github.com/composer/package-versions-deprecated.git",
1176
+ "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d"
1177
  },
1178
  "dist": {
1179
  "type": "zip",
1180
+ "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d",
1181
+ "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d",
1182
  "shasum": ""
1183
  },
1184
  "require": {
1222
  "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
1223
  "support": {
1224
  "issues": "https://github.com/composer/package-versions-deprecated/issues",
1225
+ "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5"
1226
  },
1227
  "funding": [
1228
  {
1238
  "type": "tidelift"
1239
  }
1240
  ],
1241
+ "time": "2022-01-17T14:14:24+00:00"
1242
  },
1243
  {
1244
  "name": "composer/pcre",
1245
+ "version": "1.0.1",
1246
  "source": {
1247
  "type": "git",
1248
  "url": "https://github.com/composer/pcre.git",
1249
+ "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560"
1250
  },
1251
  "dist": {
1252
  "type": "zip",
1253
+ "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560",
1254
+ "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560",
1255
  "shasum": ""
1256
  },
1257
  "require": {
1258
  "php": "^5.3.2 || ^7.0 || ^8.0"
1259
  },
1260
  "require-dev": {
1261
+ "phpstan/phpstan": "^1.3",
1262
  "phpstan/phpstan-strict-rules": "^1.1",
1263
  "symfony/phpunit-bridge": "^4.2 || ^5"
1264
  },
1293
  ],
1294
  "support": {
1295
  "issues": "https://github.com/composer/pcre/issues",
1296
+ "source": "https://github.com/composer/pcre/tree/1.0.1"
1297
  },
1298
  "funding": [
1299
  {
1309
  "type": "tidelift"
1310
  }
1311
  ],
1312
+ "time": "2022-01-21T20:24:37+00:00"
1313
  },
1314
  {
1315
  "name": "composer/semver",
2286
  },
2287
  {
2288
  "name": "doctrine/lexer",
2289
+ "version": "1.2.2",
2290
  "source": {
2291
  "type": "git",
2292
  "url": "https://github.com/doctrine/lexer.git",
2293
+ "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c"
2294
  },
2295
  "dist": {
2296
  "type": "zip",
2297
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c",
2298
+ "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c",
2299
  "shasum": ""
2300
  },
2301
  "require": {
2302
+ "php": "^7.1 || ^8.0"
2303
  },
2304
  "require-dev": {
2305
+ "doctrine/coding-standard": "^9.0",
2306
+ "phpstan/phpstan": "1.3",
2307
+ "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
2308
+ "vimeo/psalm": "^4.11"
2309
  },
2310
  "type": "library",
 
 
 
 
 
2311
  "autoload": {
2312
  "psr-4": {
2313
  "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
2342
  ],
2343
  "support": {
2344
  "issues": "https://github.com/doctrine/lexer/issues",
2345
+ "source": "https://github.com/doctrine/lexer/tree/1.2.2"
2346
  },
2347
  "funding": [
2348
  {
2358
  "type": "tidelift"
2359
  }
2360
  ],
2361
+ "time": "2022-01-12T08:27:12+00:00"
2362
  },
2363
  {
2364
  "name": "felixfbecker/advanced-json-rpc",
3081
  },
3082
  {
3083
  "name": "illuminate/collections",
3084
+ "version": "v8.81.0",
3085
  "source": {
3086
  "type": "git",
3087
  "url": "https://github.com/illuminate/collections.git",
3088
+ "reference": "3933ab6b032167c0f7a598388e211c0810acf5d3"
3089
  },
3090
  "dist": {
3091
  "type": "zip",
3092
+ "url": "https://api.github.com/repos/illuminate/collections/zipball/3933ab6b032167c0f7a598388e211c0810acf5d3",
3093
+ "reference": "3933ab6b032167c0f7a598388e211c0810acf5d3",
3094
  "shasum": ""
3095
  },
3096
  "require": {
3131
  "issues": "https://github.com/laravel/framework/issues",
3132
  "source": "https://github.com/laravel/framework"
3133
  },
3134
+ "time": "2022-01-24T16:41:15+00:00"
3135
  },
3136
  {
3137
  "name": "illuminate/contracts",
3138
+ "version": "v8.81.0",
3139
  "source": {
3140
  "type": "git",
3141
  "url": "https://github.com/illuminate/contracts.git",
3142
+ "reference": "5e0fd287a1b22a6b346a9f7cd484d8cf0234585d"
3143
  },
3144
  "dist": {
3145
  "type": "zip",
3146
+ "url": "https://api.github.com/repos/illuminate/contracts/zipball/5e0fd287a1b22a6b346a9f7cd484d8cf0234585d",
3147
+ "reference": "5e0fd287a1b22a6b346a9f7cd484d8cf0234585d",
3148
  "shasum": ""
3149
  },
3150
  "require": {
3179
  "issues": "https://github.com/laravel/framework/issues",
3180
  "source": "https://github.com/laravel/framework"
3181
  },
3182
+ "time": "2022-01-13T14:47:47+00:00"
3183
  },
3184
  {
3185
  "name": "illuminate/macroable",
3186
+ "version": "v8.81.0",
3187
  "source": {
3188
  "type": "git",
3189
  "url": "https://github.com/illuminate/macroable.git",
3229
  },
3230
  {
3231
  "name": "illuminate/support",
3232
+ "version": "v8.81.0",
3233
  "source": {
3234
  "type": "git",
3235
  "url": "https://github.com/illuminate/support.git",
3236
+ "reference": "fb33fd4bbcc075f641d5576b700a1c3d962acef0"
3237
  },
3238
  "dist": {
3239
  "type": "zip",
3240
+ "url": "https://api.github.com/repos/illuminate/support/zipball/fb33fd4bbcc075f641d5576b700a1c3d962acef0",
3241
+ "reference": "fb33fd4bbcc075f641d5576b700a1c3d962acef0",
3242
  "shasum": ""
3243
  },
3244
  "require": {
3250
  "illuminate/macroable": "^8.0",
3251
  "nesbot/carbon": "^2.53.1",
3252
  "php": "^7.3|^8.0",
3253
+ "voku/portable-ascii": "^1.6.1"
3254
  },
3255
  "conflict": {
3256
  "tightenco/collect": "<5.5.33"
3261
  "ramsey/uuid": "Required to use Str::uuid() (^4.2.2).",
3262
  "symfony/process": "Required to use the composer class (^5.4).",
3263
  "symfony/var-dumper": "Required to use the dd function (^5.4).",
3264
+ "vlucas/phpdotenv": "Required to use the Env class and env helper (^5.4.1)."
3265
  },
3266
  "type": "library",
3267
  "extra": {
3293
  "issues": "https://github.com/laravel/framework/issues",
3294
  "source": "https://github.com/laravel/framework"
3295
  },
3296
+ "time": "2022-01-25T16:10:28+00:00"
3297
  },
3298
  {
3299
  "name": "justinrainbow/json-schema",
3446
  },
3447
  {
3448
  "name": "lucatume/wp-browser",
3449
+ "version": "3.0.22",
3450
  "source": {
3451
  "type": "git",
3452
  "url": "https://github.com/lucatume/wp-browser.git",
3453
+ "reference": "c695d8e2fd075b85e89be57b1c10aec64530287a"
3454
  },
3455
  "dist": {
3456
  "type": "zip",
3457
+ "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/c695d8e2fd075b85e89be57b1c10aec64530287a",
3458
+ "reference": "c695d8e2fd075b85e89be57b1c10aec64530287a",
3459
  "shasum": ""
3460
  },
3461
  "require": {
3536
  ],
3537
  "support": {
3538
  "issues": "https://github.com/lucatume/wp-browser/issues",
3539
+ "source": "https://github.com/lucatume/wp-browser/tree/3.0.22"
3540
  },
3541
  "funding": [
3542
  {
3544
  "type": "github"
3545
  }
3546
  ],
3547
+ "time": "2022-01-14T08:41:20+00:00"
3548
  },
3549
  {
3550
  "name": "mck89/peast",
3551
+ "version": "v1.13.11",
3552
  "source": {
3553
  "type": "git",
3554
  "url": "https://github.com/mck89/peast.git",
3555
+ "reference": "78c57966f3da5f223636ea0417d71ac6ff61e47f"
3556
  },
3557
  "dist": {
3558
  "type": "zip",
3559
+ "url": "https://api.github.com/repos/mck89/peast/zipball/78c57966f3da5f223636ea0417d71ac6ff61e47f",
3560
+ "reference": "78c57966f3da5f223636ea0417d71ac6ff61e47f",
3561
  "shasum": ""
3562
  },
3563
  "require": {
3570
  "type": "library",
3571
  "extra": {
3572
  "branch-alias": {
3573
+ "dev-master": "1.13.11-dev"
3574
  }
3575
  },
3576
  "autoload": {
3592
  "description": "Peast is PHP library that generates AST for JavaScript code",
3593
  "support": {
3594
  "issues": "https://github.com/mck89/peast/issues",
3595
+ "source": "https://github.com/mck89/peast/tree/v1.13.11"
3596
  },
3597
+ "time": "2022-01-11T17:58:18+00:00"
3598
  },
3599
  {
3600
  "name": "mikehaertl/php-shellcommand",
3712
  },
3713
  {
3714
  "name": "mustache/mustache",
3715
+ "version": "v2.14.1",
3716
  "source": {
3717
  "type": "git",
3718
  "url": "https://github.com/bobthecow/mustache.php.git",
3719
+ "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e"
3720
  },
3721
  "dist": {
3722
  "type": "zip",
3723
+ "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/579ffa5c96e1d292c060b3dd62811ff01ad8c24e",
3724
+ "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e",
3725
  "shasum": ""
3726
  },
3727
  "require": {
3756
  ],
3757
  "support": {
3758
  "issues": "https://github.com/bobthecow/mustache.php/issues",
3759
+ "source": "https://github.com/bobthecow/mustache.php/tree/v2.14.1"
3760
  },
3761
+ "time": "2022-01-21T06:08:36+00:00"
3762
  },
3763
  {
3764
  "name": "myclabs/deep-copy",
3930
  },
3931
  {
3932
  "name": "nesbot/carbon",
3933
+ "version": "2.56.0",
3934
  "source": {
3935
  "type": "git",
3936
  "url": "https://github.com/briannesbitt/Carbon.git",
3937
+ "reference": "626ec8cbb724cd3c3400c3ed8f730545b744e3f4"
3938
  },
3939
  "dist": {
3940
  "type": "zip",
3941
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/626ec8cbb724cd3c3400c3ed8f730545b744e3f4",
3942
+ "reference": "626ec8cbb724cd3c3400c3ed8f730545b744e3f4",
3943
  "shasum": ""
3944
  },
3945
  "require": {
3956
  "kylekatarnls/multi-tester": "^2.0",
3957
  "phpmd/phpmd": "^2.9",
3958
  "phpstan/extension-installer": "^1.0",
3959
+ "phpstan/phpstan": "^0.12.54 || ^1.0",
3960
  "phpunit/phpunit": "^7.5.20 || ^8.5.14",
3961
  "squizlabs/php_codesniffer": "^3.4"
3962
  },
4022
  "type": "tidelift"
4023
  }
4024
  ],
4025
+ "time": "2022-01-21T17:08:38+00:00"
4026
  },
4027
  {
4028
  "name": "netresearch/jsonmapper",
4962
  },
4963
  {
4964
  "name": "phpstan/phpstan",
4965
+ "version": "1.4.2",
4966
  "source": {
4967
  "type": "git",
4968
  "url": "https://github.com/phpstan/phpstan.git",
4969
+ "reference": "1dd8f3e40bf7aa30031a75c65cece99220a161b8"
4970
  },
4971
  "dist": {
4972
  "type": "zip",
4973
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1dd8f3e40bf7aa30031a75c65cece99220a161b8",
4974
+ "reference": "1dd8f3e40bf7aa30031a75c65cece99220a161b8",
4975
  "shasum": ""
4976
  },
4977
  "require": {
4987
  "type": "library",
4988
  "extra": {
4989
  "branch-alias": {
4990
+ "dev-master": "1.4-dev"
4991
  }
4992
  },
4993
  "autoload": {
5002
  "description": "PHPStan - PHP Static Analysis Tool",
5003
  "support": {
5004
  "issues": "https://github.com/phpstan/phpstan/issues",
5005
+ "source": "https://github.com/phpstan/phpstan/tree/1.4.2"
5006
  },
5007
  "funding": [
5008
  {
5022
  "type": "tidelift"
5023
  }
5024
  ],
5025
+ "time": "2022-01-18T16:09:11+00:00"
5026
  },
5027
  {
5028
  "name": "phpunit/php-code-coverage",
5911
  },
5912
  {
5913
  "name": "publishpress/publishpress-plugin-builder",
5914
+ "version": "v1.3.5",
5915
  "source": {
5916
  "type": "git",
5917
  "url": "https://github.com/publishpress/PublishPress-Plugin-Builder",
5918
+ "reference": "843c2bd811e2307fbca99dfa193b6922a97b5e61"
5919
  },
5920
  "require": {
5921
  "consolidation/robo": "^3.0",
5924
  "symfony/yaml": "^5"
5925
  },
5926
  "require-dev": {
5927
+ "codeception/codeception": "^4.1",
5928
  "codeception/module-asserts": "^1.0.0",
5929
+ "codeception/module-cli": "^1.0",
5930
+ "codeception/module-filesystem": "^1.0",
5931
+ "codeception/util-universalframework": "^1.0",
5932
  "phpmd/phpmd": "^2.8",
5933
  "phpmetrics/phpmetrics": "^2.7",
5934
  "squizlabs/php_codesniffer": "^3.5"
5949
  }
5950
  ],
5951
  "description": "Robo tasks for building WordPress plugins",
5952
+ "time": "2022-01-19T22:09:53+00:00"
5953
  },
5954
  {
5955
  "name": "ralouphie/getallheaders",
9187
  },
9188
  {
9189
  "name": "vimeo/psalm",
9190
+ "version": "4.18.1",
9191
  "source": {
9192
  "type": "git",
9193
  "url": "https://github.com/vimeo/psalm.git",
9194
+ "reference": "dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb"
9195
  },
9196
  "dist": {
9197
  "type": "zip",
9198
+ "url": "https://api.github.com/repos/vimeo/psalm/zipball/dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb",
9199
+ "reference": "dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb",
9200
  "shasum": ""
9201
  },
9202
  "require": {
9287
  ],
9288
  "support": {
9289
  "issues": "https://github.com/vimeo/psalm/issues",
9290
+ "source": "https://github.com/vimeo/psalm/tree/4.18.1"
9291
  },
9292
+ "time": "2022-01-08T21:21:26+00:00"
9293
  },
9294
  {
9295
  "name": "voku/portable-ascii",
9296
+ "version": "1.6.1",
9297
  "source": {
9298
  "type": "git",
9299
  "url": "https://github.com/voku/portable-ascii.git",
9300
+ "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a"
9301
  },
9302
  "dist": {
9303
  "type": "zip",
9304
+ "url": "https://api.github.com/repos/voku/portable-ascii/zipball/87337c91b9dfacee02452244ee14ab3c43bc485a",
9305
+ "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a",
9306
  "shasum": ""
9307
  },
9308
  "require": {
9339
  ],
9340
  "support": {
9341
  "issues": "https://github.com/voku/portable-ascii/issues",
9342
+ "source": "https://github.com/voku/portable-ascii/tree/1.6.1"
9343
  },
9344
  "funding": [
9345
  {
9363
  "type": "tidelift"
9364
  }
9365
  ],
9366
+ "time": "2022-01-24T18:55:24+00:00"
9367
  },
9368
  {
9369
  "name": "vria/nodiacritic",
9529
  },
9530
  {
9531
  "name": "wp-cli/i18n-command",
9532
+ "version": "v2.2.13",
9533
  "source": {
9534
  "type": "git",
9535
  "url": "https://github.com/wp-cli/i18n-command.git",
9536
+ "reference": "77ece9e2c914bb56ea72b9ee9f00556dece07b3f"
9537
  },
9538
  "dist": {
9539
  "type": "zip",
9540
+ "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/77ece9e2c914bb56ea72b9ee9f00556dece07b3f",
9541
+ "reference": "77ece9e2c914bb56ea72b9ee9f00556dece07b3f",
9542
  "shasum": ""
9543
  },
9544
  "require": {
9545
  "gettext/gettext": "^4.8",
9546
+ "mck89/peast": "^1.13.11",
9547
  "wp-cli/wp-cli": "^2.5"
9548
  },
9549
  "require-dev": {
9556
  "type": "wp-cli-package",
9557
  "extra": {
9558
  "branch-alias": {
9559
+ "dev-main": "2.x-dev"
9560
  },
9561
  "bundled": true,
9562
  "commands": [
9587
  "homepage": "https://github.com/wp-cli/i18n-command",
9588
  "support": {
9589
  "issues": "https://github.com/wp-cli/i18n-command/issues",
9590
+ "source": "https://github.com/wp-cli/i18n-command/tree/v2.2.13"
9591
  },
9592
+ "time": "2022-01-13T01:40:51+00:00"
9593
  },
9594
  {
9595
  "name": "wp-cli/mustangostang-spyc",
post-expirator-debug.php CHANGED
@@ -23,6 +23,7 @@ class PostExpiratorDebug
23
  {
24
  global $wpdb;
25
 
 
26
  if ($wpdb->get_var("SHOW TABLES LIKE '" . $this->debug_table . "'") !== $this->debug_table) {
27
  $sql = 'CREATE TABLE `' . $this->debug_table . '` (
28
  `id` INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -41,6 +42,7 @@ class PostExpiratorDebug
41
  public function removeDBTable()
42
  {
43
  global $wpdb;
 
44
  $wpdb->query('DROP TABLE IF EXISTS ' . $this->debug_table);
45
  }
46
 
@@ -57,12 +59,14 @@ class PostExpiratorDebug
57
  $blog = 0;
58
  }
59
  $wpdb->query(
 
60
  $wpdb->prepare(
61
  'INSERT INTO ' . $this->debug_table . ' (`timestamp`,`message`,`blog`) VALUES (FROM_UNIXTIME(%d),%s,%s)',
62
  time(),
63
  $data['message'],
64
  $blog
65
  )
 
66
  );
67
  }
68
 
23
  {
24
  global $wpdb;
25
 
26
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
27
  if ($wpdb->get_var("SHOW TABLES LIKE '" . $this->debug_table . "'") !== $this->debug_table) {
28
  $sql = 'CREATE TABLE `' . $this->debug_table . '` (
29
  `id` INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
42
  public function removeDBTable()
43
  {
44
  global $wpdb;
45
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
46
  $wpdb->query('DROP TABLE IF EXISTS ' . $this->debug_table);
47
  }
48
 
59
  $blog = 0;
60
  }
61
  $wpdb->query(
62
+ // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
63
  $wpdb->prepare(
64
  'INSERT INTO ' . $this->debug_table . ' (`timestamp`,`message`,`blog`) VALUES (FROM_UNIXTIME(%d),%s,%s)',
65
  time(),
66
  $data['message'],
67
  $blog
68
  )
69
+ // phpcs:enable
70
  );
71
  }
72
 
post-expirator.php CHANGED
@@ -1,17 +1,17 @@
1
  <?php
2
- /*
3
- Plugin Name: PublishPress Future
4
- Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
- Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
6
- Author: PublishPress
7
- Version: 2.7.1
8
- Author URI: http://publishpress.com
9
- Text Domain: post-expirator
10
- Domain Path: /languages
11
  */
12
 
13
  // Default Values
14
- define('POSTEXPIRATOR_VERSION', '2.7.1');
15
  define('POSTEXPIRATOR_DATEFORMAT', __('l F jS, Y', 'post-expirator'));
16
  define('POSTEXPIRATOR_TIMEFORMAT', __('g:ia', 'post-expirator'));
17
  define('POSTEXPIRATOR_FOOTERCONTENTS', __('Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator'));
@@ -411,7 +411,7 @@ function postexpirator_meta_box($post)
411
  $categories = $attributes['category'];
412
  }
413
 
414
- if ($postMetaStatus === 'saved') {
415
  $enabled = ' checked="checked"';
416
  }
417
 
@@ -582,32 +582,32 @@ function postexpirator_update_post_meta($id)
582
  $year = date('Y');
583
  }
584
  }
585
- $category = isset($_POST['expirationdate_category']) ? $_POST['expirationdate_category'] : 0;
586
 
587
  $ts = get_gmt_from_date("$year-$month-$day $hour:$minute:0", 'U');
588
 
589
  if (isset($_POST['expirationdate_quickedit'])) {
590
  $opts = PostExpirator_Facade::get_expire_principles($id);
591
  if (isset($_POST['expirationdate_expiretype'])) {
592
- $opts['expireType'] = $_POST['expirationdate_expiretype'];
593
  if (in_array($opts['expireType'], array(
594
  'category',
595
  'category-add',
596
  'category-remove'
597
  ), true)) {
598
- $opts['category'] = $_POST['expirationdate_category'];
599
  }
600
  }
601
  } else {
602
  // Schedule/Update Expiration
603
- $opts['expireType'] = $_POST['expirationdate_expiretype'];
604
  $opts['id'] = $id;
605
 
606
  if ($opts['expireType'] === 'category' || $opts['expireType'] === 'category-add' || $opts['expireType'] === 'category-remove') {
607
  if (isset($category) && ! empty($category)) {
608
  if (! empty($category)) {
609
  $opts['category'] = $category;
610
- $opts['categoryTaxonomy'] = $_POST['taxonomy-heirarchical'];
611
  }
612
  }
613
  }
@@ -634,30 +634,34 @@ function postexpirator_update_post_meta($id)
634
 
635
  if (isset($payload['meta'])) {
636
  if (isset($payload['meta']['_expiration-date-status'])) {
637
- $shouldSchedule = $payload['meta']['_expiration-date-status'] === 'saved';
 
 
638
  } else {
639
- $shouldSchedule = get_post_meta($id, '_expiration-date-status', true) === 'saved';
640
  }
641
 
642
- if (isset($payload['meta']['_expiration-date'])) {
643
- $ts = $payload['meta']['_expiration-date'];
644
- } else {
645
- $ts = get_post_meta($id, '_expiration-date', true);
646
- }
 
647
 
648
- if (isset($payload['meta']['_expiration-date-type'])) {
649
- $opts['expireType'] = $payload['meta']['_expiration-date-type'];
650
- } else {
651
- $opts['expireType'] = get_post_meta($id, '_expiration-date-type', true);
652
- }
653
 
654
- if (isset($payload['meta']['_expiration-date-categories'])) {
655
- $opts['category'] = (array)$payload['meta']['_expiration-date-categories'];
656
- } else {
657
- $opts['category'] = (array)get_post_meta($id, '_expiration-date-categories', true);
 
658
  }
659
  } else {
660
- $shouldSchedule = get_post_meta($id, '_expiration-date-status', true) === 'saved';
661
 
662
  if ($shouldSchedule) {
663
  $ts = get_post_meta($id, '_expiration-date', true);
@@ -698,7 +702,7 @@ function postexpirator_schedule_event($id, $ts, $opts)
698
  if (POSTEXPIRATOR_DEBUG) {
699
  $debug->save(
700
  array(
701
- 'message' => $id . ' -> EXISTING FOUND - UNSCHEDULED - ' . (is_wp_error(
702
  $error
703
  ) ? $error->get_error_message() : 'no error')
704
  )
@@ -706,17 +710,27 @@ function postexpirator_schedule_event($id, $ts, $opts)
706
  }
707
  }
708
 
709
- $error = wp_schedule_single_event($ts, 'postExpiratorExpire', array($id), true);
710
  if (POSTEXPIRATOR_DEBUG) {
711
- $debug->save(
712
- array(
713
- 'message' => $id . ' -> SCHEDULED at ' .
714
- PostExpirator_Util::get_wp_date('r', $ts)
715
- . ' ' . '(' . $ts . ') with options ' . print_r($opts, true) . ' ' . (is_wp_error(
716
- $error
717
- ) ? $error->get_error_message() : 'no error')
718
- )
719
- );
 
 
 
 
 
 
 
 
 
 
720
  }
721
 
722
  // Update Post Meta
@@ -787,9 +801,9 @@ function postexpirator_expire_post($id)
787
  return false;
788
  }
789
 
790
- $postoptions = PostExpirator_Facade::get_expire_principles($id);
791
 
792
- if ($postoptions['enabled'] === false) {
793
  if (POSTEXPIRATOR_DEBUG) {
794
  $debug->save(array('message' => $id . ' -> Post expire data exist but is not activated'));
795
  }
@@ -797,38 +811,46 @@ function postexpirator_expire_post($id)
797
  return false;
798
  }
799
 
800
- $posttype = get_post_type($id);
801
- $posttitle = get_the_title($id);
802
- $postlink = get_post_permalink($id);
803
 
804
- $expireType = $category = $categoryTaxonomy = null;
805
 
806
- if (isset($postoptions['expireType'])) {
807
- $expireType = $postoptions['expireType'];
808
  }
809
 
810
- if (isset($postoptions['category'])) {
811
- $category = $postoptions['category'];
812
  }
813
 
814
- if (isset($postoptions['categoryTaxonomy'])) {
815
- $categoryTaxonomy = $postoptions['categoryTaxonomy'];
816
  }
817
 
818
- $ed = get_post_meta($id, '_expiration-date', true);
 
 
 
 
 
 
 
 
819
 
820
  // Check for default expire only if not passed in
821
  if (empty($expireType)) {
822
- $posttype = get_post_type($id);
823
- if ($posttype === 'page') {
824
  $expireType = strtolower(get_option('expirationdateExpiredPageStatus', POSTEXPIRATOR_PAGESTATUS));
825
- } elseif ($posttype === 'post') {
826
  $expireType = strtolower(get_option('expirationdateExpiredPostStatus', 'draft'));
827
  } else {
828
  $expireType = apply_filters(
829
  'postexpirator_custom_posttype_expire',
830
  $expireType,
831
- $posttype
832
  ); // hook to set defaults for custom post types
833
  }
834
  }
@@ -844,7 +866,7 @@ function postexpirator_expire_post($id)
844
  if ($expireType === 'draft') {
845
  if (wp_update_post(array('ID' => $id, 'post_status' => 'draft')) === 0) {
846
  if (POSTEXPIRATOR_DEBUG) {
847
- $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true)));
848
  }
849
  } else {
850
  $emailBody = sprintf(
@@ -859,7 +881,7 @@ function postexpirator_expire_post($id)
859
  );
860
  if (POSTEXPIRATOR_DEBUG) {
861
  $debug->save(
862
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
863
  );
864
  }
865
 
@@ -868,7 +890,7 @@ function postexpirator_expire_post($id)
868
  } elseif ($expireType === 'private') {
869
  if (wp_update_post(array('ID' => $id, 'post_status' => 'private')) === 0) {
870
  if (POSTEXPIRATOR_DEBUG) {
871
- $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true)));
872
  }
873
  } else {
874
  $emailBody = sprintf(
@@ -883,7 +905,7 @@ function postexpirator_expire_post($id)
883
  );
884
  if (POSTEXPIRATOR_DEBUG) {
885
  $debug->save(
886
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
887
  );
888
  }
889
 
@@ -892,7 +914,7 @@ function postexpirator_expire_post($id)
892
  } elseif ($expireType === 'delete') {
893
  if (wp_delete_post($id) === false) {
894
  if (POSTEXPIRATOR_DEBUG) {
895
- $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true)));
896
  }
897
  } else {
898
  $emailBody = sprintf(
@@ -907,7 +929,7 @@ function postexpirator_expire_post($id)
907
  );
908
  if (POSTEXPIRATOR_DEBUG) {
909
  $debug->save(
910
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
911
  );
912
  }
913
 
@@ -916,7 +938,7 @@ function postexpirator_expire_post($id)
916
  } elseif ($expireType === 'trash') {
917
  if (wp_trash_post($id) === false) {
918
  if (POSTEXPIRATOR_DEBUG) {
919
- $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true)));
920
  }
921
  } else {
922
  $emailBody = sprintf(
@@ -931,7 +953,7 @@ function postexpirator_expire_post($id)
931
  );
932
  if (POSTEXPIRATOR_DEBUG) {
933
  $debug->save(
934
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
935
  );
936
  }
937
 
@@ -940,7 +962,7 @@ function postexpirator_expire_post($id)
940
  } elseif ($expireType === 'stick') {
941
  if (stick_post($id) === false) {
942
  if (POSTEXPIRATOR_DEBUG) {
943
- $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true)));
944
  }
945
  } else {
946
  $emailBody = sprintf(
@@ -952,7 +974,7 @@ function postexpirator_expire_post($id)
952
  );
953
  if (POSTEXPIRATOR_DEBUG) {
954
  $debug->save(
955
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
956
  );
957
  }
958
 
@@ -961,7 +983,7 @@ function postexpirator_expire_post($id)
961
  } elseif ($expireType === 'unstick') {
962
  if (unstick_post($id) === false) {
963
  if (POSTEXPIRATOR_DEBUG) {
964
- $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true)));
965
  }
966
  } else {
967
  $emailBody = sprintf(
@@ -976,19 +998,19 @@ function postexpirator_expire_post($id)
976
  );
977
  if (POSTEXPIRATOR_DEBUG) {
978
  $debug->save(
979
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
980
  );
981
  }
982
 
983
  $postWasExpired = true;
984
  }
985
  } elseif ($expireType === 'category') {
986
- if (! empty($category)) {
987
- if (empty($categoryTaxonomy) || $categoryTaxonomy === 'category') {
988
- if (wp_update_post(array('ID' => $id, 'post_category' => $category)) === 0) {
989
  if (POSTEXPIRATOR_DEBUG) {
990
  $debug->save(
991
- array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true))
992
  );
993
  }
994
  } else {
@@ -1001,16 +1023,16 @@ function postexpirator_expire_post($id)
1001
  '##POSTLINK##',
1002
  '##EXPIRATIONDATE##',
1003
  'CATEGORIES',
1004
- implode(',', _postexpirator_get_cat_names($category))
1005
  );
1006
  if (POSTEXPIRATOR_DEBUG) {
1007
  $debug->save(
1008
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
1009
  );
1010
  $debug->save(
1011
  array(
1012
  'message' => $id . ' -> CATEGORIES REPLACED ' . print_r(
1013
- _postexpirator_get_cat_names($category),
1014
  true
1015
  )
1016
  )
@@ -1018,7 +1040,7 @@ function postexpirator_expire_post($id)
1018
  $debug->save(
1019
  array(
1020
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1021
- _postexpirator_get_cat_names($category),
1022
  true
1023
  )
1024
  )
@@ -1028,11 +1050,11 @@ function postexpirator_expire_post($id)
1028
  $postWasExpired = true;
1029
  }
1030
  } else {
1031
- $terms = array_map('intval', $category);
1032
- if (is_wp_error(wp_set_object_terms($id, $terms, $categoryTaxonomy, false))) {
1033
  if (POSTEXPIRATOR_DEBUG) {
1034
  $debug->save(
1035
- array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true))
1036
  );
1037
  }
1038
  } else {
@@ -1045,16 +1067,16 @@ function postexpirator_expire_post($id)
1045
  '##POSTLINK##',
1046
  '##EXPIRATIONDATE##',
1047
  'CATEGORIES',
1048
- implode(',', _postexpirator_get_cat_names($category))
1049
  );
1050
  if (POSTEXPIRATOR_DEBUG) {
1051
  $debug->save(
1052
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
1053
  );
1054
  $debug->save(
1055
  array(
1056
  'message' => $id . ' -> CATEGORIES REPLACED ' . print_r(
1057
- _postexpirator_get_cat_names($category),
1058
  true
1059
  )
1060
  )
@@ -1062,7 +1084,7 @@ function postexpirator_expire_post($id)
1062
  $debug->save(
1063
  array(
1064
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1065
- _postexpirator_get_cat_names($category),
1066
  true
1067
  )
1068
  )
@@ -1077,7 +1099,7 @@ function postexpirator_expire_post($id)
1077
  $debug->save(
1078
  array(
1079
  'message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r(
1080
- $postoptions,
1081
  true
1082
  )
1083
  )
@@ -1085,14 +1107,14 @@ function postexpirator_expire_post($id)
1085
  }
1086
  }
1087
  } elseif ($expireType === 'category-add') {
1088
- if (! empty($category)) {
1089
- if (empty($categoryTaxonomy) || $categoryTaxonomy === 'category') {
1090
- $cats = wp_get_post_categories($id);
1091
- $merged = array_merge($cats, $category);
1092
- if (wp_update_post(array('ID' => $id, 'post_category' => $merged)) === 0) {
1093
  if (POSTEXPIRATOR_DEBUG) {
1094
  $debug->save(
1095
- array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true))
1096
  );
1097
  }
1098
  } else {
@@ -1105,17 +1127,17 @@ function postexpirator_expire_post($id)
1105
  '##POSTLINK##',
1106
  '##EXPIRATIONDATE##',
1107
  'CATEGORIES',
1108
- implode(',', _postexpirator_get_cat_names($category)),
1109
- implode(',', _postexpirator_get_cat_names($merged))
1110
  );
1111
  if (POSTEXPIRATOR_DEBUG) {
1112
  $debug->save(
1113
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
1114
  );
1115
  $debug->save(
1116
  array(
1117
  'message' => $id . ' -> CATEGORIES ADDED ' . print_r(
1118
- _postexpirator_get_cat_names($category),
1119
  true
1120
  )
1121
  )
@@ -1123,7 +1145,7 @@ function postexpirator_expire_post($id)
1123
  $debug->save(
1124
  array(
1125
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1126
- _postexpirator_get_cat_names($merged),
1127
  true
1128
  )
1129
  )
@@ -1133,11 +1155,11 @@ function postexpirator_expire_post($id)
1133
  $postWasExpired = true;
1134
  }
1135
  } else {
1136
- $terms = array_map('intval', $category);
1137
- if (is_wp_error(wp_set_object_terms($id, $terms, $categoryTaxonomy, true))) {
1138
  if (POSTEXPIRATOR_DEBUG) {
1139
  $debug->save(
1140
- array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true))
1141
  );
1142
  }
1143
  } else {
@@ -1150,17 +1172,17 @@ function postexpirator_expire_post($id)
1150
  '##POSTLINK##',
1151
  '##EXPIRATIONDATE##',
1152
  'CATEGORIES',
1153
- implode(',', _postexpirator_get_cat_names($category)),
1154
  implode(',', _postexpirator_get_cat_names($terms))
1155
  );
1156
  if (POSTEXPIRATOR_DEBUG) {
1157
  $debug->save(
1158
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
1159
  );
1160
  $debug->save(
1161
  array(
1162
  'message' => $id . ' -> CATEGORIES ADDED ' . print_r(
1163
- _postexpirator_get_cat_names($category),
1164
  true
1165
  )
1166
  )
@@ -1168,7 +1190,7 @@ function postexpirator_expire_post($id)
1168
  $debug->save(
1169
  array(
1170
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1171
- _postexpirator_get_cat_names($category),
1172
  true
1173
  )
1174
  )
@@ -1183,7 +1205,7 @@ function postexpirator_expire_post($id)
1183
  $debug->save(
1184
  array(
1185
  'message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r(
1186
- $postoptions,
1187
  true
1188
  )
1189
  )
@@ -1191,20 +1213,20 @@ function postexpirator_expire_post($id)
1191
  }
1192
  }
1193
  } elseif ($expireType === 'category-remove') {
1194
- if (! empty($category)) {
1195
- if (empty($categoryTaxonomy) || $categoryTaxonomy === 'category') {
1196
- $cats = wp_get_post_categories($id);
1197
- $merged = array();
1198
- foreach ($cats as $cat) {
1199
- if (! in_array($cat, $category, false)) {
1200
- $merged[] = $cat;
1201
  }
1202
  }
1203
 
1204
- if (wp_update_post(array('ID' => $id, 'post_category' => $merged)) === 0) {
1205
  if (POSTEXPIRATOR_DEBUG) {
1206
  $debug->save(
1207
- array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true))
1208
  );
1209
  }
1210
  } else {
@@ -1217,17 +1239,17 @@ function postexpirator_expire_post($id)
1217
  '##POSTLINK##',
1218
  '##EXPIRATIONDATE##',
1219
  'CATEGORIES',
1220
- implode(',', _postexpirator_get_cat_names($category)),
1221
- implode(',', _postexpirator_get_cat_names($merged))
1222
  );
1223
  if (POSTEXPIRATOR_DEBUG) {
1224
  $debug->save(
1225
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
1226
  );
1227
  $debug->save(
1228
  array(
1229
  'message' => $id . ' -> CATEGORIES REMOVED ' . print_r(
1230
- _postexpirator_get_cat_names($category),
1231
  true
1232
  )
1233
  )
@@ -1235,7 +1257,7 @@ function postexpirator_expire_post($id)
1235
  $debug->save(
1236
  array(
1237
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1238
- _postexpirator_get_cat_names($merged),
1239
  true
1240
  )
1241
  )
@@ -1245,18 +1267,18 @@ function postexpirator_expire_post($id)
1245
  $postWasExpired = true;
1246
  }
1247
  } else {
1248
- $terms = wp_get_object_terms($id, $categoryTaxonomy, array('fields' => 'ids'));
1249
- $merged = array();
1250
  foreach ($terms as $term) {
1251
- if (! in_array($term, $category, false)) {
1252
- $merged[] = $term;
1253
  }
1254
  }
1255
- $terms = array_map('intval', $merged);
1256
- if (is_wp_error(wp_set_object_terms($id, $terms, $categoryTaxonomy, false))) {
1257
  if (POSTEXPIRATOR_DEBUG) {
1258
  $debug->save(
1259
- array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postoptions, true))
1260
  );
1261
  }
1262
  } else {
@@ -1269,17 +1291,17 @@ function postexpirator_expire_post($id)
1269
  '##POSTLINK##',
1270
  '##EXPIRATIONDATE##',
1271
  'CATEGORIES',
1272
- implode(',', _postexpirator_get_cat_names($category)),
1273
- implode(',', _postexpirator_get_cat_names($merged))
1274
  );
1275
  if (POSTEXPIRATOR_DEBUG) {
1276
  $debug->save(
1277
- array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postoptions, true))
1278
  );
1279
  $debug->save(
1280
  array(
1281
  'message' => $id . ' -> CATEGORIES REMOVED ' . print_r(
1282
- _postexpirator_get_cat_names($category),
1283
  true
1284
  )
1285
  )
@@ -1287,7 +1309,7 @@ function postexpirator_expire_post($id)
1287
  $debug->save(
1288
  array(
1289
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1290
- _postexpirator_get_cat_names($category),
1291
  true
1292
  )
1293
  )
@@ -1302,7 +1324,7 @@ function postexpirator_expire_post($id)
1302
  $debug->save(
1303
  array(
1304
  'message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r(
1305
- $postoptions,
1306
  true
1307
  )
1308
  )
@@ -1312,54 +1334,54 @@ function postexpirator_expire_post($id)
1312
  }
1313
 
1314
  // Process Email
1315
- $emailenabled = get_option('expirationdateEmailNotification', POSTEXPIRATOR_EMAILNOTIFICATION);
1316
 
1317
  // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1318
- if ($emailenabled == 1 && isset($emailBody)) {
1319
- $subj = sprintf(__('Post Expiration Complete "%s"', 'post-expirator'), $posttitle);
1320
- $emailBody = str_replace('##POSTTITLE##', $posttitle, $emailBody);
1321
- $emailBody = str_replace('##POSTLINK##', $postlink, $emailBody);
1322
  $emailBody = str_replace(
1323
  '##EXPIRATIONDATE##',
1324
  get_date_from_gmt(
1325
- gmdate('Y-m-d H:i:s', $ed),
1326
  get_option('date_format') . ' ' . get_option('time_format')
1327
  ),
1328
  $emailBody
1329
  );
1330
 
1331
- $emails = array();
1332
  // Get Blog Admins
1333
- $emailadmins = get_option('expirationdateEmailNotificationAdmins', POSTEXPIRATOR_EMAILNOTIFICATIONADMINS);
1334
  // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1335
- if ($emailadmins == 1) {
1336
- $blogusers = get_users('role=Administrator');
1337
- foreach ($blogusers as $user) {
1338
- $emails[] = $user->user_email;
1339
  }
1340
  }
1341
 
1342
  // Get Global Notification Emails
1343
- $emaillist = get_option('expirationdateEmailNotificationList');
1344
- if (! empty($emaillist)) {
1345
- $vals = explode(',', $emaillist);
1346
- foreach ($vals as $val) {
1347
- $emails[] = trim($val);
1348
  }
1349
  }
1350
 
1351
  // Get Post Type Notification Emails
1352
- $defaults = get_option('expirationdateDefaults' . ucfirst($posttype));
1353
  if (isset($defaults['emailnotification']) && ! empty($defaults['emailnotification'])) {
1354
- $vals = explode(',', $defaults['emailnotification']);
1355
- foreach ($vals as $val) {
1356
- $emails[] = trim($val);
1357
  }
1358
  }
1359
 
1360
  // Send Emails
1361
- foreach ($emails as $email) {
1362
- if (wp_mail($email, sprintf(__('[%1$s] %2$s'), get_option('blogname'), $subj), $emailBody)) {
1363
  if (POSTEXPIRATOR_DEBUG) {
1364
  $debug->save(array('message' => $id . ' -> EXPIRATION EMAIL SENT (' . $email . ')'));
1365
  }
@@ -2071,14 +2093,14 @@ function postexpirator_date_save_bulk_edit()
2071
  );
2072
  }
2073
 
2074
- $status = $_POST['expirationdate_status'];
2075
  // if no change, do nothing
2076
  if ($status === 'no-change') {
2077
  return;
2078
  }
2079
 
2080
  // we need the post IDs
2081
- $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : null;
2082
 
2083
  // if we have post IDs
2084
  if (! empty($post_ids) && is_array($post_ids)) {
@@ -2122,10 +2144,10 @@ function postexpirator_date_save_bulk_edit()
2122
 
2123
  if ($update_expiry) {
2124
  $opts = PostExpirator_Facade::get_expire_principles($post_id);
2125
- $opts['expireType'] = $_POST['expirationdate_expiretype'];
2126
 
2127
  if (in_array($opts['expireType'], array('category', 'category-add', 'category-remove'), true)) {
2128
- $opts['category'] = $_POST['expirationdate_category'];
2129
  }
2130
 
2131
  PostExpirator_Facade::set_expire_principles($post_id, $opts);
@@ -2170,4 +2192,3 @@ function postexpirator_launch()
2170
  }
2171
 
2172
  postexpirator_launch();
2173
-
1
  <?php
2
+ /**
3
+ * Plugin Name: PublishPress Future
4
+ * Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
+ * Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
6
+ * Author: PublishPress
7
+ * Version: 2.7.2
8
+ * Author URI: http://publishpress.com
9
+ * Text Domain: post-expirator
10
+ * Domain Path: /languages
11
  */
12
 
13
  // Default Values
14
+ define('POSTEXPIRATOR_VERSION', '2.7.2');
15
  define('POSTEXPIRATOR_DATEFORMAT', __('l F jS, Y', 'post-expirator'));
16
  define('POSTEXPIRATOR_TIMEFORMAT', __('g:ia', 'post-expirator'));
17
  define('POSTEXPIRATOR_FOOTERCONTENTS', __('Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator'));
411
  $categories = $attributes['category'];
412
  }
413
 
414
+ if (PostExpirator_Facade::is_expiration_enabled_for_post($post->ID)) {
415
  $enabled = ' checked="checked"';
416
  }
417
 
582
  $year = date('Y');
583
  }
584
  }
585
+ $category = isset($_POST['expirationdate_category']) ? sanitize_text_field($_POST['expirationdate_category']) : 0;
586
 
587
  $ts = get_gmt_from_date("$year-$month-$day $hour:$minute:0", 'U');
588
 
589
  if (isset($_POST['expirationdate_quickedit'])) {
590
  $opts = PostExpirator_Facade::get_expire_principles($id);
591
  if (isset($_POST['expirationdate_expiretype'])) {
592
+ $opts['expireType'] = sanitize_key($_POST['expirationdate_expiretype']);
593
  if (in_array($opts['expireType'], array(
594
  'category',
595
  'category-add',
596
  'category-remove'
597
  ), true)) {
598
+ $opts['category'] = sanitize_text_field($_POST['expirationdate_category']);
599
  }
600
  }
601
  } else {
602
  // Schedule/Update Expiration
603
+ $opts['expireType'] = sanitize_key($_POST['expirationdate_expiretype']);
604
  $opts['id'] = $id;
605
 
606
  if ($opts['expireType'] === 'category' || $opts['expireType'] === 'category-add' || $opts['expireType'] === 'category-remove') {
607
  if (isset($category) && ! empty($category)) {
608
  if (! empty($category)) {
609
  $opts['category'] = $category;
610
+ $opts['categoryTaxonomy'] = sanitize_text_field($_POST['taxonomy-heirarchical']);
611
  }
612
  }
613
  }
634
 
635
  if (isset($payload['meta'])) {
636
  if (isset($payload['meta']['_expiration-date-status'])) {
637
+ $shouldSchedule = $payload['meta']['_expiration-date-status'] === 'saved'
638
+ && isset($payload['meta']['_expiration-date'])
639
+ && false === empty($payload['meta']['_expiration-date']);
640
  } else {
641
+ $shouldSchedule = PostExpirator_Facade::is_expiration_enabled_for_post($id);
642
  }
643
 
644
+ if ($shouldSchedule) {
645
+ if (isset($payload['meta']['_expiration-date'])) {
646
+ $ts = sanitize_text_field($payload['meta']['_expiration-date']);
647
+ } else {
648
+ $ts = get_post_meta($id, '_expiration-date', true);
649
+ }
650
 
651
+ if (isset($payload['meta']['_expiration-date-type'])) {
652
+ $opts['expireType'] = sanitize_key($payload['meta']['_expiration-date-type']);
653
+ } else {
654
+ $opts['expireType'] = get_post_meta($id, '_expiration-date-type', true);
655
+ }
656
 
657
+ if (isset($payload['meta']['_expiration-date-categories'])) {
658
+ $opts['category'] = array_map('intval', (array)$payload['meta']['_expiration-date-categories']);
659
+ } else {
660
+ $opts['category'] = (array)get_post_meta($id, '_expiration-date-categories', true);
661
+ }
662
  }
663
  } else {
664
+ $shouldSchedule = PostExpirator_Facade::is_expiration_enabled_for_post($id);
665
 
666
  if ($shouldSchedule) {
667
  $ts = get_post_meta($id, '_expiration-date', true);
702
  if (POSTEXPIRATOR_DEBUG) {
703
  $debug->save(
704
  array(
705
+ 'message' => $id . ' -> EXISTING CRON EVENT FOUND - UNSCHEDULED - ' . (is_wp_error(
706
  $error
707
  ) ? $error->get_error_message() : 'no error')
708
  )
710
  }
711
  }
712
 
713
+ $scheduled = wp_schedule_single_event($ts, 'postExpiratorExpire', array($id), true);
714
  if (POSTEXPIRATOR_DEBUG) {
715
+ if ($scheduled) {
716
+ $debug->save(
717
+ array(
718
+ 'message' => $id . ' -> CRON EVENT SCHEDULED at ' .
719
+ PostExpirator_Util::get_wp_date('r', $ts)
720
+ . ' ' . '(' . $ts . ') with options ' . print_r($opts, true) . ' no error'
721
+ )
722
+ );
723
+ } else {
724
+ $debug->save(
725
+ array(
726
+ 'message' => $id . ' -> TRIED TO SCHEDULE CRON EVENT at ' .
727
+ PostExpirator_Util::get_wp_date('r', $ts)
728
+ . ' ' . '(' . $ts . ') with options ' . print_r($opts, true) . ' ' . (is_wp_error(
729
+ $scheduled
730
+ ) ? $scheduled->get_error_message() : 'no error')
731
+ )
732
+ );
733
+ }
734
  }
735
 
736
  // Update Post Meta
801
  return false;
802
  }
803
 
804
+ $postExpireOptions = PostExpirator_Facade::get_expire_principles($id);
805
 
806
+ if ($postExpireOptions['enabled'] === false) {
807
  if (POSTEXPIRATOR_DEBUG) {
808
  $debug->save(array('message' => $id . ' -> Post expire data exist but is not activated'));
809
  }
811
  return false;
812
  }
813
 
814
+ $postType = get_post_type($id);
815
+ $postTitle = get_the_title($id);
816
+ $postLink = get_post_permalink($id);
817
 
818
+ $expireType = $expireCategory = $expireCategoryTaxonomy = null;
819
 
820
+ if (isset($postExpireOptions['expireType'])) {
821
+ $expireType = $postExpireOptions['expireType'];
822
  }
823
 
824
+ if (isset($postExpireOptions['category'])) {
825
+ $expireCategory = $postExpireOptions['category'];
826
  }
827
 
828
+ if (isset($postExpireOptions['categoryTaxonomy'])) {
829
+ $expireCategoryTaxonomy = $postExpireOptions['categoryTaxonomy'];
830
  }
831
 
832
+ $expirationDate = (int)get_post_meta($id, '_expiration-date', true);
833
+
834
+ if (empty($expirationDate)) {
835
+ if (POSTEXPIRATOR_DEBUG) {
836
+ $debug->save(array('message' => $id . ' -> Tried to expire the post but the expire date is empty'));
837
+ }
838
+
839
+ return false;
840
+ }
841
 
842
  // Check for default expire only if not passed in
843
  if (empty($expireType)) {
844
+ $postType = get_post_type($id);
845
+ if ($postType === 'page') {
846
  $expireType = strtolower(get_option('expirationdateExpiredPageStatus', POSTEXPIRATOR_PAGESTATUS));
847
+ } elseif ($postType === 'post') {
848
  $expireType = strtolower(get_option('expirationdateExpiredPostStatus', 'draft'));
849
  } else {
850
  $expireType = apply_filters(
851
  'postexpirator_custom_posttype_expire',
852
  $expireType,
853
+ $postType
854
  ); // hook to set defaults for custom post types
855
  }
856
  }
866
  if ($expireType === 'draft') {
867
  if (wp_update_post(array('ID' => $id, 'post_status' => 'draft')) === 0) {
868
  if (POSTEXPIRATOR_DEBUG) {
869
+ $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
870
  }
871
  } else {
872
  $emailBody = sprintf(
881
  );
882
  if (POSTEXPIRATOR_DEBUG) {
883
  $debug->save(
884
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
885
  );
886
  }
887
 
890
  } elseif ($expireType === 'private') {
891
  if (wp_update_post(array('ID' => $id, 'post_status' => 'private')) === 0) {
892
  if (POSTEXPIRATOR_DEBUG) {
893
+ $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
894
  }
895
  } else {
896
  $emailBody = sprintf(
905
  );
906
  if (POSTEXPIRATOR_DEBUG) {
907
  $debug->save(
908
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
909
  );
910
  }
911
 
914
  } elseif ($expireType === 'delete') {
915
  if (wp_delete_post($id) === false) {
916
  if (POSTEXPIRATOR_DEBUG) {
917
+ $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
918
  }
919
  } else {
920
  $emailBody = sprintf(
929
  );
930
  if (POSTEXPIRATOR_DEBUG) {
931
  $debug->save(
932
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
933
  );
934
  }
935
 
938
  } elseif ($expireType === 'trash') {
939
  if (wp_trash_post($id) === false) {
940
  if (POSTEXPIRATOR_DEBUG) {
941
+ $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
942
  }
943
  } else {
944
  $emailBody = sprintf(
953
  );
954
  if (POSTEXPIRATOR_DEBUG) {
955
  $debug->save(
956
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
957
  );
958
  }
959
 
962
  } elseif ($expireType === 'stick') {
963
  if (stick_post($id) === false) {
964
  if (POSTEXPIRATOR_DEBUG) {
965
+ $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
966
  }
967
  } else {
968
  $emailBody = sprintf(
974
  );
975
  if (POSTEXPIRATOR_DEBUG) {
976
  $debug->save(
977
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
978
  );
979
  }
980
 
983
  } elseif ($expireType === 'unstick') {
984
  if (unstick_post($id) === false) {
985
  if (POSTEXPIRATOR_DEBUG) {
986
+ $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
987
  }
988
  } else {
989
  $emailBody = sprintf(
998
  );
999
  if (POSTEXPIRATOR_DEBUG) {
1000
  $debug->save(
1001
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1002
  );
1003
  }
1004
 
1005
  $postWasExpired = true;
1006
  }
1007
  } elseif ($expireType === 'category') {
1008
+ if (! empty($expireCategory)) {
1009
+ if (empty($expireCategoryTaxonomy) || $expireCategoryTaxonomy === 'category') {
1010
+ if (wp_update_post(array('ID' => $id, 'post_category' => $expireCategory)) === 0) {
1011
  if (POSTEXPIRATOR_DEBUG) {
1012
  $debug->save(
1013
+ array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1014
  );
1015
  }
1016
  } else {
1023
  '##POSTLINK##',
1024
  '##EXPIRATIONDATE##',
1025
  'CATEGORIES',
1026
+ implode(',', _postexpirator_get_cat_names($expireCategory))
1027
  );
1028
  if (POSTEXPIRATOR_DEBUG) {
1029
  $debug->save(
1030
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1031
  );
1032
  $debug->save(
1033
  array(
1034
  'message' => $id . ' -> CATEGORIES REPLACED ' . print_r(
1035
+ _postexpirator_get_cat_names($expireCategory),
1036
  true
1037
  )
1038
  )
1040
  $debug->save(
1041
  array(
1042
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1043
+ _postexpirator_get_cat_names($expireCategory),
1044
  true
1045
  )
1046
  )
1050
  $postWasExpired = true;
1051
  }
1052
  } else {
1053
+ $terms = array_map('intval', $expireCategory);
1054
+ if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, false))) {
1055
  if (POSTEXPIRATOR_DEBUG) {
1056
  $debug->save(
1057
+ array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1058
  );
1059
  }
1060
  } else {
1067
  '##POSTLINK##',
1068
  '##EXPIRATIONDATE##',
1069
  'CATEGORIES',
1070
+ implode(',', _postexpirator_get_cat_names($expireCategory))
1071
  );
1072
  if (POSTEXPIRATOR_DEBUG) {
1073
  $debug->save(
1074
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1075
  );
1076
  $debug->save(
1077
  array(
1078
  'message' => $id . ' -> CATEGORIES REPLACED ' . print_r(
1079
+ _postexpirator_get_cat_names($expireCategory),
1080
  true
1081
  )
1082
  )
1084
  $debug->save(
1085
  array(
1086
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1087
+ _postexpirator_get_cat_names($expireCategory),
1088
  true
1089
  )
1090
  )
1099
  $debug->save(
1100
  array(
1101
  'message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r(
1102
+ $postExpireOptions,
1103
  true
1104
  )
1105
  )
1107
  }
1108
  }
1109
  } elseif ($expireType === 'category-add') {
1110
+ if (! empty($expireCategory)) {
1111
+ if (empty($expireCategoryTaxonomy) || $expireCategoryTaxonomy === 'category') {
1112
+ $postCategories = wp_get_post_categories($id);
1113
+ $mergedCategories = array_merge($postCategories, $expireCategory);
1114
+ if (wp_update_post(array('ID' => $id, 'post_category' => $mergedCategories)) === 0) {
1115
  if (POSTEXPIRATOR_DEBUG) {
1116
  $debug->save(
1117
+ array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1118
  );
1119
  }
1120
  } else {
1127
  '##POSTLINK##',
1128
  '##EXPIRATIONDATE##',
1129
  'CATEGORIES',
1130
+ implode(',', _postexpirator_get_cat_names($expireCategory)),
1131
+ implode(',', _postexpirator_get_cat_names($mergedCategories))
1132
  );
1133
  if (POSTEXPIRATOR_DEBUG) {
1134
  $debug->save(
1135
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1136
  );
1137
  $debug->save(
1138
  array(
1139
  'message' => $id . ' -> CATEGORIES ADDED ' . print_r(
1140
+ _postexpirator_get_cat_names($expireCategory),
1141
  true
1142
  )
1143
  )
1145
  $debug->save(
1146
  array(
1147
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1148
+ _postexpirator_get_cat_names($mergedCategories),
1149
  true
1150
  )
1151
  )
1155
  $postWasExpired = true;
1156
  }
1157
  } else {
1158
+ $terms = array_map('intval', $expireCategory);
1159
+ if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, true))) {
1160
  if (POSTEXPIRATOR_DEBUG) {
1161
  $debug->save(
1162
+ array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1163
  );
1164
  }
1165
  } else {
1172
  '##POSTLINK##',
1173
  '##EXPIRATIONDATE##',
1174
  'CATEGORIES',
1175
+ implode(',', _postexpirator_get_cat_names($expireCategory)),
1176
  implode(',', _postexpirator_get_cat_names($terms))
1177
  );
1178
  if (POSTEXPIRATOR_DEBUG) {
1179
  $debug->save(
1180
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1181
  );
1182
  $debug->save(
1183
  array(
1184
  'message' => $id . ' -> CATEGORIES ADDED ' . print_r(
1185
+ _postexpirator_get_cat_names($expireCategory),
1186
  true
1187
  )
1188
  )
1190
  $debug->save(
1191
  array(
1192
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1193
+ _postexpirator_get_cat_names($expireCategory),
1194
  true
1195
  )
1196
  )
1205
  $debug->save(
1206
  array(
1207
  'message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r(
1208
+ $postExpireOptions,
1209
  true
1210
  )
1211
  )
1213
  }
1214
  }
1215
  } elseif ($expireType === 'category-remove') {
1216
+ if (! empty($expireCategory)) {
1217
+ if (empty($expireCategoryTaxonomy) || $expireCategoryTaxonomy === 'category') {
1218
+ $postCategories = wp_get_post_categories($id);
1219
+ $mergedCategories = array();
1220
+ foreach ($postCategories as $category) {
1221
+ if (! in_array($category, $expireCategory, false)) {
1222
+ $mergedCategories[] = $category;
1223
  }
1224
  }
1225
 
1226
+ if (wp_update_post(array('ID' => $id, 'post_category' => $mergedCategories)) === 0) {
1227
  if (POSTEXPIRATOR_DEBUG) {
1228
  $debug->save(
1229
+ array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1230
  );
1231
  }
1232
  } else {
1239
  '##POSTLINK##',
1240
  '##EXPIRATIONDATE##',
1241
  'CATEGORIES',
1242
+ implode(',', _postexpirator_get_cat_names($expireCategory)),
1243
+ implode(',', _postexpirator_get_cat_names($mergedCategories))
1244
  );
1245
  if (POSTEXPIRATOR_DEBUG) {
1246
  $debug->save(
1247
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1248
  );
1249
  $debug->save(
1250
  array(
1251
  'message' => $id . ' -> CATEGORIES REMOVED ' . print_r(
1252
+ _postexpirator_get_cat_names($expireCategory),
1253
  true
1254
  )
1255
  )
1257
  $debug->save(
1258
  array(
1259
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1260
+ _postexpirator_get_cat_names($mergedCategories),
1261
  true
1262
  )
1263
  )
1267
  $postWasExpired = true;
1268
  }
1269
  } else {
1270
+ $terms = wp_get_object_terms($id, $expireCategoryTaxonomy, array('fields' => 'ids'));
1271
+ $mergedCategories = array();
1272
  foreach ($terms as $term) {
1273
+ if (! in_array($term, $expireCategory, false)) {
1274
+ $mergedCategories[] = $term;
1275
  }
1276
  }
1277
+ $terms = array_map('intval', $mergedCategories);
1278
+ if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, false))) {
1279
  if (POSTEXPIRATOR_DEBUG) {
1280
  $debug->save(
1281
+ array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1282
  );
1283
  }
1284
  } else {
1291
  '##POSTLINK##',
1292
  '##EXPIRATIONDATE##',
1293
  'CATEGORIES',
1294
+ implode(',', _postexpirator_get_cat_names($expireCategory)),
1295
+ implode(',', _postexpirator_get_cat_names($mergedCategories))
1296
  );
1297
  if (POSTEXPIRATOR_DEBUG) {
1298
  $debug->save(
1299
+ array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r($postExpireOptions, true))
1300
  );
1301
  $debug->save(
1302
  array(
1303
  'message' => $id . ' -> CATEGORIES REMOVED ' . print_r(
1304
+ _postexpirator_get_cat_names($expireCategory),
1305
  true
1306
  )
1307
  )
1309
  $debug->save(
1310
  array(
1311
  'message' => $id . ' -> CATEGORIES COMPLETE ' . print_r(
1312
+ _postexpirator_get_cat_names($expireCategory),
1313
  true
1314
  )
1315
  )
1324
  $debug->save(
1325
  array(
1326
  'message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r(
1327
+ $postExpireOptions,
1328
  true
1329
  )
1330
  )
1334
  }
1335
 
1336
  // Process Email
1337
+ $emailEnabled = get_option('expirationdateEmailNotification', POSTEXPIRATOR_EMAILNOTIFICATION);
1338
 
1339
  // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1340
+ if ($emailEnabled == 1 && isset($emailBody)) {
1341
+ $emailSubject = sprintf(__('Post Expiration Complete "%s"', 'post-expirator'), $postTitle);
1342
+ $emailBody = str_replace('##POSTTITLE##', $postTitle, $emailBody);
1343
+ $emailBody = str_replace('##POSTLINK##', $postLink, $emailBody);
1344
  $emailBody = str_replace(
1345
  '##EXPIRATIONDATE##',
1346
  get_date_from_gmt(
1347
+ gmdate('Y-m-d H:i:s', $expirationDate),
1348
  get_option('date_format') . ' ' . get_option('time_format')
1349
  ),
1350
  $emailBody
1351
  );
1352
 
1353
+ $emailsToSend = array();
1354
  // Get Blog Admins
1355
+ $blogAdmins = get_option('expirationdateEmailNotificationAdmins', POSTEXPIRATOR_EMAILNOTIFICATIONADMINS);
1356
  // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1357
+ if ($blogAdmins == 1) {
1358
+ $blogUsers = get_users('role=Administrator');
1359
+ foreach ($blogUsers as $user) {
1360
+ $emailsToSend[] = $user->user_email;
1361
  }
1362
  }
1363
 
1364
  // Get Global Notification Emails
1365
+ $emailsList = get_option('expirationdateEmailNotificationList');
1366
+ if (! empty($emailsList)) {
1367
+ $values = explode(',', $emailsList);
1368
+ foreach ($values as $value) {
1369
+ $emailsToSend[] = trim($value);
1370
  }
1371
  }
1372
 
1373
  // Get Post Type Notification Emails
1374
+ $defaults = get_option('expirationdateDefaults' . ucfirst($postType));
1375
  if (isset($defaults['emailnotification']) && ! empty($defaults['emailnotification'])) {
1376
+ $values = explode(',', $defaults['emailnotification']);
1377
+ foreach ($values as $value) {
1378
+ $emailsToSend[] = trim($value);
1379
  }
1380
  }
1381
 
1382
  // Send Emails
1383
+ foreach ($emailsToSend as $email) {
1384
+ if (wp_mail($email, sprintf(__('[%1$s] %2$s'), get_option('blogname'), $emailSubject), $emailBody)) {
1385
  if (POSTEXPIRATOR_DEBUG) {
1386
  $debug->save(array('message' => $id . ' -> EXPIRATION EMAIL SENT (' . $email . ')'));
1387
  }
2093
  );
2094
  }
2095
 
2096
+ $status = sanitize_key($_POST['expirationdate_status']);
2097
  // if no change, do nothing
2098
  if ($status === 'no-change') {
2099
  return;
2100
  }
2101
 
2102
  // we need the post IDs
2103
+ $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? array_map('intval', $_POST['post_ids']) : null;
2104
 
2105
  // if we have post IDs
2106
  if (! empty($post_ids) && is_array($post_ids)) {
2144
 
2145
  if ($update_expiry) {
2146
  $opts = PostExpirator_Facade::get_expire_principles($post_id);
2147
+ $opts['expireType'] = sanitize_key($_POST['expirationdate_expiretype']);
2148
 
2149
  if (in_array($opts['expireType'], array('category', 'category-add', 'category-remove'), true)) {
2150
+ $opts['category'] = sanitize_text_field($_POST['expirationdate_category']);
2151
  }
2152
 
2153
  PostExpirator_Facade::set_expire_principles($post_id, $opts);
2192
  }
2193
 
2194
  postexpirator_launch();
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Author: publishpress
4
  Author URI: https://publishpress.com
5
  Tags: expire, posts, pages, schedule
6
  Requires at least: 5.3
7
- Tested up to: 5.8
8
- Stable tag: 2.7.1
9
 
10
  Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
11
 
@@ -81,7 +81,21 @@ This section describes how to install the plugin and get it working.
81
 
82
  == Changelog ==
83
 
84
- = [2.7.1] - 12 Jan 2021 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  * Added: Add visual indicator to the cron event status in the settings page, #155;
87
  * Added: Add small help text to the Expires column icon to say if the event is scheduled or not;
@@ -107,7 +121,7 @@ This section describes how to install the plugin and get it working.
107
 
108
  = [2.7.0] - 02 Dec 2021 =
109
 
110
- * Changed: Rename the plugin from Post Expirator to PublishpPress Future, #14;
111
  * Changed: Add the PublishPress footer and branding, #68;
112
  * Changed: Separate the settings into different tabs, #97, #98;
113
  * Changed: Rename the "General Settings" tab to "Default", #99;
4
  Author URI: https://publishpress.com
5
  Tags: expire, posts, pages, schedule
6
  Requires at least: 5.3
7
+ Tested up to: 5.9
8
+ Stable tag: 2.7.2
9
 
10
  Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
11
 
81
 
82
  == Changelog ==
83
 
84
+ = [2.7.2] - 25 Jan 2022 =
85
+
86
+ * Changed: Added more clear debug message if the cron event was not scheduled due to an error;
87
+ * Changed: Refactored the list of cron schedules in the Diagnostics tab adding more post information, #215;
88
+ * Changed: Removed the admin notice about the plugin renaming;
89
+ * Added: Added the event GUID as tooltip to each post in the Current Cron Schedule list on the Diagnostics page, #214;
90
+ * Fixed: Fix the Expires column in the posts page correctly identifying the post ID on cron event with multiple IDs, #210;
91
+ * Fixed: Fix wrong function used to escape a html attributes on a setting page;
92
+ * Fixed: Fix missed sanitization for some data on admin pages;
93
+ * Fixed: Fix some false positives given by PHPCS;
94
+ * Fixed: Fix expiration data processing avoid to process for deactivated posts;
95
+ * Fixed: Fix a typo in the diagnostics settings tab;
96
+ * Fixed: Fix the checkbox state for posts that are not set to expire, #217;
97
+
98
+ = [2.7.1] - 12 Jan 2022 =
99
 
100
  * Added: Add visual indicator to the cron event status in the settings page, #155;
101
  * Added: Add small help text to the Expires column icon to say if the event is scheduled or not;
121
 
122
  = [2.7.0] - 02 Dec 2021 =
123
 
124
+ * Changed: Rename the plugin from Post Expirator to PublishPress Future, #14;
125
  * Changed: Add the PublishPress footer and branding, #68;
126
  * Changed: Separate the settings into different tabs, #97, #98;
127
  * Changed: Rename the "General Settings" tab to "Default", #99;
vendor/composer/installed.php CHANGED
@@ -5,7 +5,7 @@
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'ac0b7c2907e628fbe2025d0736f2475461b598b3',
9
  'name' => 'publishpress/post-expirator',
10
  'dev' => false,
11
  ),
@@ -16,7 +16,7 @@
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => 'ac0b7c2907e628fbe2025d0736f2475461b598b3',
20
  'dev_requirement' => false,
21
  ),
22
  'publishpress/wordpress-reviews' => array(
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '4ab57aa3db2408590485ab6e879694d6f460c13d',
9
  'name' => 'publishpress/post-expirator',
10
  'dev' => false,
11
  ),
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => '4ab57aa3db2408590485ab6e879694d6f460c13d',
20
  'dev_requirement' => false,
21
  ),
22
  'publishpress/wordpress-reviews' => array(
views/bulk-edit.php CHANGED
@@ -31,11 +31,11 @@ $minute = $defaults['minute'];
31
  </option>
32
  <option value="change-only" data-show-fields="true"
33
  title="<?php
34
- esc_html_e('Change expiry date if enabled on posts', 'post-expirator'); ?>"><?php
35
  esc_html_e('Change on posts', 'post-expirator'); ?></option>
36
  <option value="add-only" data-show-fields="true"
37
  title="<?php
38
- esc_html_e('Add expiry date if not enabled on posts', 'post-expirator'); ?>"><?php
39
  esc_html_e('Add to posts', 'post-expirator'); ?></option>
40
  <option value="change-add"
41
  data-show-fields="true"><?php
31
  </option>
32
  <option value="change-only" data-show-fields="true"
33
  title="<?php
34
+ esc_attr_e('Change expiry date if enabled on posts', 'post-expirator'); ?>"><?php
35
  esc_html_e('Change on posts', 'post-expirator'); ?></option>
36
  <option value="add-only" data-show-fields="true"
37
  title="<?php
38
+ esc_attr_e('Add expiry date if not enabled on posts', 'post-expirator'); ?>"><?php
39
  esc_html_e('Add to posts', 'post-expirator'); ?></option>
40
  <option value="change-add"
41
  data-show-fields="true"><?php
views/menu-defaults.php CHANGED
@@ -244,6 +244,6 @@ defined('ABSPATH') or die('Direct access not allowed.');
244
  ?>
245
  <p class="submit">
246
  <input type="submit" name="expirationdateSaveDefaults" class="button-primary" value="<?php
247
- esc_html_e('Save Changes', 'post-expirator'); ?>"/>
248
  </p>
249
  </form>
244
  ?>
245
  <p class="submit">
246
  <input type="submit" name="expirationdateSaveDefaults" class="button-primary" value="<?php
247
+ esc_attr_e('Save Changes', 'post-expirator'); ?>"/>
248
  </p>
249
  </form>
views/menu-diagnostics.php CHANGED
@@ -12,31 +12,31 @@ defined('ABSPATH') or die('Direct access not allowed.');
12
  <th scope="row"><label for="postexpirator-log"><?php
13
  esc_html_e('Debug Logging', 'post-expirator'); ?></label></th>
14
  <td>
15
- <?php
16
- if (defined('POSTEXPIRATOR_DEBUG') && POSTEXPIRATOR_DEBUG) : ?>
17
  <i class="dashicons dashicons-yes-alt pe-status pe-status-enabled"></i> <span><?php
18
  esc_html_e('Enabled', 'post-expirator'); ?></span>
19
  <?php
20
- echo '<input type="submit" class="button" name="debugging-disable" id="debugging-disable" value=" ' . esc_html__(
 
21
  'Disable Debugging',
22
  'post-expirator'
23
  ) . '" />'; ?>
24
  <?php
25
- echo '<a href="' . esc_url(admin_url(
 
26
  'admin.php?page=publishpress-future&tab=viewdebug'
27
- )) . '">' . esc_html__('View Debug Logs', 'post-expirator') . '</a>'; ?>
28
- <?php
29
- else: ?>
30
  <i class="dashicons dashicons-no-alt pe-status pe-status-disabled"></i> <span><?php
31
  esc_html_e('Disabled', 'post-expirator'); ?></span>
32
  <?php
33
- echo '<input type="submit" class="button" name="debugging-enable" id="debugging-enable" value=" ' . esc_html__(
 
34
  'Enable Debugging',
35
  'post-expirator'
36
  ) . '" />'; ?>
37
- <?php
38
- endif;
39
- ?>
40
  </td>
41
  </tr>
42
  <tr>
@@ -44,26 +44,22 @@ defined('ABSPATH') or die('Direct access not allowed.');
44
  esc_html_e('Purge Debug Log', 'post-expirator'); ?></th>
45
  <td>
46
  <input type="submit" class="button" name="purge-debug" id="purge-debug" value="<?php
47
- esc_html_e('Purge Debug Log', 'post-expirator'); ?>"/>
48
  </td>
49
  </tr>
50
  <tr>
51
  <th scope="row"><?php
52
  esc_html_e('WP-Cron Status', 'post-expirator'); ?></th>
53
  <td>
54
- <?php
55
- if (PostExpirator_CronFacade::is_cron_enabled()) : ?>
56
  <i class="dashicons dashicons-yes pe-status pe-status-enabled"></i> <span><?php
57
  esc_html_e('Enabled', 'post-expirator'); ?></span>
58
- <?php
59
- else: ?>
60
  <i class="dashicons dashicons-no pe-status pe-status-disabled"></i> <span><?php
61
  esc_html_e('Disabled', 'post-expirator'); ?></span>
62
- <?php
63
- endif;
64
- ?>
65
  </td>
66
- </tr/>
67
  <tr>
68
  <th scope="row"><label for="cron-schedule"><?php
69
  esc_html_e('Current Cron Schedule', 'post-expirator'); ?></label></th>
@@ -82,73 +78,72 @@ defined('ABSPATH') or die('Direct access not allowed.');
82
  } else {
83
  ?>
84
  <p><?php
 
85
  esc_html_e(
86
- 'The below table will show all currently scheduled cron events for the pluginwith the next run time.',
87
  'post-expirator'
88
- ); ?></p>
 
 
89
 
90
  <div>
91
- <table class="striped">
92
- <tr>
93
- <th><?php
94
- esc_html_e('Date', 'post-expirator'); ?></th>
95
- <th><?php
96
- esc_html_e('Event', 'post-expirator'); ?></th>
97
- <th><?php
98
- esc_html_e('Arguments / Schedule', 'post-expirator'); ?></th>
99
- <th><?php
100
- esc_html_e('Post', 'post-expirator'); ?></th>
101
- </tr>
102
- <?php
103
-
104
- foreach ($cron as $time => $value) {
105
- foreach ($value as $eventkey => $eventvalue) {
106
- echo '<tr class="pe-event">';
107
- echo '<td>' . esc_html(PostExpirator_Util::get_wp_date('r', $time)) . '</td>';
108
- echo '<td>' . esc_html($eventkey) . '</td>';
109
- $arrkey = array_keys($eventvalue);
110
- $firstArgsUid = null;
111
- echo '<td>';
112
- foreach ($arrkey as $eventguid) {
113
- if (is_null($firstArgsUid)) {
114
- $firstArgsUid = $eventguid;
115
- }
116
- if (empty($eventvalue[$eventguid]['args'])) {
117
- echo '<div>' . esc_html__('No Arguments', 'post-expirator') . '</div>';
118
- } else {
119
- echo '<div>';
120
- foreach ($eventvalue[$eventguid]['args'] as $key => $value) {
121
- echo esc_html("$key => $value") . '<br>';
122
- }
123
- echo '</div>';
124
- }
125
- }
126
- echo '&nbsp;/&nbsp;';
127
- if (empty($eventvalue[$eventguid]['schedule'])) {
128
- echo esc_html__('Single Event', 'post-expirator');
129
- } else {
130
- echo esc_html($eventvalue[$eventguid]['schedule']) . ' (' . esc_html($eventvalue[$eventguid]['interval']) . ')';
131
- }
132
- echo '</td>';
133
 
134
- echo '<td>';
135
- if (
136
- isset($eventvalue[$firstArgsUid])
137
- && isset($eventvalue[$firstArgsUid]['args'])
138
- && isset($eventvalue[$firstArgsUid]['args'][0])
139
- && ! empty($eventvalue[$firstArgsUid]['args'][0])
140
- ) {
141
- $post = get_post((int)$eventvalue[$firstArgsUid]['args'][0]);
 
 
 
 
 
 
142
 
143
- if (! empty($post) && ! is_wp_error($post) && is_object($post)) {
144
- echo esc_html("{$post->ID}: {$post->post_title} ({$post->post_status})");
 
 
 
 
 
 
 
 
 
 
 
145
  }
146
  }
147
- echo '</td>';
148
- echo '</tr>';
149
- }
150
- }
151
- ?>
152
  </table>
153
  </div>
154
  <?php
12
  <th scope="row"><label for="postexpirator-log"><?php
13
  esc_html_e('Debug Logging', 'post-expirator'); ?></label></th>
14
  <td>
15
+ <?php if (defined('POSTEXPIRATOR_DEBUG') && POSTEXPIRATOR_DEBUG) : ?>
 
16
  <i class="dashicons dashicons-yes-alt pe-status pe-status-enabled"></i> <span><?php
17
  esc_html_e('Enabled', 'post-expirator'); ?></span>
18
  <?php
19
+ echo '<input type="submit" class="button" name="debugging-disable" id="debugging-disable" value=" '
20
+ . esc_html__(
21
  'Disable Debugging',
22
  'post-expirator'
23
  ) . '" />'; ?>
24
  <?php
25
+ echo '<a href="' . esc_url(
26
+ admin_url(
27
  'admin.php?page=publishpress-future&tab=viewdebug'
28
+ )
29
+ ) . '">' . esc_html__('View Debug Logs', 'post-expirator') . '</a>'; ?>
30
+ <?php else : ?>
31
  <i class="dashicons dashicons-no-alt pe-status pe-status-disabled"></i> <span><?php
32
  esc_html_e('Disabled', 'post-expirator'); ?></span>
33
  <?php
34
+ echo '<input type="submit" class="button" name="debugging-enable" id="debugging-enable" value=" '
35
+ . esc_html__(
36
  'Enable Debugging',
37
  'post-expirator'
38
  ) . '" />'; ?>
39
+ <?php endif; ?>
 
 
40
  </td>
41
  </tr>
42
  <tr>
44
  esc_html_e('Purge Debug Log', 'post-expirator'); ?></th>
45
  <td>
46
  <input type="submit" class="button" name="purge-debug" id="purge-debug" value="<?php
47
+ esc_attr_e('Purge Debug Log', 'post-expirator'); ?>"/>
48
  </td>
49
  </tr>
50
  <tr>
51
  <th scope="row"><?php
52
  esc_html_e('WP-Cron Status', 'post-expirator'); ?></th>
53
  <td>
54
+ <?php if (PostExpirator_CronFacade::is_cron_enabled()) : ?>
 
55
  <i class="dashicons dashicons-yes pe-status pe-status-enabled"></i> <span><?php
56
  esc_html_e('Enabled', 'post-expirator'); ?></span>
57
+ <?php else : ?>
 
58
  <i class="dashicons dashicons-no pe-status pe-status-disabled"></i> <span><?php
59
  esc_html_e('Disabled', 'post-expirator'); ?></span>
60
+ <?php endif; ?>
 
 
61
  </td>
62
+ </tr>
63
  <tr>
64
  <th scope="row"><label for="cron-schedule"><?php
65
  esc_html_e('Current Cron Schedule', 'post-expirator'); ?></label></th>
78
  } else {
79
  ?>
80
  <p><?php
81
+ // phpcs:disable Generic.Files.LineLength.TooLong
82
  esc_html_e(
83
+ 'The below table will show all currently scheduled cron events for the plugin with the next run time.',
84
  'post-expirator'
85
+ );
86
+ // phpcs:enable
87
+ ?></p>
88
 
89
  <div>
90
+ <table class="striped wp-list-table widefat fixed table-view-list">
91
+ <thead>
92
+ <tr>
93
+ <th class="pe-date-column">
94
+ <?php esc_html_e('Date', 'post-expirator'); ?>
95
+ </th>
96
+ <th class="pe-event-column">
97
+ <?php esc_html_e('Event', 'post-expirator'); ?>
98
+ </th>
99
+ <th>
100
+ <?php esc_html_e('Posts and expiration settings', 'post-expirator'); ?>
101
+ </th>
102
+ </tr>
103
+ </thead>
104
+ <tbody>
105
+ <?php
106
+ $printPostEvent = function ($post) {
107
+ echo esc_html("$post->ID: $post->post_title (status: $post->post_status)");
108
+ $attributes = PostExpirator_Facade::get_expire_principles($post->ID);
109
+ echo ': <span class="post-expiration-attributes">';
110
+ // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
111
+ print_r($attributes);
112
+ echo '</span>';
113
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
+ // phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
116
+ foreach ($cron as $time => $value) {
117
+ foreach ($value as $eventKey => $eventValue) {
118
+ echo '<tr class="pe-event">';
119
+ echo '<td>' . esc_html(PostExpirator_Util::get_wp_date('r', $time))
120
+ . '</td>';
121
+ echo '<td>' . esc_html($eventKey) . '</td>';
122
+ $eventValueKeys = array_keys($eventValue);
123
+ echo '<td>';
124
+ foreach ($eventValueKeys as $eventGUID) {
125
+ if (false === empty($eventValue[$eventGUID]['args'])) {
126
+ echo '<div class="pe-event-post" title="' . esc_attr($eventGUID) . '">';
127
+ foreach ($eventValue[$eventGUID]['args'] as $value) {
128
+ $eventPost = get_post((int)$value);
129
 
130
+ if (
131
+ false === empty($eventPost)
132
+ && false === is_wp_error($eventPost)
133
+ && is_object($eventPost)
134
+ ) {
135
+ $printPostEvent($eventPost);
136
+ }
137
+ }
138
+ echo '</div>';
139
+ }
140
+ }
141
+ echo '</td>';
142
+ echo '</tr>';
143
  }
144
  }
145
+ // phpcs:enable ?>
146
+ </tbody>
 
 
 
147
  </table>
148
  </div>
149
  <?php
views/menu-display.php CHANGED
@@ -129,7 +129,7 @@ $expirationdateDefaultTimeFormat = get_option('expirationdateDefaultTimeFormat',
129
 
130
  <p class="submit">
131
  <input type="submit" name="expirationdateSaveDisplay" class="button-primary" value="<?php
132
- esc_html_e('Save Changes', 'post-expirator'); ?>"/>
133
  </p>
134
  </form>
135
 
129
 
130
  <p class="submit">
131
  <input type="submit" name="expirationdateSaveDisplay" class="button-primary" value="<?php
132
+ esc_attr_e('Save Changes', 'post-expirator'); ?>"/>
133
  </p>
134
  </form>
135
 
views/menu-general.php CHANGED
@@ -240,7 +240,7 @@ $plugin_facade = PostExpirator_Facade::getInstance();
240
  <p class="submit">
241
  <input type="submit" name="expirationdateSave" class="button-primary"
242
  value="<?php
243
- esc_html_e('Save Changes', 'post-expirator'); ?>"/>
244
  </p>
245
  </form>
246
 
240
  <p class="submit">
241
  <input type="submit" name="expirationdateSave" class="button-primary"
242
  value="<?php
243
+ esc_attr_e('Save Changes', 'post-expirator'); ?>"/>
244
  </p>
245
  </form>
246