From f9f146c669a3405d78a2826de005722a182e4b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anderson=20Gr=C3=BCdtner=20Martins?= Date: Tue, 4 Jul 2023 19:03:28 -0300 Subject: [PATCH] Release 3.0.4 * Update dev-workspace using the generic image * Refactor the block editor component, #449 * Fix minor code style issue * Fix the name of the docker image in the build-push command * Update composer commands * Fix auto-enabled on block editor * Fix the taxonomy field for custom post types * Fix warning message when post type has no taxonomy assigned * Fix issue #484 * Fix selected categories in the classic editor, #481 * Update French translation, #473 * Update JS files with production versions * Update action-scheduler from 3.6.0 to 3.6.1 * Update the changelog * Fix JS error when expiration is not yet enabled * Fix future action set using default settings * Restore the dev-wokspace on previous version Until we are able to move to lib/vendor architectture. * Fix plugin initialization, fixing translation * Bump version to 3.0.4-rc.2 * Fix list of files to be removed after composer install runs while building * Fix default auto activation on new posts * Bump version to 3.0.4-rc.3 * Fix oh-my-zshell on dev-workspace * Update the changelog * Install WP-CLI on dev-workspace * Fix the gen:pot command on composer file * Update the POT file * Update the changelog * Update version ot 3.0.4 * Update version on POT file * Update issue templates * Update JS files --- .github/ISSUE_TEMPLATE/release-free-plugin.md | 10 +- .github/ISSUE_TEMPLATE/release-pro-plugin.md | 10 +- .rsync-filters-post-build | 38 +- .rsync-filters-pre-build | 26 +- assets/js/gutenberg-panel.js | 2 +- assets/js/gutenberg-panel.js.map | 2 +- .../jsx/gutenberg-panel/gutenberg-panel.jsx | 729 ++++++----- composer.json | 42 +- composer.lock | 74 +- dev-workspace/docker/Dockerfile | 15 +- dev-workspace/docker/root/.zshrc | 2 + dev-workspace/docker/scripts/ppbuild | 134 +- languages/post-expirator-fr_FR.mo | Bin 15617 -> 17343 bytes languages/post-expirator-fr_FR.po | 1128 ++++++++++------- languages/post-expirator.pot | 43 +- legacy/classes/Facade.class.php | 64 +- legacy/functions.php | 25 +- post-expirator.php | 4 +- readme.txt | 16 +- services.php | 3 +- src/Core/HooksAbstract.php | 1 + src/Core/Plugin.php | 10 + .../Controllers/ExpirationController.php | 90 +- src/Modules/Expirator/HooksAbstract.php | 2 + .../Expirator/Models/ExpirablePostModel.php | 15 + src/Modules/Expirator/Module.php | 12 +- src/Modules/Settings/SettingsFacade.php | 4 + src/Views/classic-metabox.php | 5 +- 28 files changed, 1492 insertions(+), 1014 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/release-free-plugin.md b/.github/ISSUE_TEMPLATE/release-free-plugin.md index 0ce0890dc..20cd6db2d 100644 --- a/.github/ISSUE_TEMPLATE/release-free-plugin.md +++ b/.github/ISSUE_TEMPLATE/release-free-plugin.md @@ -17,12 +17,12 @@ To release the Free plugin please make sure to check all the checkboxes below. - [ ] Run `composer update --no-dev --dry-run` and check if there is any relevant update on any requirement. This won't change the code, just show a simulation of running the update command. Evaluate the need of releasing with this library updated, or if we can add that for a next release - [ ] If any update should be included on this release (from previous step) make sure to run the update command only for the specific dependeny: `composer update the/lib:version-constraint"`. Make sure to check compatibility with the plugin and what version we should be using. Check if you need to lock the current version for any dependency using exact version numbers instead of relative version constraints. Make sure to add any change of dependencies to the changelog. - [ ] Check Github's Dependabot warnings or pull requests, looking for any relevant report. Remove any false-positive first. -- [ ] Build JS files to production running `$ yarn run build-js` and commit. -- [ ] Run WP VIP scan to make sure no warnings or errors > 5 exists: `$ vendor/bin/phpcs`. -- [ ] Update the `.pot` file. -- [ ] Update the changelog - make sure all the changes are there with a user-friendly description and that the release date is correct, commit. +- [ ] Build JS files to production running `composer build:js` and commit. +- [ ] Run WP VIP scan to make sure no warnings or errors > 5 exists: `composer check:phpcs`. - [ ] Update the version number to the next stable version in the main plugin file and `readme.txt`. Commit the changes to the release branch. -- [ ] Build the zip package, running `$ yarn run build`. It should create a package in the `./dist` dir. +- [ ] Update the `.pot` file using `composer gen:pot`. +- [ ] Update the changelog - make sure all the changes are there with a user-friendly description and that the release date is correct, commit. +- [ ] Build the zip package, running `composer build`. It should create a package in the `./dist` dir. - [ ] Send the new package to the team for testing. ### Release Checklist diff --git a/.github/ISSUE_TEMPLATE/release-pro-plugin.md b/.github/ISSUE_TEMPLATE/release-pro-plugin.md index 30634027c..468184b20 100644 --- a/.github/ISSUE_TEMPLATE/release-pro-plugin.md +++ b/.github/ISSUE_TEMPLATE/release-pro-plugin.md @@ -17,12 +17,12 @@ To release the plugin please make sure to check all the checkboxes below. - [ ] Run `composer update --no-dev --dry-run` and check if there is any relevant update on any requirement. This won't change the code, just show a simulation of running the update command. Evaluate the need of releasing with this library updated, or if we can add that for a next release - [ ] If any update should be included on this release (from previous step) make sure to run the update command only for the specific dependeny: `composer update the/lib:version-constraint"`. Make sure to check compatibility with the plugin and what version we should be using. Check if you need to lock the current version for any dependency using exact version numbers instead of relative version constraints. Make sure to add any change of dependencies to the changelog. - [ ] Check Github's Dependabot warnings or pull requests, looking for any relevant report. Remove any false-positive first. -- [ ] Build JS files to production running `$ yarn run build-js` and commit. -- [ ] Run WP VIP scan to make sure no warnings or errors > 5 exists: `$ vendor/bin/phpcs`. -- [ ] Update the `.pot` file. -- [ ] Update the changelog - make sure all the changes are there with a user-friendly description and that the release date is correct. +- [ ] Build JS files to production running `composer build:js` and commit. +- [ ] Run WP VIP scan to make sure no warnings or errors > 5 exists: `composer check:phpcs`. - [ ] Update the version number to the next stable version in the main plugin file and `readme.txt`. Commit the changes to the release branch. -- [ ] Build the zip package, running `$ yarn run build`. It should create a package in the `./dist` dir. +- [ ] Update the `.pot` file using `composer gen:pot`. +- [ ] Update the changelog - make sure all the changes are there with a user-friendly description and that the release date is correct. +- [ ] Build the zip package, running `composer build`. It should create a package in the `./dist` dir. - [ ] Send the new package to the team for testing. ### Release Checklist diff --git a/.rsync-filters-post-build b/.rsync-filters-post-build index 610ad3196..b9e819d5f 100644 --- a/.rsync-filters-post-build +++ b/.rsync-filters-post-build @@ -1,17 +1,25 @@ +- .distignore +- .git +- .gitattributes +- .github +- .gitignore +- .rsync-filters-post-build +- .rsync-filters-pre-build +- /vendor/composer/pimple/pimple/.github +- /vendor/composer/pimple/pimple/.gitignore +- /vendor/pimple/pimple/.README.rst +- /vendor/pimple/pimple/.php_cs.dist +- /vendor/pimple/pimple/.travis.yml +- /vendor/pimple/pimple/CHANGELOG +- /vendor/pimple/pimple/composer.json +- /vendor/pimple/pimple/phpunit.xml.dist +- /vendor/pimple/pimple/src/Pimple/Tests +- /vendor/psr/container/.gitignore +- /vendor/psr/container/README.md +- /vendor/psr/container/composer.json +- /vendor/publishpress/vendor-locator/composer.json +- /vendor/publishpress/wordpress-banners/.gitattributes +- /vendor/woocommerce/action-scheduler/README.md +- /vendor/woocommerce/action-scheduler/changelog.txt - composer.json - composer.lock -- vendor/composer/pimple/pimple/.github -- vendor/composer/pimple/pimple/.gitignore -- vendor/pimple/pimple/.github -- vendor/pimple/pimple/.gitignore -- vendor/pimple/pimple/.php_cs.dist -- vendor/pimple/pimple/CHANGELOG -- vendor/pimple/pimple/composer.json -- vendor/pimple/pimple/phpunit.xml.dist -- vendor/psr/container/.gitignore -- vendor/psr/container/README.md -- vendor/psr/container/composer.json -- vendor/publishpress/vendor-locator/composer.json -- vendor/publishpress/wordpress-banners/.gitattributes -- vendor/woocommerce/action-scheduler/README.md -- vendor/woocommerce/action-scheduler/changelog.txt diff --git a/.rsync-filters-pre-build b/.rsync-filters-pre-build index 68d5bdd92..3d2aefa14 100644 --- a/.rsync-filters-pre-build +++ b/.rsync-filters-pre-build @@ -1,7 +1,5 @@ - *.code-workspace - .babelrc -- .builder-post-rsync-filters-post -- .builder-rsync-filters - .distignore - .git - .gitattributes @@ -9,11 +7,17 @@ - .gitignore - .idea - .php-cs-fixer.cache +- .phpcs-php-compatibility.xml - .phpcs.xml - .phplint-cache - .phplint.yml - .vscode - .wordpress-org +- /tests +- /vendor +- /version.txt +- /webpack.config.js +- /yarn.lock - Gruntfile.js - README-build.md - README.md @@ -34,21 +38,3 @@ - ray-dist.php - ray.php - screenshot-*.png -- tests -- /vendor -- /vendor/composer/pimple/pimple/.github -- /vendor/composer/pimple/pimple/.gitignore -- /vendor/pimple/pimple/.php_cs.dist -- /vendor/pimple/pimple/CHANGELOG -- /vendor/pimple/pimple/composer.json -- /vendor/pimple/pimple/phpunit.xml.dist -- /vendor/psr/container/.gitignore -- /vendor/psr/container/README.md -- /vendor/psr/container/composer.json -- /vendor/publishpress/vendor-locator/composer.json -- /vendor/publishpress/wordpress-banners/.gitattributes -- /vendor/woocommerce/action-scheduler/README.md -- /vendor/woocommerce/action-scheduler/changelog.txt -- /version.txt -- /webpack.config.js -- /yarn.lock diff --git a/assets/js/gutenberg-panel.js b/assets/js/gutenberg-panel.js index b3082ab86..5cedc2874 100644 --- a/assets/js/gutenberg-panel.js +++ b/assets/js/gutenberg-panel.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var t,e,i,n,a,o,r,s,u,c,p,l,d,g,h,b,f,x,m,y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v=function(){function t(t,e){for(var i=0;i{"use strict";var t=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,u=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){u=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(u)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},e=Object.assign||function(t){for(var e=1;e1?e-1:0),u=1;u0&&void 0!==arguments[0]?arguments[0]:R,n=arguments[1];switch(n.type){case"SET_FUTURE_ACTION":return e({},t,{futureAction:n.futureAction});case"SET_FUTURE_ACTION_DATE":return e({},t,{futureActionDate:n.futureActionDate});case"SET_FUTURE_ACTION_ENABLED":return e({},t,{futureActionEnabled:n.futureActionEnabled});case"SET_FUTURE_ACTION_TERMS":return e({},t,{futureActionTerms:n.futureActionTerms});case"SET_FUTURE_ACTION_TAXONOMY":return e({},t,{futureActionTaxonomy:n.futureActionTaxonomy});case"SET_TERMS_LIST_BY_NAME":return e({},t,{termsListByName:n.termsListByName});case"SET_TERMS_LIST_BY_ID":return e({},t,{termsListById:n.termsListById});case"SET_TAXONOMY_NAME":return e({},t,{taxonomyName:n.taxonomyName})}return t},actions:{setFutureAction:function(t){return{type:"SET_FUTURE_ACTION",futureAction:t}},setFutureActionDate:function(t){return{type:"SET_FUTURE_ACTION_DATE",futureActionDate:t}},setFutureActionEnabled:function(t){return{type:"SET_FUTURE_ACTION_ENABLED",futureActionEnabled:t}},setFutureActionTerms:function(t){return{type:"SET_FUTURE_ACTION_TERMS",futureActionTerms:t}},setFutureActionTaxonomy:function(t){return{type:"SET_FUTURE_ACTION_TAXONOMY",futureActionTaxonomy:t}},setTermsListByName:function(t){return{type:"SET_TERMS_LIST_BY_NAME",termsListByName:t}},setTermsListById:function(t){return{type:"SET_TERMS_LIST_BY_ID",termsListById:t}},setTaxonomyName:function(t){return{type:"SET_TAXONOMY_NAME",taxonomyName:t}},setIsFetchingTerms:function(t){return{type:"SET_IS_FETCHING_TERMS",isFetchingTerms:t}}},selectors:{getFutureAction:function(t){return t.futureAction},getFutureActionDate:function(t){return t.futureActionDate},getFutureActionEnabled:function(t){return t.futureActionEnabled},getFutureActionTerms:function(t){return t.futureActionTerms},getFutureActionTaxonomy:function(t){return t.futureActionTaxonomy},getTermsListByName:function(t){return t.termsListByName},getTermsListById:function(t){return t.termsListById},getTaxonomyName:function(t){return t.taxonomyName},getIsFetchingTerms:function(t){return t.isFetchingTerms}}});N(C),o("publishpress-future-action",{render:function(){var e=F((function(t){return t("publishpress-future/store").getFutureAction()}),[]),n=F((function(t){return t("publishpress-future/store").getFutureActionDate()}),[]),u=F((function(t){return t("publishpress-future/store").getFutureActionEnabled()}),[]),o=F((function(t){return t("publishpress-future/store").getFutureActionTerms()}),[]),s=F((function(t){return t("publishpress-future/store").getFutureActionTaxonomy()}),[]),y=F((function(t){return t("publishpress-future/store").getTermsListByName()}),[]),b=F((function(t){return t("publishpress-future/store").getTermsListById()}),[]),N=F((function(t){return t("publishpress-future/store").getIsFetchingTerms()}),[]),S=x("publishpress-future/store"),C=S.setFutureAction,O=S.setFutureActionDate,B=S.setFutureActionEnabled,L=S.setFutureActionTerms,U=S.setFutureActionTaxonomy,w=S.setTermsListByName,M=S.setTermsListById,P=S.setTaxonomyName,k=S.setIsFetchingTerms,Y=x("core/editor").editPost,j=function(t){B(t);var e={enabled:t};t&&(C(R.futureAction),O(R.futureActionDate),L(R.futureActionTerms),U(R.futureActionTaxonomy),e.action=R.futureAction,e.date=R.futureActionDate,e.terms=R.futureActionTerms,e.taxonomy=R.futureActionTaxonomy,X()),H(e)},X=function(){I("fetchTerms","Fetching terms...");var t=D("publishpress-future/store").getFutureActionTaxonomy(),e=D("core/editor").getCurrentPostType(),n={},u={};k(!0),I("futureActionTaxonomy",t),!t&&"post"===e||"category"===t?(I("fetchTerms","Fetching categories..."),v({path:_("wp/v2/categories",{per_page:-1})}).then((function(t){I("list",t),t.forEach((function(t){n[t.name]=t,u[t.id]=t.name})),w(n),M(u),P(r.strings.category),k(!1)}))):(I("fetchTerms","Fetching taxonomies..."),v({path:_("publishpress-future/v1/taxonomies/"+e)}).then((function(e){I("taxonomies",e.taxonomies),e.taxonomies.length>0?v({path:_("wp/v2/taxonomies/"+t,{context:"edit",per_page:-1})}).then((function(t){I("taxAttributes",t),v({path:_("wp/v2/"+t.rest_base,{context:"edit",per_page:-1})}).then((function(e){I("terms",e),e.forEach((function(t){n[A(t.name)]=t,u[t.id]=A(t.name)})),w(n),M(u),P(A(t.name)),k(!1)}))})):I("fetchTerms","No taxonomies found")})))},H=function(r){var i={publishpress_future_action:{enabled:u,date:n,action:e,terms:o,taxonomy:s}},a=!0,c=!1,f=void 0;try{for(var l,m=Object.entries(r)[Symbol.iterator]();!(a=(l=m.next()).done);a=!0){var T=l.value,p=t(T,2),A=p[0],y=p[1];i.publishpress_future_action[A]=y}}catch(t){c=!0,f=t}finally{try{!a&&m.return&&m.return()}finally{if(c)throw f}}Y(i),I("editPostAttribute",r,i)};h((function(){var t;t=D("core/editor").getEditedPostAttribute("publishpress_future_action"),I("fetchFutureActionData",t),B(t.enabled).then(undefined),C(t.action),O(t.date),L(t.terms),U(t.taxonomy);var e=D("publishpress-future/store").getFutureActionEnabled(),n=D("core/editor").isCleanNewPost();I("enabled",e),I("isCleanNewPost",n),e&&(n&&j(!0),X())}),[]);var W=[];return I("futureActionTerms",o),o&&o.length>0&&b&&"string"==typeof(W=d(o.map((function(t){return b[t]}))))&&(W=[]),React.createElement(i,{title:r.strings.panelTitle,icon:"calendar",initialOpen:u,className:"post-expirator-panel"},React.createElement(a,null,React.createElement(f,{label:r.strings.enablePostExpiration,checked:u,onChange:j})),u&&React.createElement(p,null,React.createElement(a,null,React.createElement(c,{currentDate:1e3*n,onChange:function(t){var e=new Date(t).getTime()/1e3;O(e),H({date:e})},__nextRemoveHelpButton:!0,is12Hour:r.is12hours,startOfWeek:r.startOfWeek})),React.createElement(l,{label:r.strings.action,value:e,options:r.actionsSelectOptions,onChange:function(t){C(t),H({action:t})}}),String(e).includes("category")&&(N&&React.createElement(p,null,r.strings.loading+" ("+s+")",React.createElement(T,null))||g(E(y))&&React.createElement("p",null,React.createElement("i",{className:"dashicons dashicons-warning"})," ",r.strings.noTermsFound)||React.createElement(m,{label:r.strings.terms+" ("+s+")",value:W,suggestions:Object.keys(y),onChange:function(t){t=t.map((function(t){return y[t].id})),L(t),H({terms:t})},maxSuggestions:10}))))}})}(window.wp,window.postExpiratorPanelConfig)})(); //# sourceMappingURL=gutenberg-panel.js.map \ No newline at end of file diff --git a/assets/js/gutenberg-panel.js.map b/assets/js/gutenberg-panel.js.map index 552694f62..7600bfa55 100644 --- a/assets/js/gutenberg-panel.js.map +++ b/assets/js/gutenberg-panel.js.map @@ -1 +1 @@ -{"version":3,"file":"gutenberg-panel.js","mappings":"uBAAWA,EAAIC,EAEJC,EACAC,EAHY,EAIZC,EAAU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,GASgBtI,I","sources":["webpack://post-expirator/./assets/jsx/gutenberg-panel/gutenberg-panel.jsx"],"sourcesContent":["(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 expirationEnabled: false,\n expirationAction: '',\n expirationDate: '',\n expirationTerms: [],\n expirationTaxonomy: ''\n }\n\n wp.data.subscribe(this.listenToPostSave.bind(this));\n wp.hooks.addAction('after_save_post', 'publishpress-future', () => {\n this.debugLog('getExpirationEnabled', this.getExpirationEnabled());\n this.saveCurrentPostData()\n });\n }\n\n debugLog(description, message) {\n if (console && config.is_debug_enabled) {\n console.log(description, message);\n }\n }\n\n listenToPostSave() {\n // Get the current post ID\n const postId = this.getPostId();\n\n const isSavingPost = this.getIsSavingPost();\n const itemKey = 'ppfuture-expiration-' + postId + '-isSavingPost';\n\n if (isSavingPost) {\n sessionStorage.setItem(itemKey, '1');\n }\n\n if (!isSavingPost) {\n let hasSavingRegistered = sessionStorage.getItem(itemKey) === '1';\n\n if (hasSavingRegistered) {\n sessionStorage.removeItem(itemKey);\n wp.hooks.doAction('after_save_post', 'publishpress-future');\n }\n }\n }\n\n getPostType() {\n return wp.data.select('core/editor').getCurrentPostType();\n }\n\n getPostId() {\n return wp.data.select('core/editor').getCurrentPostId();\n }\n\n getIsSavingPost() {\n return wp.data.select('core/editor').isSavingPost() || wp.data.select('core/editor').isAutosavingPost();\n }\n\n editPostAttribute(name, value) {\n let attribute = {};\n attribute[name] = value;\n\n wp.data.dispatch('core/editor').editPost(attribute);\n }\n\n getEditedPostAttribute(name) {\n return wp.data.select(\"core/editor\").getEditedPostAttribute(name);\n }\n\n fetchExpirationDataFromApi() {\n return wp.apiFetch({path: 'publishpress-future/v1/post-expiration/' + this.getPostId()}).then((data) => {\n this.editPostAttribute('expirationEnabled', data.enabled);\n this.editPostAttribute('expirationAction', data.expireType);\n this.editPostAttribute('expirationDate', data.date);\n this.editPostAttribute('expirationTerms', data.category);\n this.editPostAttribute('expirationTaxonomy', data.categoryTaxonomy);\n\n this.setState({\n expirationEnabled: data.enabled,\n expirationAction: data.expireType,\n expirationDate: data.date,\n expirationTerms: data.category,\n expirationTaxonomy: data.categoryTaxonomy\n });\n\n this.debugLog('API return', data);\n });\n }\n\n saveCurrentPostData() {\n const {expirationEnabled, expirationDate, expirationAction, expirationTerms} = this.state;\n let data;\n\n this.debugLog('State', this.state);\n\n if (!expirationEnabled) {\n data = {'enabled': false, 'date': 0, 'action': '', 'terms': []};\n } else {\n data = {\n enabled: expirationEnabled,\n date: expirationDate,\n action: expirationAction,\n terms: expirationTerms,\n };\n }\n\n wp.apiFetch({\n path: 'publishpress-future/v1/post-expiration/' + this.getPostId(),\n method: 'POST',\n data: data,\n }).then((data) => {\n this.debugLog('Future action data saved.');\n this.debugLog(data);\n });\n }\n\n componentWillMount() {\n this.fetchExpirationDataFromApi().then(this.initialize.bind(this));\n }\n\n initialize() {\n const postType = this.getPostType();\n\n const expirationEnabled = this.getExpirationEnabled();\n const expirationAction = this.getExpirationAction();\n const expirationTerms = this.getExpirationTerms();\n const expirationDate = this.getExpirationDate();\n const expirationTaxonomy = this.getExpirationTaxonomy();\n\n this.debugLog('Initialized', {\n enabled: expirationEnabled,\n date: expirationDate,\n expirationAction: expirationAction,\n categories: expirationTerms,\n taxonomy: expirationTaxonomy,\n });\n\n this.setState({\n expirationEnabled: expirationEnabled,\n expirationAction: expirationAction,\n expirationDate: expirationDate,\n expirationTerms: expirationTerms,\n expirationTaxonomy: expirationTaxonomy\n });\n\n this.debugLog('Default config', config.defaults);\n\n let categoriesList = [];\n let catIdVsName = [];\n\n if ((!expirationTaxonomy && postType === 'post') || expirationTaxonomy === '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({\n categoriesList: categoriesList,\n catIdVsName: catIdVsName,\n taxonomy: config.strings.category\n });\n });\n } else {\n wp.apiFetch({\n path: wp.url.addQueryArgs(`wp/v2/taxonomies/${expirationTaxonomy}`, {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 componentDidUpdate() {\n const {expirationEnabled, expirationDate, expirationAction, expirationTerms, attribute} = this.state;\n \n switch (attribute) {\n case 'enabled':\n this.editPostAttribute('expirationEnabled', expirationEnabled);\n break;\n\n case 'date':\n this.editPostAttribute('expirationDate', expirationDate);\n break;\n\n case 'action':\n this.editPostAttribute('expirationAction', expirationAction);\n if (!expirationAction.includes('category')) {\n this.editPostAttribute('expirationTerms', []);\n }\n break;\n case 'category':\n this.editPostAttribute('expirationTerms', expirationTerms);\n break;\n }\n }\n\n getExpirationEnabled() {\n return this.getEditedPostAttribute('expirationEnabled') == true;\n }\n\n getExpirationDate() {\n let storedDate = parseInt(this.getEditedPostAttribute('expirationDate'));\n\n if (! storedDate) {\n if (config.default_date) {\n storedDate = parseInt(config.default_date);\n } else {\n storedDate = new Date().getTime();\n }\n }\n\n let date = new Date();\n // let browserTimezoneOffset = date.getTimezoneOffset() * 60;\n // let wpTimezoneOffset = config.timezone_offset * 60;\n\n // date.setTime((storedDate + browserTimezoneOffset + wpTimezoneOffset) * 1000);\n date.setTime(storedDate * 1000);\n\n return date.getTime()/1000;\n }\n\n // what action to take on expiration\n getExpirationAction() {\n let expirationAction = this.getEditedPostAttribute('expirationAction');\n\n if (expirationAction) {\n return expirationAction;\n }\n\n if (config && config.defaults && config.defaults.expireType) {\n return config.defaults.expireType;\n }\n\n return 'draft';\n }\n\n arrayIsEmpty(obj) {\n return !obj || obj.length === 0 || obj[0] === '';\n }\n\n // what categories to add/remove/replace\n getExpirationTerms() {\n let categories = this.getEditedPostAttribute('expirationTerms', true);\n\n let defaultCategories = config.defaults.terms ? config.defaults.terms.split(',') : [];\n\n if (this.arrayIsEmpty(categories)) {\n return defaultCategories;\n }\n\n if (categories && typeof categories !== 'undefined' && typeof categories !== 'object') {\n return [categories];\n }\n\n return categories;\n }\n\n getExpirationTaxonomy() {\n let taxonomy = this.getEditedPostAttribute('expirationTaxonomy');\n\n if (taxonomy) {\n return taxonomy;\n }\n\n if (config && config.defaults && config.defaults.taxonomy) {\n return config.defaults.taxonomy;\n }\n\n return 'category';\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 onChangeEnabled(value) {\n this.setState({expirationEnabled: value, attribute: 'enabled'})\n this.editPostAttribute('expirationEnabled', value);\n this.debugLog(value);\n }\n\n onChangeDate(value) {\n const date = new Date(value).getTime()/1000;\n this.setState({expirationDate: date, attribute: 'date'});\n this.editPostAttribute('expirationDate', date);\n this.debugLog('New date', date, new Date(date * 1000));\n this.debugLog('Getdate', this.getExpirationDate());\n }\n\n onChangeAction(value) {\n this.setState({expirationAction: value, attribute: 'action'})\n this.editPostAttribute('expirationAction', value);\n }\n\n onChangeTerms(value) {\n this.setState({\n expirationTerms: this.selectCategories(value),\n attribute: 'category'\n });\n this.editPostAttribute('expirationTerms', value);\n }\n\n render() {\n const {categoriesList, catIdVsName} = this.state;\n const {expirationEnabled, expirationDate, expirationAction, expirationTerms, expirationTaxonomy} = this.state;\n\n let selectedCats = expirationTerms && compact(expirationTerms.map((id) => catIdVsName[id] || false));\n if (typeof selectedCats === 'string') {\n selectedCats = [];\n }\n\n return (\n \n \n \n \n {expirationEnabled && (\n \n \n \n \n \n {expirationAction.includes('category') &&\n (\n (isEmpty(keys(categoriesList)) && (\n \n {config.strings.loading + ` (${expirationTaxonomy})`}\n \n \n ))\n ||\n (\n \n )\n )}\n \n )}\n \n );\n }\n }\n\n registerPlugin('postexpirator-sidebar', {\n render: PostExpiratorSidebar\n });\n\n})(window.wp, window.postExpiratorPanelConfig);\n"],"names":["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","expirationEnabled","expirationAction","expirationDate","expirationTerms","expirationTaxonomy","data","subscribe","listenToPostSave","bind","hooks","addAction","debugLog","getExpirationEnabled","saveCurrentPostData","description","message","console","is_debug_enabled","log","postId","this","getPostId","isSavingPost","getIsSavingPost","itemKey","sessionStorage","setItem","getItem","removeItem","doAction","select","getCurrentPostType","getCurrentPostId","isAutosavingPost","name","value","attribute","dispatch","getEditedPostAttribute","apiFetch","path","then","editPostAttribute","enabled","expireType","date","category","categoryTaxonomy","setState","action","terms","method","fetchExpirationDataFromApi","initialize","postType","getPostType","getExpirationAction","getExpirationTerms","getExpirationDate","getExpirationTaxonomy","categories","taxonomy","defaults","url","addQueryArgs","per_page","list","forEach","cat","id","strings","context","taxAttributes","rest_base","term","includes","storedDate","parseInt","default_date","Date","getTime","setTime","obj","length","defaultCategories","split","arrayIsEmpty","tokens","some","token","map","selectCategories","selectedCats","title","postExpirator","icon","initialOpen","className","label","enablePostExpiration","checked","onChange","onChangeEnabled","currentDate","onChangeDate","is12Hour","is_12_hours","howToExpire","options","actions_options","onChangeAction","loading","expirationCategories","suggestions","Object","onChangeTerms","maxSuggestions"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"gutenberg-panel.js","mappings":"0kBACA,SAAWA,EAAIC,GAAQ,IA0BXC,EAxBDC,EAAkBH,EAAGI,QAArBD,eACAE,EAA8BL,EAAGM,SAAjCD,2BAHY,EAIyEL,EAAGO,WAAxFC,EAJY,EAIZA,SAAUC,EAJE,EAIFA,eAAgBC,EAJd,EAIcA,gBAAiBC,EAJ/B,EAI+BA,cAAeC,EAJ9C,EAI8CA,eAAgBC,EAJ9D,EAI8DA,QAC1EC,EAAYd,EAAGe,QAAfD,SACAE,EAAkBhB,EAAGiB,aAArBD,eANY,EAOcE,OAA1BC,EAPY,EAOZA,QAASC,EAPG,EAOHA,KAAMC,EAPH,EAOGA,QACfC,EAAaC,MAAbD,UACAE,EAAgBxB,EAAGyB,IAAnBD,aATY,EAgBfxB,EAAG0B,KALHC,EAXe,EAWfA,UACAC,EAZe,EAYfA,YACAC,EAbe,EAafA,SACAC,EAde,EAcfA,iBACAC,EAfe,EAefA,OAEGC,EAAYhC,EAAZgC,SAEDC,EAAW,SAACC,GAA4B,2BAAZC,EAAY,6BAAZA,EAAY,kBACJ,MAAlCC,SAAWnC,EAAOoC,iBAClB,EAAAD,SAAQE,MAAR,SAAc,WAAYJ,GAA1B,OAA0CC,GAEjD,EA6CKI,GA1CErC,EAAe,CACfsC,aAAc,KACdC,iBAAkB,EAClBC,qBAAqB,EACrBC,kBAAmB,GACnBC,qBAAsB,KACtBC,gBAAiB,KACjBC,cAAe,KACfC,aAAc,KACdC,iBAAiB,GAGf/C,GAAYA,EAAOgD,uBAIrBhD,EAAOgD,sBAAsBC,aAC7BhD,EAAawC,qBAAsB,GAGnCzC,EAAOgD,sBAAsBE,aAC7BjD,EAAasC,aAAev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iD,GAChBzB,EAAkB,CAAC,OAAUyB,GAChC,IAiLmBqB,OAAOjG,GAAckG,SAAS,cAC1B1F,GACI,oBAAClC,EAAD,KACKb,EAAOqG,QAAQqC,QAAf,KAA8B/F,EAA9B,IACD,oBAAC/B,EAAD,QAIJM,EAAQC,EAAKyB,KACT,6BAAG,yBAAGgF,UAAU,gCAAhB,IAAoD5H,EAAOqG,QAAQsC,eAGnE,oBAAChI,EAAD,CACIkH,MAAO7H,EAAOqG,QAAQ7C,MAAf,KAA4Bb,EAA5B,IACPwE,MAAOI,EACPqB,YAAa3B,OAAO9F,KAAKyB,GACzBoF,SAxLV,SAACb,GACvBA,EAA6BA,EA3ChBzD,KAAI,SAACC,GACd,OAAOf,EAAgBe,GAAMyC,EAChC,IA2CD/B,EAAqB8C,GACrBzB,EAAkB,CAAC,MAASyB,GAC/B,EAoLmC0B,eAAgB,OAUvD,GA7dL,EAoeGC,OAAO/I,GAAI+I,OAAOC,yB","sources":["webpack://post-expirator/./assets/jsx/gutenberg-panel/gutenberg-panel.jsx"],"sourcesContent":["\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} = wp.element;\n const {decodeEntities} = wp.htmlEntities;\n const {isEmpty, keys, compact} = lodash;\n const {useEffect} = React;\n const {addQueryArgs} = wp.url;\n const {\n useSelect,\n useDispatch,\n register,\n createReduxStore,\n select\n } = wp.data;\n const {apiFetch} = wp;\n\n const debugLog = (description, ...message) => {\n if (console && config.isDebugEnabled) {\n console.debug('[Future]', description, ...message);\n }\n }\n\n const getDefaultState = () => {\n let defaultState = {\n futureAction: null,\n futureActionDate: 0,\n futureActionEnabled: false,\n futureActionTerms: [],\n futureActionTaxonomy: null,\n termsListByName: null,\n termsListById: null,\n taxonomyName: null,\n isFetchingTerms: false,\n }\n\n if (! config || ! config.postTypeDefaultConfig) {\n return defaultState;\n }\n\n if (config.postTypeDefaultConfig.autoEnable) {\n defaultState.futureActionEnabled = true;\n }\n\n if (config.postTypeDefaultConfig.expireType) {\n defaultState.futureAction = config.postTypeDefaultConfig.expireType;\n }\n\n if (config.defaultDate) {\n defaultState.futureActionDate = parseInt(config.defaultDate);\n } else {\n defaultState.futureActionDate = new Date().getTime();\n }\n\n if (config.postTypeDefaultConfig.taxonomy) {\n defaultState.futureActionTaxonomy = config.postTypeDefaultConfig.taxonomy;\n }\n\n if (config.postTypeDefaultConfig.terms) {\n defaultState.futureActionTerms = config.postTypeDefaultConfig.terms.split(',').map(term => parseInt(term));\n }\n\n return defaultState;\n }\n\n // Step 1: Create the Redux store\n const DEFAULT_STATE = getDefaultState();\n\n debugLog('DEFAULT_STATE', DEFAULT_STATE);\n\n const store = createReduxStore('publishpress-future/store', {\n reducer(state = DEFAULT_STATE, action) {\n switch (action.type) {\n case 'SET_FUTURE_ACTION':\n return {\n ...state,\n futureAction: action.futureAction,\n };\n case 'SET_FUTURE_ACTION_DATE':\n return {\n ...state,\n futureActionDate: action.futureActionDate,\n }\n case 'SET_FUTURE_ACTION_ENABLED':\n return {\n ...state,\n futureActionEnabled: action.futureActionEnabled,\n }\n case 'SET_FUTURE_ACTION_TERMS':\n return {\n ...state,\n futureActionTerms: action.futureActionTerms,\n }\n case 'SET_FUTURE_ACTION_TAXONOMY':\n return {\n ...state,\n futureActionTaxonomy: action.futureActionTaxonomy,\n }\n case 'SET_TERMS_LIST_BY_NAME':\n return {\n ...state,\n termsListByName: action.termsListByName,\n }\n case 'SET_TERMS_LIST_BY_ID':\n return {\n ...state,\n termsListById: action.termsListById,\n }\n case 'SET_TAXONOMY_NAME':\n return {\n ...state,\n taxonomyName: action.taxonomyName,\n }\n }\n\n return state;\n },\n actions: {\n setFutureAction(futureAction) {\n return {\n type: 'SET_FUTURE_ACTION',\n futureAction: futureAction\n };\n },\n setFutureActionDate(futureActionDate) {\n return {\n type: 'SET_FUTURE_ACTION_DATE',\n futureActionDate: futureActionDate\n };\n },\n setFutureActionEnabled(futureActionEnabled) {\n return {\n type: 'SET_FUTURE_ACTION_ENABLED',\n futureActionEnabled: futureActionEnabled\n };\n },\n setFutureActionTerms(futureActionTerms) {\n return {\n type: 'SET_FUTURE_ACTION_TERMS',\n futureActionTerms: futureActionTerms\n };\n },\n setFutureActionTaxonomy(futureActionTaxonomy) {\n return {\n type: 'SET_FUTURE_ACTION_TAXONOMY',\n futureActionTaxonomy: futureActionTaxonomy\n };\n },\n setTermsListByName(termsListByName) {\n return {\n type: 'SET_TERMS_LIST_BY_NAME',\n termsListByName: termsListByName\n };\n },\n setTermsListById(termsListById) {\n return {\n type: 'SET_TERMS_LIST_BY_ID',\n termsListById: termsListById\n };\n },\n setTaxonomyName(taxonomyName) {\n return {\n type: 'SET_TAXONOMY_NAME',\n taxonomyName: taxonomyName\n };\n },\n setIsFetchingTerms(isFetchingTerms) {\n return {\n type: 'SET_IS_FETCHING_TERMS',\n isFetchingTerms: isFetchingTerms\n }\n }\n },\n selectors: {\n getFutureAction(state) {\n return state.futureAction;\n },\n getFutureActionDate(state) {\n return state.futureActionDate;\n },\n getFutureActionEnabled(state) {\n return state.futureActionEnabled;\n },\n getFutureActionTerms(state) {\n return state.futureActionTerms;\n },\n getFutureActionTaxonomy(state) {\n return state.futureActionTaxonomy;\n },\n getTermsListByName(state) {\n return state.termsListByName;\n },\n getTermsListById(state) {\n return state.termsListById;\n },\n getTaxonomyName(state) {\n return state.taxonomyName;\n },\n getIsFetchingTerms(state) {\n return state.isFetchingTerms;\n }\n }\n });\n\n register(store);\n\n // Step 2: Create the component\n const MyPluginDocumentSettingPanel = () => {\n const futureAction = useSelect((select) => select('publishpress-future/store').getFutureAction(), []);\n const futureActionDate = useSelect((select) => select('publishpress-future/store').getFutureActionDate(), []);\n const futureActionEnabled = useSelect((select) => select('publishpress-future/store').getFutureActionEnabled(), []);\n const futureActionTerms = useSelect((select) => select('publishpress-future/store').getFutureActionTerms(), []);\n const futureActionTaxonomy = useSelect((select) => select('publishpress-future/store').getFutureActionTaxonomy(), []);\n const termsListByName = useSelect((select) => select('publishpress-future/store').getTermsListByName(), []);\n const termsListById = useSelect((select) => select('publishpress-future/store').getTermsListById(), []);\n const isFetchingTerms = useSelect((select) => select('publishpress-future/store').getIsFetchingTerms(), []);\n\n const {\n setFutureAction,\n setFutureActionDate,\n setFutureActionEnabled,\n setFutureActionTerms,\n setFutureActionTaxonomy,\n setTermsListByName,\n setTermsListById,\n setTaxonomyName,\n setIsFetchingTerms\n } = useDispatch('publishpress-future/store');\n\n const {editPost} = useDispatch('core/editor');\n\n const mapTermsFromIdToName = (terms) => {\n return terms.map((term) => {\n return termsListById[term];\n });\n }\n\n const mapTermsFromNameToId = (terms) => {\n return terms.map((term) => {\n return termsListByName[term].id;\n });\n }\n\n const handleEnabledChange = (isChecked) => {\n setFutureActionEnabled(isChecked);\n\n const newAttribute = {\n 'enabled': isChecked\n }\n\n // User default values to other fields\n if (isChecked) {\n setFutureAction(DEFAULT_STATE.futureAction);\n setFutureActionDate(DEFAULT_STATE.futureActionDate);\n setFutureActionTerms(DEFAULT_STATE.futureActionTerms);\n setFutureActionTaxonomy(DEFAULT_STATE.futureActionTaxonomy);\n\n newAttribute['action'] = DEFAULT_STATE.futureAction;\n newAttribute['date'] = DEFAULT_STATE.futureActionDate;\n newAttribute['terms'] = DEFAULT_STATE.futureActionTerms;\n newAttribute['taxonomy'] = DEFAULT_STATE.futureActionTaxonomy;\n\n fetchTerms();\n }\n\n editPostAttribute(newAttribute);\n }\n\n const handleActionChange = (value) => {\n setFutureAction(value);\n editPostAttribute({'action': value});\n }\n\n const handleDateChange = (value) => {\n const date = new Date(value).getTime()/1000;\n\n setFutureActionDate(date);\n editPostAttribute({'date': date});\n }\n\n const handleTermsChange = (value) => {\n value = mapTermsFromNameToId(value);\n\n setFutureActionTerms(value);\n editPostAttribute({'terms': value});\n }\n\n const getPostId = () => {\n return select('core/editor').getCurrentPostId();\n }\n\n const getPostType = () => {\n return select('core/editor').getCurrentPostType();\n }\n\n const fetchFutureActionData = (callback) => {\n const data = select('core/editor').getEditedPostAttribute('publishpress_future_action');\n debugLog('fetchFutureActionData', data);\n\n setFutureActionEnabled(data.enabled).then(callback);\n setFutureAction(data.action);\n setFutureActionDate(data.date);\n setFutureActionTerms(data.terms);\n setFutureActionTaxonomy(data.taxonomy);\n }\n\n const fetchTerms = () => {\n debugLog('fetchTerms', 'Fetching terms...');\n const futureActionTaxonomy = select('publishpress-future/store').getFutureActionTaxonomy();\n const postType = getPostType();\n\n let termsListByName = {};\n let termsListById = {};\n\n setIsFetchingTerms(true);\n\n debugLog('futureActionTaxonomy', futureActionTaxonomy);\n\n if ((!futureActionTaxonomy && postType === 'post') || futureActionTaxonomy === 'category') {\n debugLog('fetchTerms', 'Fetching categories...');\n apiFetch({\n path: addQueryArgs('wp/v2/categories', {per_page: -1}),\n }).then((list) => {\n debugLog('list', list);\n list.forEach(cat => {\n termsListByName[cat.name] = cat;\n termsListById[cat.id] = cat.name;\n });\n\n setTermsListByName(termsListByName);\n setTermsListById(termsListById);\n setTaxonomyName(config.strings.category);\n setIsFetchingTerms(false);\n });\n } else {\n debugLog('fetchTerms', 'Fetching taxonomies...');\n apiFetch({\n path: addQueryArgs(`publishpress-future/v1/taxonomies/` + postType),\n }).then((response) => {\n debugLog('taxonomies', response.taxonomies);\n\n if (response.taxonomies.length > 0) {\n apiFetch({\n path: addQueryArgs(`wp/v2/taxonomies/${futureActionTaxonomy}`, {context: 'edit', per_page: -1}),\n }).then((taxAttributes) => {\n debugLog('taxAttributes', taxAttributes);\n // fetch all terms\n apiFetch({\n path: addQueryArgs(`wp/v2/${taxAttributes.rest_base}`, {context: 'edit', per_page: -1}),\n }).then((terms) => {\n debugLog('terms', terms);\n terms.forEach(term => {\n termsListByName[decodeEntities(term.name)] = term;\n termsListById[term.id] = decodeEntities(term.name);\n });\n\n setTermsListByName(termsListByName);\n setTermsListById(termsListById);\n setTaxonomyName(decodeEntities(taxAttributes.name));\n setIsFetchingTerms(false);\n });\n });\n } else {\n debugLog('fetchTerms', 'No taxonomies found');\n }\n });\n }\n }\n\n const editPostAttribute = (newAttribute) => {\n const attribute = {\n publishpress_future_action: {\n enabled: futureActionEnabled,\n date: futureActionDate,\n action: futureAction,\n terms: futureActionTerms,\n taxonomy: futureActionTaxonomy\n }\n };\n\n // For each property on newAttribute, set the value on attribute\n for (const [name, value] of Object.entries(newAttribute)) {\n attribute.publishpress_future_action[name] = value;\n }\n\n editPost(attribute);\n debugLog('editPostAttribute', newAttribute, attribute);\n }\n\n useEffect(() => {\n fetchFutureActionData();\n\n // We need to get the value directly from the store because the value from the state is not updated yet\n const enabled = select('publishpress-future/store').getFutureActionEnabled();\n const isCleanNewPost = select('core/editor').isCleanNewPost();\n\n debugLog('enabled', enabled);\n debugLog('isCleanNewPost', isCleanNewPost);\n\n if (enabled) {\n if (isCleanNewPost) {\n handleEnabledChange(true);\n }\n\n fetchTerms();\n }\n }, []);\n\n let selectedTerms = [];\n debugLog('futureActionTerms', futureActionTerms);\n if (futureActionTerms && futureActionTerms.length > 0 && termsListById) {\n selectedTerms = compact(mapTermsFromIdToName(futureActionTerms));\n\n if (typeof selectedTerms === 'string') {\n selectedTerms = [];\n }\n }\n\n return (\n \n \n \n \n {futureActionEnabled && (\n \n \n \n \n \n\n {\n String(futureAction).includes('category') && (\n isFetchingTerms && (\n \n {config.strings.loading + ` (${futureActionTaxonomy})`}\n \n \n )\n || (\n isEmpty(keys(termsListByName)) && (\n

{config.strings.noTermsFound}

\n )\n || (\n \n )\n )\n )\n }\n
\n )}\n
\n );\n };\n\n // Step 3: Connect the component to the Redux store\n registerPlugin('publishpress-future-action', {\n render: MyPluginDocumentSettingPanel\n });\n\n})(window.wp, window.postExpiratorPanelConfig);\n"],"names":["wp","config","defaultState","registerPlugin","plugins","PluginDocumentSettingPanel","editPost","components","PanelRow","DateTimePicker","CheckboxControl","SelectControl","FormTokenField","Spinner","Fragment","element","decodeEntities","htmlEntities","lodash","isEmpty","keys","compact","useEffect","React","addQueryArgs","url","data","useSelect","useDispatch","register","createReduxStore","select","apiFetch","debugLog","description","message","console","isDebugEnabled","debug","DEFAULT_STATE","futureAction","futureActionDate","futureActionEnabled","futureActionTerms","futureActionTaxonomy","termsListByName","termsListById","taxonomyName","isFetchingTerms","postTypeDefaultConfig","autoEnable","expireType","defaultDate","parseInt","Date","getTime","taxonomy","terms","split","map","term","store","reducer","state","action","type","actions","setFutureAction","setFutureActionDate","setFutureActionEnabled","setFutureActionTerms","setFutureActionTaxonomy","setTermsListByName","setTermsListById","setTaxonomyName","setIsFetchingTerms","selectors","getFutureAction","getFutureActionDate","getFutureActionEnabled","getFutureActionTerms","getFutureActionTaxonomy","getTermsListByName","getTermsListById","getTaxonomyName","getIsFetchingTerms","render","handleEnabledChange","isChecked","newAttribute","fetchTerms","editPostAttribute","postType","getCurrentPostType","path","per_page","then","list","forEach","cat","name","id","strings","category","response","taxonomies","length","context","taxAttributes","rest_base","attribute","publishpress_future_action","enabled","date","Object","entries","value","getEditedPostAttribute","callback","isCleanNewPost","selectedTerms","title","panelTitle","icon","initialOpen","className","label","enablePostExpiration","checked","onChange","currentDate","__nextRemoveHelpButton","is12Hour","is12hours","startOfWeek","options","actionsSelectOptions","String","includes","loading","noTermsFound","suggestions","maxSuggestions","window","postExpiratorPanelConfig"],"sourceRoot":""} \ No newline at end of file diff --git a/assets/jsx/gutenberg-panel/gutenberg-panel.jsx b/assets/jsx/gutenberg-panel/gutenberg-panel.jsx index 48f9dc2e8..43d9126d1 100644 --- a/assets/jsx/gutenberg-panel/gutenberg-panel.jsx +++ b/assets/jsx/gutenberg-panel/gutenberg-panel.jsx @@ -1,407 +1,486 @@ + (function (wp, config) { const {registerPlugin} = wp.plugins; const {PluginDocumentSettingPanel} = wp.editPost; const {PanelRow, DateTimePicker, CheckboxControl, SelectControl, FormTokenField, Spinner} = wp.components; - const {Fragment, Component} = wp.element; + const {Fragment} = wp.element; const {decodeEntities} = wp.htmlEntities; const {isEmpty, keys, compact} = lodash; - - class PostExpiratorSidebar extends Component { - constructor() { - super(...arguments); - - this.state = { - categoriesList: [], - catIdVsName: [], - expirationEnabled: false, - expirationAction: '', - expirationDate: '', - expirationTerms: [], - expirationTaxonomy: '' - } - - wp.data.subscribe(this.listenToPostSave.bind(this)); - wp.hooks.addAction('after_save_post', 'publishpress-future', () => { - this.debugLog('getExpirationEnabled', this.getExpirationEnabled()); - this.saveCurrentPostData() - }); + const {useEffect} = React; + const {addQueryArgs} = wp.url; + const { + useSelect, + useDispatch, + register, + createReduxStore, + select + } = wp.data; + const {apiFetch} = wp; + + const debugLog = (description, ...message) => { + if (console && config.isDebugEnabled) { + console.debug('[Future]', description, ...message); } + } - debugLog(description, message) { - if (console && config.is_debug_enabled) { - console.log(description, message); - } - } - - listenToPostSave() { - // Get the current post ID - const postId = this.getPostId(); - - const isSavingPost = this.getIsSavingPost(); - const itemKey = 'ppfuture-expiration-' + postId + '-isSavingPost'; - - if (isSavingPost) { - sessionStorage.setItem(itemKey, '1'); - } - - if (!isSavingPost) { - let hasSavingRegistered = sessionStorage.getItem(itemKey) === '1'; - - if (hasSavingRegistered) { - sessionStorage.removeItem(itemKey); - wp.hooks.doAction('after_save_post', 'publishpress-future'); - } - } + const getDefaultState = () => { + let defaultState = { + futureAction: null, + futureActionDate: 0, + futureActionEnabled: false, + futureActionTerms: [], + futureActionTaxonomy: null, + termsListByName: null, + termsListById: null, + taxonomyName: null, + isFetchingTerms: false, } - getPostType() { - return wp.data.select('core/editor').getCurrentPostType(); + if (! config || ! config.postTypeDefaultConfig) { + return defaultState; } - getPostId() { - return wp.data.select('core/editor').getCurrentPostId(); + if (config.postTypeDefaultConfig.autoEnable) { + defaultState.futureActionEnabled = true; } - getIsSavingPost() { - return wp.data.select('core/editor').isSavingPost() || wp.data.select('core/editor').isAutosavingPost(); + if (config.postTypeDefaultConfig.expireType) { + defaultState.futureAction = config.postTypeDefaultConfig.expireType; } - editPostAttribute(name, value) { - let attribute = {}; - attribute[name] = value; - - wp.data.dispatch('core/editor').editPost(attribute); + if (config.defaultDate) { + defaultState.futureActionDate = parseInt(config.defaultDate); + } else { + defaultState.futureActionDate = new Date().getTime(); } - getEditedPostAttribute(name) { - return wp.data.select("core/editor").getEditedPostAttribute(name); + if (config.postTypeDefaultConfig.taxonomy) { + defaultState.futureActionTaxonomy = config.postTypeDefaultConfig.taxonomy; } - fetchExpirationDataFromApi() { - return wp.apiFetch({path: 'publishpress-future/v1/post-expiration/' + this.getPostId()}).then((data) => { - this.editPostAttribute('expirationEnabled', data.enabled); - this.editPostAttribute('expirationAction', data.expireType); - this.editPostAttribute('expirationDate', data.date); - this.editPostAttribute('expirationTerms', data.category); - this.editPostAttribute('expirationTaxonomy', data.categoryTaxonomy); - - this.setState({ - expirationEnabled: data.enabled, - expirationAction: data.expireType, - expirationDate: data.date, - expirationTerms: data.category, - expirationTaxonomy: data.categoryTaxonomy - }); - - this.debugLog('API return', data); - }); + if (config.postTypeDefaultConfig.terms) { + defaultState.futureActionTerms = config.postTypeDefaultConfig.terms.split(',').map(term => parseInt(term)); } - saveCurrentPostData() { - const {expirationEnabled, expirationDate, expirationAction, expirationTerms} = this.state; - let data; + return defaultState; + } - this.debugLog('State', this.state); + // Step 1: Create the Redux store + const DEFAULT_STATE = getDefaultState(); + + debugLog('DEFAULT_STATE', DEFAULT_STATE); + + const store = createReduxStore('publishpress-future/store', { + reducer(state = DEFAULT_STATE, action) { + switch (action.type) { + case 'SET_FUTURE_ACTION': + return { + ...state, + futureAction: action.futureAction, + }; + case 'SET_FUTURE_ACTION_DATE': + return { + ...state, + futureActionDate: action.futureActionDate, + } + case 'SET_FUTURE_ACTION_ENABLED': + return { + ...state, + futureActionEnabled: action.futureActionEnabled, + } + case 'SET_FUTURE_ACTION_TERMS': + return { + ...state, + futureActionTerms: action.futureActionTerms, + } + case 'SET_FUTURE_ACTION_TAXONOMY': + return { + ...state, + futureActionTaxonomy: action.futureActionTaxonomy, + } + case 'SET_TERMS_LIST_BY_NAME': + return { + ...state, + termsListByName: action.termsListByName, + } + case 'SET_TERMS_LIST_BY_ID': + return { + ...state, + termsListById: action.termsListById, + } + case 'SET_TAXONOMY_NAME': + return { + ...state, + taxonomyName: action.taxonomyName, + } + } - if (!expirationEnabled) { - data = {'enabled': false, 'date': 0, 'action': '', 'terms': []}; - } else { - data = { - enabled: expirationEnabled, - date: expirationDate, - action: expirationAction, - terms: expirationTerms, + return state; + }, + actions: { + setFutureAction(futureAction) { + return { + type: 'SET_FUTURE_ACTION', + futureAction: futureAction + }; + }, + setFutureActionDate(futureActionDate) { + return { + type: 'SET_FUTURE_ACTION_DATE', + futureActionDate: futureActionDate + }; + }, + setFutureActionEnabled(futureActionEnabled) { + return { + type: 'SET_FUTURE_ACTION_ENABLED', + futureActionEnabled: futureActionEnabled + }; + }, + setFutureActionTerms(futureActionTerms) { + return { + type: 'SET_FUTURE_ACTION_TERMS', + futureActionTerms: futureActionTerms }; + }, + setFutureActionTaxonomy(futureActionTaxonomy) { + return { + type: 'SET_FUTURE_ACTION_TAXONOMY', + futureActionTaxonomy: futureActionTaxonomy + }; + }, + setTermsListByName(termsListByName) { + return { + type: 'SET_TERMS_LIST_BY_NAME', + termsListByName: termsListByName + }; + }, + setTermsListById(termsListById) { + return { + type: 'SET_TERMS_LIST_BY_ID', + termsListById: termsListById + }; + }, + setTaxonomyName(taxonomyName) { + return { + type: 'SET_TAXONOMY_NAME', + taxonomyName: taxonomyName + }; + }, + setIsFetchingTerms(isFetchingTerms) { + return { + type: 'SET_IS_FETCHING_TERMS', + isFetchingTerms: isFetchingTerms + } + } + }, + selectors: { + getFutureAction(state) { + return state.futureAction; + }, + getFutureActionDate(state) { + return state.futureActionDate; + }, + getFutureActionEnabled(state) { + return state.futureActionEnabled; + }, + getFutureActionTerms(state) { + return state.futureActionTerms; + }, + getFutureActionTaxonomy(state) { + return state.futureActionTaxonomy; + }, + getTermsListByName(state) { + return state.termsListByName; + }, + getTermsListById(state) { + return state.termsListById; + }, + getTaxonomyName(state) { + return state.taxonomyName; + }, + getIsFetchingTerms(state) { + return state.isFetchingTerms; } + } + }); - wp.apiFetch({ - path: 'publishpress-future/v1/post-expiration/' + this.getPostId(), - method: 'POST', - data: data, - }).then((data) => { - this.debugLog('Future action data saved.'); - this.debugLog(data); + register(store); + + // Step 2: Create the component + const MyPluginDocumentSettingPanel = () => { + const futureAction = useSelect((select) => select('publishpress-future/store').getFutureAction(), []); + const futureActionDate = useSelect((select) => select('publishpress-future/store').getFutureActionDate(), []); + const futureActionEnabled = useSelect((select) => select('publishpress-future/store').getFutureActionEnabled(), []); + const futureActionTerms = useSelect((select) => select('publishpress-future/store').getFutureActionTerms(), []); + const futureActionTaxonomy = useSelect((select) => select('publishpress-future/store').getFutureActionTaxonomy(), []); + const termsListByName = useSelect((select) => select('publishpress-future/store').getTermsListByName(), []); + const termsListById = useSelect((select) => select('publishpress-future/store').getTermsListById(), []); + const isFetchingTerms = useSelect((select) => select('publishpress-future/store').getIsFetchingTerms(), []); + + const { + setFutureAction, + setFutureActionDate, + setFutureActionEnabled, + setFutureActionTerms, + setFutureActionTaxonomy, + setTermsListByName, + setTermsListById, + setTaxonomyName, + setIsFetchingTerms + } = useDispatch('publishpress-future/store'); + + const {editPost} = useDispatch('core/editor'); + + const mapTermsFromIdToName = (terms) => { + return terms.map((term) => { + return termsListById[term]; }); } - componentWillMount() { - this.fetchExpirationDataFromApi().then(this.initialize.bind(this)); + const mapTermsFromNameToId = (terms) => { + return terms.map((term) => { + return termsListByName[term].id; + }); } - initialize() { - const postType = this.getPostType(); - - const expirationEnabled = this.getExpirationEnabled(); - const expirationAction = this.getExpirationAction(); - const expirationTerms = this.getExpirationTerms(); - const expirationDate = this.getExpirationDate(); - const expirationTaxonomy = this.getExpirationTaxonomy(); - - this.debugLog('Initialized', { - enabled: expirationEnabled, - date: expirationDate, - expirationAction: expirationAction, - categories: expirationTerms, - taxonomy: expirationTaxonomy, - }); + const handleEnabledChange = (isChecked) => { + setFutureActionEnabled(isChecked); - this.setState({ - expirationEnabled: expirationEnabled, - expirationAction: expirationAction, - expirationDate: expirationDate, - expirationTerms: expirationTerms, - expirationTaxonomy: expirationTaxonomy - }); + const newAttribute = { + 'enabled': isChecked + } - this.debugLog('Default config', config.defaults); + // User default values to other fields + if (isChecked) { + setFutureAction(DEFAULT_STATE.futureAction); + setFutureActionDate(DEFAULT_STATE.futureActionDate); + setFutureActionTerms(DEFAULT_STATE.futureActionTerms); + setFutureActionTaxonomy(DEFAULT_STATE.futureActionTaxonomy); - let categoriesList = []; - let catIdVsName = []; + newAttribute['action'] = DEFAULT_STATE.futureAction; + newAttribute['date'] = DEFAULT_STATE.futureActionDate; + newAttribute['terms'] = DEFAULT_STATE.futureActionTerms; + newAttribute['taxonomy'] = DEFAULT_STATE.futureActionTaxonomy; - if ((!expirationTaxonomy && postType === 'post') || expirationTaxonomy === 'category') { - wp.apiFetch({ - path: wp.url.addQueryArgs('wp/v2/categories', {per_page: -1}), - }).then((list) => { - list.forEach(cat => { - categoriesList[cat.name] = cat; - catIdVsName[cat.id] = cat.name; - }); - this.setState({ - categoriesList: categoriesList, - catIdVsName: catIdVsName, - taxonomy: config.strings.category - }); - }); - } else { - wp.apiFetch({ - path: wp.url.addQueryArgs(`wp/v2/taxonomies/${expirationTaxonomy}`, {context: 'edit'}), - }).then((taxAttributes) => { - // fetch all terms - wp.apiFetch({ - path: wp.url.addQueryArgs(`wp/v2/${taxAttributes.rest_base}`, {context: 'edit'}), - }).then((terms) => { - terms.forEach(term => { - categoriesList[decodeEntities(term.name)] = term; - catIdVsName[term.id] = decodeEntities(term.name); - }); - this.setState({ - categoriesList: categoriesList, - catIdVsName: catIdVsName, - taxonomy: decodeEntities(taxAttributes.name) - }); - }); - }); + fetchTerms(); } - } - componentDidUpdate() { - const {expirationEnabled, expirationDate, expirationAction, expirationTerms, attribute} = this.state; - - switch (attribute) { - case 'enabled': - this.editPostAttribute('expirationEnabled', expirationEnabled); - break; - - case 'date': - this.editPostAttribute('expirationDate', expirationDate); - break; - - case 'action': - this.editPostAttribute('expirationAction', expirationAction); - if (!expirationAction.includes('category')) { - this.editPostAttribute('expirationTerms', []); - } - break; - case 'category': - this.editPostAttribute('expirationTerms', expirationTerms); - break; - } + editPostAttribute(newAttribute); } - getExpirationEnabled() { - return this.getEditedPostAttribute('expirationEnabled') == true; + const handleActionChange = (value) => { + setFutureAction(value); + editPostAttribute({'action': value}); } - getExpirationDate() { - let storedDate = parseInt(this.getEditedPostAttribute('expirationDate')); - - if (! storedDate) { - if (config.default_date) { - storedDate = parseInt(config.default_date); - } else { - storedDate = new Date().getTime(); - } - } - - let date = new Date(); - // let browserTimezoneOffset = date.getTimezoneOffset() * 60; - // let wpTimezoneOffset = config.timezone_offset * 60; - - // date.setTime((storedDate + browserTimezoneOffset + wpTimezoneOffset) * 1000); - date.setTime(storedDate * 1000); + const handleDateChange = (value) => { + const date = new Date(value).getTime()/1000; - return date.getTime()/1000; + setFutureActionDate(date); + editPostAttribute({'date': date}); } - // what action to take on expiration - getExpirationAction() { - let expirationAction = this.getEditedPostAttribute('expirationAction'); - - if (expirationAction) { - return expirationAction; - } + const handleTermsChange = (value) => { + value = mapTermsFromNameToId(value); - if (config && config.defaults && config.defaults.expireType) { - return config.defaults.expireType; - } + setFutureActionTerms(value); + editPostAttribute({'terms': value}); + } - return 'draft'; + const getPostId = () => { + return select('core/editor').getCurrentPostId(); } - arrayIsEmpty(obj) { - return !obj || obj.length === 0 || obj[0] === ''; + const getPostType = () => { + return select('core/editor').getCurrentPostType(); } - // what categories to add/remove/replace - getExpirationTerms() { - let categories = this.getEditedPostAttribute('expirationTerms', true); + const fetchFutureActionData = (callback) => { + const data = select('core/editor').getEditedPostAttribute('publishpress_future_action'); + debugLog('fetchFutureActionData', data); - let defaultCategories = config.defaults.terms ? config.defaults.terms.split(',') : []; + setFutureActionEnabled(data.enabled).then(callback); + setFutureAction(data.action); + setFutureActionDate(data.date); + setFutureActionTerms(data.terms); + setFutureActionTaxonomy(data.taxonomy); + } - if (this.arrayIsEmpty(categories)) { - return defaultCategories; - } + const fetchTerms = () => { + debugLog('fetchTerms', 'Fetching terms...'); + const futureActionTaxonomy = select('publishpress-future/store').getFutureActionTaxonomy(); + const postType = getPostType(); - if (categories && typeof categories !== 'undefined' && typeof categories !== 'object') { - return [categories]; - } + let termsListByName = {}; + let termsListById = {}; - return categories; - } + setIsFetchingTerms(true); - getExpirationTaxonomy() { - let taxonomy = this.getEditedPostAttribute('expirationTaxonomy'); + debugLog('futureActionTaxonomy', futureActionTaxonomy); - if (taxonomy) { - return taxonomy; - } + if ((!futureActionTaxonomy && postType === 'post') || futureActionTaxonomy === 'category') { + debugLog('fetchTerms', 'Fetching categories...'); + apiFetch({ + path: addQueryArgs('wp/v2/categories', {per_page: -1}), + }).then((list) => { + debugLog('list', list); + list.forEach(cat => { + termsListByName[cat.name] = cat; + termsListById[cat.id] = cat.name; + }); - if (config && config.defaults && config.defaults.taxonomy) { - return config.defaults.taxonomy; + setTermsListByName(termsListByName); + setTermsListById(termsListById); + setTaxonomyName(config.strings.category); + setIsFetchingTerms(false); + }); + } else { + debugLog('fetchTerms', 'Fetching taxonomies...'); + apiFetch({ + path: addQueryArgs(`publishpress-future/v1/taxonomies/` + postType), + }).then((response) => { + debugLog('taxonomies', response.taxonomies); + + if (response.taxonomies.length > 0) { + apiFetch({ + path: addQueryArgs(`wp/v2/taxonomies/${futureActionTaxonomy}`, {context: 'edit', per_page: -1}), + }).then((taxAttributes) => { + debugLog('taxAttributes', taxAttributes); + // fetch all terms + apiFetch({ + path: addQueryArgs(`wp/v2/${taxAttributes.rest_base}`, {context: 'edit', per_page: -1}), + }).then((terms) => { + debugLog('terms', terms); + terms.forEach(term => { + termsListByName[decodeEntities(term.name)] = term; + termsListById[term.id] = decodeEntities(term.name); + }); + + setTermsListByName(termsListByName); + setTermsListById(termsListById); + setTaxonomyName(decodeEntities(taxAttributes.name)); + setIsFetchingTerms(false); + }); + }); + } else { + debugLog('fetchTerms', 'No taxonomies found'); + } + }); } - - return 'category'; } - // fired for the autocomplete - selectCategories(tokens) { - const {categoriesList, catIdVsName} = this.state; - - var hasNoSuggestion = tokens.some(function (token) { - return typeof token === 'string' && !categoriesList[token]; - }); + const editPostAttribute = (newAttribute) => { + const attribute = { + publishpress_future_action: { + enabled: futureActionEnabled, + date: futureActionDate, + action: futureAction, + terms: futureActionTerms, + taxonomy: futureActionTaxonomy + } + }; - if (hasNoSuggestion) { - return; + // For each property on newAttribute, set the value on attribute + for (const [name, value] of Object.entries(newAttribute)) { + attribute.publishpress_future_action[name] = value; } - var categories = tokens.map(function (token) { - return typeof token === 'string' ? categoriesList[token] : token; - }) - - return categories.map((cat) => cat.id); + editPost(attribute); + debugLog('editPostAttribute', newAttribute, attribute); } - onChangeEnabled(value) { - this.setState({expirationEnabled: value, attribute: 'enabled'}) - this.editPostAttribute('expirationEnabled', value); - this.debugLog(value); - } + useEffect(() => { + fetchFutureActionData(); - onChangeDate(value) { - const date = new Date(value).getTime()/1000; - this.setState({expirationDate: date, attribute: 'date'}); - this.editPostAttribute('expirationDate', date); - this.debugLog('New date', date, new Date(date * 1000)); - this.debugLog('Getdate', this.getExpirationDate()); - } + // We need to get the value directly from the store because the value from the state is not updated yet + const enabled = select('publishpress-future/store').getFutureActionEnabled(); + const isCleanNewPost = select('core/editor').isCleanNewPost(); - onChangeAction(value) { - this.setState({expirationAction: value, attribute: 'action'}) - this.editPostAttribute('expirationAction', value); - } + debugLog('enabled', enabled); + debugLog('isCleanNewPost', isCleanNewPost); - onChangeTerms(value) { - this.setState({ - expirationTerms: this.selectCategories(value), - attribute: 'category' - }); - this.editPostAttribute('expirationTerms', value); - } + if (enabled) { + if (isCleanNewPost) { + handleEnabledChange(true); + } + + fetchTerms(); + } + }, []); - render() { - const {categoriesList, catIdVsName} = this.state; - const {expirationEnabled, expirationDate, expirationAction, expirationTerms, expirationTaxonomy} = this.state; + let selectedTerms = []; + debugLog('futureActionTerms', futureActionTerms); + if (futureActionTerms && futureActionTerms.length > 0 && termsListById) { + selectedTerms = compact(mapTermsFromIdToName(futureActionTerms)); - let selectedCats = expirationTerms && compact(expirationTerms.map((id) => catIdVsName[id] || false)); - if (typeof selectedCats === 'string') { - selectedCats = []; + if (typeof selectedTerms === 'string') { + selectedTerms = []; } + } - return ( - - - - - {expirationEnabled && ( - - - - - + + + + {futureActionEnabled && ( + + + - {expirationAction.includes('category') && - ( - (isEmpty(keys(categoriesList)) && ( - - {config.strings.loading + ` (${expirationTaxonomy})`} - - - )) - || - ( + + + + { + String(futureAction).includes('category') && ( + isFetchingTerms && ( + + {config.strings.loading + ` (${futureActionTaxonomy})`} + + + ) + || ( + isEmpty(keys(termsListByName)) && ( +

{config.strings.noTermsFound}

+ ) + || ( ) - )} -
- )} -
- ); - } - } - - registerPlugin('postexpirator-sidebar', { - render: PostExpiratorSidebar + ) + ) + } + + )} + + ); + }; + + // Step 3: Connect the component to the Redux store + registerPlugin('publishpress-future-action', { + render: MyPluginDocumentSettingPanel }); })(window.wp, window.postExpiratorPanelConfig); diff --git a/composer.json b/composer.json index a900cb429..feeb9b422 100644 --- a/composer.json +++ b/composer.json @@ -73,31 +73,31 @@ "phpstan/extension-installer": "^1.2" }, "scripts": { - "build-js:dev": "wp-scripts build --mode development", - "build-js:watch": "wp-scripts build --mode development --watch", - "build-js": "wp-scripts build --mode production", - "tests:start": "node /project/dev-workspace/docker/scripts/prompt-tests-php-version.js dev-workspace/docker/scripts/pptests php{{VERSION}} start", - "tests:stop": "node /project/dev-workspace/docker/scripts/prompt-tests-php-version.js dev-workspace/docker/scripts/pptests php{{VERSION}} stop", - "tests:brun": "node /project/dev-workspace/docker/scripts/prompt-tests-php-version.js dev-workspace/docker/scripts/pptests php{{VERSION}} brun", - "tests:run": "node /project/dev-workspace/docker/scripts/prompt-tests-php-version.js dev-workspace/docker/scripts/pptests php{{VERSION}} run", - "tests:brun80": "dev-workspace/docker/scripts/pptests php8.0 brun", - "tests:run80": "dev-workspace/docker/scripts/pptests php8.0 run", - "tests:ip": "dev-workspace/docker/scripts/pptests php8.0 ip", - "build": "/project/dev-workspace/docker/scripts/ppbuild build", - "build:dir": "/project/dev-workspace/docker/scripts/ppbuild build-dir", - "build:clean": "/project/dev-workspace/docker/scripts/ppbuild clean", - "get-version": "/project/dev-workspace/docker/scripts/ppbuild version", - "make-mo": "wp i18n make-mo ./languages ./languages --allow-root", - "make-pot": "wp i18n make-pot --exclude=/dev-workspace --exclude=/.wordpress-org --exclude=/.github --exclude=/dist --exclude=/tests --exclude=/vendor --exclude=/libraries/internal-vendor . ./languages/post-expirator.pot --allow-root", + "build:js-dev": "wp-scripts build --mode development", + "build:js-watch": "wp-scripts build --mode development --watch", + "build:js": "wp-scripts build --mode production", + "build": "ppbuild build", + "build:dir": "ppbuild build-dir", + "build:clean": "ppbuild clean", + "get:version": "ppbuild version", + "tests:start": "node /scripts/prompt-tests-php-version.js pptests php{{VERSION}} start", + "tests:stop": "node /scripts/prompt-tests-php-version.js pptests php{{VERSION}} stop", + "tests:brun": "node /scripts/prompt-tests-php-version.js pptests php{{VERSION}} brun", + "tests:run": "node /scripts/prompt-tests-php-version.js pptests php{{VERSION}} run", + "tests:brun80": "pptests php8.0 brun", + "tests:run80": "pptests php8.0 run", + "tests:ip": "pptests php8.0 ip", + "gen:mo": "wp i18n make-mo ./languages ./languages --allow-root", + "gen:pot": "wp i18n make-pot . languages/post-expirator.pot --domain=post-expirator --exclude=dev-workspace,.wordpress-org,.github,dist,tests, --allow-root", "gh-cleanup-workflows": "user=publishpress repo=publishpress-future; gh api repos/$user/$repo/actions/runs --paginate -q '.workflow_runs[] | select(.head_branch != \"master\") | \"\\(.id)\"' | xargs -n1 -I % gh api --silent repos/$user/$repo/actions/runs/% -X DELETE", "check:lint": "phplint", "check:phpcs": "phpcs", "check:stan": "phpstan", - "phpcompat:7.2": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.2", - "phpcompat:7.4": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.4", - "phpcompat:8.0": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.0", - "phpcompat:8.1": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.1", - "phpcompat:8.2": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.2" + "check:php-7.2": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.2", + "check:php-7.4": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.4", + "check:php-8.0": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.0", + "check:php-8.1": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.1", + "check:php-8.2": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.2" }, "extra": { "plugin-slug": "post-expirator", diff --git a/composer.lock b/composer.lock index fb4a864c6..02ccd63f6 100644 --- a/composer.lock +++ b/composer.lock @@ -357,16 +357,16 @@ }, { "name": "woocommerce/action-scheduler", - "version": "3.6.0", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/woocommerce/action-scheduler.git", - "reference": "1373570a9ee03a0be31c73df086d1e4343a27347" + "reference": "7fd383cad3d64b419ec81bcd05bab44355a6e6ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/1373570a9ee03a0be31c73df086d1e4343a27347", - "reference": "1373570a9ee03a0be31c73df086d1e4343a27347", + "url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/7fd383cad3d64b419ec81bcd05bab44355a6e6ef", + "reference": "7fd383cad3d64b419ec81bcd05bab44355a6e6ef", "shasum": "" }, "require-dev": { @@ -391,9 +391,9 @@ "homepage": "https://actionscheduler.org/", "support": { "issues": "https://github.com/woocommerce/action-scheduler/issues", - "source": "https://github.com/woocommerce/action-scheduler/tree/3.6.0" + "source": "https://github.com/woocommerce/action-scheduler/tree/3.6.1" }, - "time": "2023-05-10T19:25:40+00:00" + "time": "2023-06-14T19:23:12+00:00" } ], "packages-dev": [ @@ -1971,28 +1971,28 @@ }, { "name": "doctrine/inflector", - "version": "2.0.6", + "version": "2.0.8", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024" + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/f9301a5b2fb1216b2b08f02ba04dc45423db6bff", + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^10", + "doctrine/coding-standard": "^11.0", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.3", "phpunit/phpunit": "^8.5 || ^9.5", - "vimeo/psalm": "^4.25" + "vimeo/psalm": "^4.25 || ^5.4" }, "type": "library", "autoload": { @@ -2042,7 +2042,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.6" + "source": "https://github.com/doctrine/inflector/tree/2.0.8" }, "funding": [ { @@ -2058,7 +2058,7 @@ "type": "tidelift" } ], - "time": "2022-10-20T09:10:12+00:00" + "time": "2023-06-16T13:40:37+00:00" }, { "name": "doctrine/instantiator", @@ -2268,16 +2268,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.17.0", + "version": "v3.20.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "3f0ed862f22386c55a767461ef5083bddceeed79" + "reference": "0e8249e0b15e2bc022fbbd1090ce29d071481e69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/3f0ed862f22386c55a767461ef5083bddceeed79", - "reference": "3f0ed862f22386c55a767461ef5083bddceeed79", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/0e8249e0b15e2bc022fbbd1090ce29d071481e69", + "reference": "0e8249e0b15e2bc022fbbd1090ce29d071481e69", "shasum": "" }, "require": { @@ -2352,7 +2352,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.17.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.20.0" }, "funding": [ { @@ -2360,7 +2360,7 @@ "type": "github" } ], - "time": "2023-05-22T19:59:32+00:00" + "time": "2023-06-27T20:22:39+00:00" }, { "name": "gettext/gettext", @@ -3647,16 +3647,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.5", + "version": "v4.16.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" + "reference": "19526a33fb561ef417e822e85f08a00db4059c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", + "reference": "19526a33fb561ef417e822e85f08a00db4059c17", "shasum": "" }, "require": { @@ -3697,9 +3697,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" }, - "time": "2023-05-19T20:20:00+00:00" + "time": "2023-06-25T14:52:30+00:00" }, { "name": "overtrue/phplint", @@ -4247,16 +4247,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.18", + "version": "1.10.21", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f" + "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52b6416c579663eebdd2f1d97df21971daf3b43f", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", + "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", "shasum": "" }, "require": { @@ -4305,7 +4305,7 @@ "type": "tidelift" } ], - "time": "2023-06-07T22:00:43+00:00" + "time": "2023-06-21T20:07:58+00:00" }, { "name": "phpunit/php-code-coverage", @@ -6799,16 +6799,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v5.4.23", + "version": "v5.4.25", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "4a286c916b74ecfb6e2caf1aa31d3fe2a34b7e08" + "reference": "d2aefa5a7acc5511422792931d14d1be96fe9fea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4a286c916b74ecfb6e2caf1aa31d3fe2a34b7e08", - "reference": "4a286c916b74ecfb6e2caf1aa31d3fe2a34b7e08", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/d2aefa5a7acc5511422792931d14d1be96fe9fea", + "reference": "d2aefa5a7acc5511422792931d14d1be96fe9fea", "shasum": "" }, "require": { @@ -6854,7 +6854,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v5.4.23" + "source": "https://github.com/symfony/dom-crawler/tree/v5.4.25" }, "funding": [ { @@ -6870,7 +6870,7 @@ "type": "tidelift" } ], - "time": "2023-04-08T21:20:19+00:00" + "time": "2023-06-05T08:05:41+00:00" }, { "name": "symfony/event-dispatcher", diff --git a/dev-workspace/docker/Dockerfile b/dev-workspace/docker/Dockerfile index ff93dc9fc..65dce7824 100644 --- a/dev-workspace/docker/Dockerfile +++ b/dev-workspace/docker/Dockerfile @@ -71,12 +71,7 @@ RUN set -ex; \ # More info: https://github.com/deluan/zsh-in-docker -RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.3/zsh-in-docker.sh)" -- \ - -t ys \ - -p git \ - -p asdf \ - -p ag \ - -p wp-cli +RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" COPY root/.zshrc /root/.zshrc @@ -201,6 +196,14 @@ RUN yarn --version # RUN pip3 install med2image +#################################################################################################### +# Install WP-CLI +#################################################################################################### + +RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ + && chmod +x wp-cli.phar \ + && mv wp-cli.phar /usr/local/bin/wp + #################################################################################################### # Configure the image #################################################################################################### diff --git a/dev-workspace/docker/root/.zshrc b/dev-workspace/docker/root/.zshrc index 60e59d308..5db6b61e2 100644 --- a/dev-workspace/docker/root/.zshrc +++ b/dev-workspace/docker/root/.zshrc @@ -100,6 +100,8 @@ source $ZSH/oh-my-zsh.sh # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" +alias wp="wp --allow-root" + export PROJECT_PATH="/project" export PROMPT=" diff --git a/dev-workspace/docker/scripts/ppbuild b/dev-workspace/docker/scripts/ppbuild index 4a99e4e2f..e69e9a619 100755 --- a/dev-workspace/docker/scripts/ppbuild +++ b/dev-workspace/docker/scripts/ppbuild @@ -2,7 +2,7 @@ start_time=$(date +%s) -script_version="1.2.3" +script_version="1.2.1" command=${1} source_path=$(pwd) @@ -83,7 +83,7 @@ echo_step() { ####################################### clean_dist() { echo_step "Removing the folder ${tmp_build_dir} if exists" - rm -rf "${tmp_build_dir}" "${tmp_build_dir}-tmp" + rm -rf "${tmp_build_dir}" || return 1 } ####################################### @@ -99,21 +99,21 @@ build_to_dir() { clean_dist echo_step "Copying plugin files to the dist dir filtering the files listed on .rsync-filters-pre-build" - mkdir -p "${tmp_build_dir}" - rsync -r -f 'merge .rsync-filters-pre-build' "${source_path}/" "${tmp_build_dir}" + mkdir -p "${tmp_build_dir}" || return 1 + rsync -r -f 'merge .rsync-filters-pre-build' "${source_path}/" "${tmp_build_dir}" || return 2 echo_step "Running composer install" echo "" - composer install --no-dev --working-dir="${tmp_build_dir}" + composer install --no-dev --working-dir="${tmp_build_dir}" || return 3 + echo "" echo_step "Removing files listed on .rsync-filters-post-build" - rsync -r -f 'merge .rsync-filters-post-build' "${tmp_build_dir}/" "${tmp_build_dir}-tmp" - rm -rf "${tmp_build_dir}" - mv "${tmp_build_dir}-tmp" "${tmp_build_dir}" - - echo "" + rsync -r -f 'merge .rsync-filters-post-build' "${tmp_build_dir}/" "${tmp_build_dir}-tmp" || return 4 + rm -rf "${tmp_build_dir}" || return 5 + mv "${tmp_build_dir}-tmp" "${tmp_build_dir}" || return 6 } + ####################################### # Build the plugin code to a subdir named # as the plugin name in the dist dir and @@ -130,11 +130,11 @@ pack_built_dir() { zip_filename="${plugin_name}-${plugin_version}.zip" zip_path="${dist_path}/${zip_filename}" echo_step "Removing old zip file, if exists" - rm -f "${zip_path}" - pushd "${dist_path}" >/dev/null 2>&1 + rm -f "${zip_path}" || return 1 + pushd "${dist_path}" >/dev/null 2>&1 || return 2 echo_step "Creating the zip file on dist/${zip_filename}" - zip -qr "${zip_path}" ./${plugin_folder} - popd >/dev/null 2>&1 + zip -qr "${zip_path}" ./${plugin_folder} || return 3 + popd >/dev/null 2>&1 || return 4 } ####################################### @@ -167,6 +167,23 @@ repeat() { done } +echo_box_line() { + local start_char=$1 + local content=$2 + local fill_char=$3 + local end_char=$4 + + # Example: Calculate the width of the box (80 characters wide) + local width=$cols + + # Calculate the number of fill characters needed + local fill_length=$(($width - ${#start_char} - ${#content} - ${#end_char})) + local fill=$(printf "%0.s$fill_char" $(seq 1 $fill_length)) + + # Output the line + echo "${start_char}${content}${fill}${end_char}" +} + ####################################### # Show the header for the script, showing # a few details of the plugin. @@ -179,16 +196,15 @@ repeat() { # The formatted header. ####################################### echo_header() { - repeat "=" $cols - line=$(repeat "-" $(($cols - 16))) - echo " __ PUBLISHPRESS PLUGIN BUILDER - v${script_version}" - echo " -=(o '. ${line}" - echo " '.-.\ Name: ${plugin_name}" - echo " /| \\\ Slug: ${plugin_slug}" - echo " '| || Folder: ${plugin_folder}" - echo " _\_):,_ Version: ${plugin_version}" - echo "" - repeat "=" $cols + echo_box_line "╔" "" "═" "╗" + echo_box_line "║" " __ PUBLISHPRESS PLUGIN BUILDER - v${script_version}" " " "║" + echo_box_line "║" " -=(o '. " "─" "║" + echo_box_line "║" " '.-.\ Name: ${plugin_name}" " " "║" + echo_box_line "║" " /| \\\ Slug: ${plugin_slug}" " " "║" + echo_box_line "║" " '| || Folder: ${plugin_folder}" " " "║" + echo_box_line "║" " _\_):,_ Version: ${plugin_version}" " " "║" + echo_box_line "║" "" " " "║" + echo_box_line "╚" "" "═" "╝" echo "" } @@ -197,29 +213,69 @@ if [ "${HIDE_HEADER}" != "1" ]; then echo_header fi -case "${command}" in -"build-dir") - echo "Building to dist dir:" +echo_command_header() { + echo "🚀" " ${1}" + echo "" +} + +echo_success() { echo "" - build_to_dir + echo "✅" " ${1}" +} + +echo_error() { + echo "" + echo "❌" " ${1}" +} + +echo_separator() { + repeat "─" $cols echo "" - echo "Plugin successfully built to the dist dir!" +} + +run_commands() { + all_success=true + + for passed_command in "$@"; do + echo_command_header "Running command: ${passed_command}" + + # Execute the command + eval "${passed_command}" + + # Check the exit status of the command + if [ $? -ne 0 ]; then + # If the exit status is not 0, set the flag to false + all_success=false + + # Show the error message + echo_error "Command failed: ${passed_command}" + + # Break out of the loop (optional, if you want to stop executing further commands on failure) + break + fi + + echo_success "Command successfully executed: ${passed_command}" + echo_separator + done + + # Display a message based on whether all commands were successful or not + if $all_success ; then + # echo positive emoji + echo "🎉" " All commands executed successfully!" + fi +} + +case "${command}" in +"build-dir") + run_commands "clean_dist" "build_to_dir" show_time ;; "build") - echo "Building to zip file:" - echo "" - build_to_dir - pack_built_dir - clean_dist - echo "" - echo "Plugin successfully built to a zip file!" + run_commands "clean_dist" "build_to_dir" "pack_built_dir" show_time ;; "clean") - echo "Cleaning directory on dist dir:" - echo "" - clean_dist + run_commands "clean_dist" ;; "version") echo "${plugin_version}" > version.txt diff --git a/languages/post-expirator-fr_FR.mo b/languages/post-expirator-fr_FR.mo index 72593fe8f591b288d14ac68d36060a12432ae46e..6729e67515584956a268ca053b703ef4e58e9d2a 100644 GIT binary patch delta 5549 zcmb`J32;@_8GuhD(F6#P1QOP82w{`#kzgaMED|;m+}XUzyUBa-^6ujdO$%!%UMZz#sS$av%@xk|kVHxzJTq=zci0=L1n@L9MT4l7jZD!38u zg?(@zTrf=$kDi2z44D5jC!(9NaksF>xnkZ*>TcgfGAm@Hg-Pd_Oz? z5Rb zLAVP37G43X$&&>$@HO}rl!!fp5^=OY!;OUOR}dZQk5EFMOFTv47$^~%3UN|ZLGfsD zmTRHZ#0^jk-3Fh8H^Vkq$L5d2d$XKduGA$wzYFKUOvS`V@n$F%_dxOJCAb`x>8NU3 zp;(-PTVW4e0pEdQVBMrBMNLpbd^qa>6Z?|`de z2F`#lXXpO{B?6zqMmUNy7uE`VI)_?;o0%_|64gioUdQthXhA)d<^^wpN8r3^)PjBKi>2 z@I5H|4yGbo(67q5ks64@+3*%9A$$(vtU3ZI3-un9Naa;Ukt%^wjH9#9)1a)Yf?~ij zD28o<)T2s6{?zSUWZy$Dqq%vV8&UXoSO5oAN5`iS4&k{HipO=?=N4GV^HosRx50ea z35mAqf)bgBvd;$~K~ukmqDR#zbtA~HA^vi+hl%mzaB!_s&+|O3E>e6Fisc_eF`%$M z@@y&;g>#^WOQ6(7J1m4dp`>gtTmtWbqWCo^k@+2*2tTPO{)4$GZHN|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G4l3^(i;R*U6C3@02h8p2U0n5$-YKlSPxtza}{1=8(Ci{an_7l(c9h>RP&U$X9L_*a& z`rVf6O{UlW-srt4dBJevkTseul$A2so+sPEto321!QK#c^ue((=mEipfSrdG&;ew9CtT*P70TsJVex8eILe{OPF`Wfi^kgM~)ocC@D! zuL<;;*s*15d=;TH^a1t4Z!bz1$Lqho;fY zVUD*&;%!F64M$tzZ5^$->W1S@e;jwju^a4oTbaI6GD;5`_gu-`?h_ic4F4e7l*)9C zV7#rtj7HQ-Gh{_wPq$7Qq2C?1Eq!J~gUwBJ+gFrcN$EK+dEe%YKca_L9MGpL8uir5 zUHaFR8)LNu8C@T;>yuZYD-3gEI7---5pOj@W?~a9Bgh?$w>5K`L-96_-)Fq*MVp&l zyGhqqXB$nOYWa+Yn+)yu_l{Md%rvH<_0Dc3)i` zuDVx0pOf33Heqy+_UV%|0@-t@jO}ogtgRA5SK0J4lSb(i6Vm$g?7C_7{M+|sCNi_! zuFGs&I=%XSy`*MrV87m4Gooj5YxL7KV^V@qy-ab-ZrHj@D|U<6uW?f&N|L=v0|TpDxOY$z!?NwM_asbAMWADU#%PquG=7G-^$* zShU3og&4_aG_f`Q{MWy%FBD~bkr?FsNtO8=M%~YgL9T>TZ(ELY(;)QuqFy~IpJ_+h zpPbq!ttxSsTG&UqP9ZrHZrG;QPQ0z&@;uXad6o#E>w96jx^viIz8KHUY94Ui7ej4W T+o=DQw 1;\n" -"X-Generator: Poedit 3.2.2\n" +"X-Generator: Poedit 3.3\n" -#: legacy/views/menu-defaults.php:184 legacy/views/menu-general.php:95 -msgid "Default date/time offset" -msgstr "Décalage date/heure par défaut" +#. Plugin Name of the plugin +#: classes/Display.class.php:50 classes/Facade.class.php:374 +#: post-expirator.php:350 views/bulk-edit.php:16 +msgid "PublishPress Future" +msgstr "PublishPress Future" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:430 -msgid "%1$s (%2$s) has expired at %3$s. %4$s" -msgstr "%1$s (%2$s) a expiré à %3$s. %4$s" +#. Plugin URI of the plugin +msgid "http://wordpress.org/extend/plugins/post-expirator/" +msgstr "http://wordpress.org/extend/plugins/post-expirator/" -#: src/Modules/Expirator/ExpirationActions/UnstickPost.php:35 -msgid "Post has been removed from stickies list." -msgstr "La publication a été supprimée de la liste des épinglés." +#. Description of the plugin +msgid "" +"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." +msgstr "" +"Autorise l’ajout à vos publications d’une date d’expiration (à la minute " +"près) que vous pouvez configurer pour supprimer la publication, la mettre en " +"brouillon ou mettre à jour les catégories au moment de l’expiration." -#: src/Modules/Expirator/ExpirationActions/StickPost.php:35 -msgid "Post has been added to stickies list." -msgstr "La publication a été ajoutée à la liste des épinglés." +#. Author of the plugin +msgid "PublishPress" +msgstr "PublishPress" -#: src/Modules/Expirator/ExpirationActions/PostStatusToDraft.php:36 -#: src/Modules/Expirator/ExpirationActions/PostStatusToPrivate.php:36 -#: src/Modules/Expirator/ExpirationActions/PostStatusToTrash.php:36 -msgid "Post status has been successfully changed to \"%s\"." -msgstr "L’état de la publication a bien été modifié à « %s »." +#. Author URI of the plugin +msgid "http://publishpress.com" +msgstr "http://publishpress.com" -#: src/Modules/Expirator/ExpirationActions/PostCategorySet.php:46 -msgid "The following terms (%s) were set to the post: \"%s\". The old list of terms on the post was: %s." -msgstr "Les termes suivants (%s) ont été définis pour la publication : « %s ». L’ancienne liste de termes de la publication était : %s." +#: classes/Display.class.php:49 views/tabs.php:8 +msgid "PublishPress Future Options" +msgstr "Options de PublishPress Future" -#: src/Modules/Expirator/ExpirationActions/PostCategoryRemove.php:49 -msgid "The following terms (%s) were removed from the post: \"%s\". The new list of terms on the post is: %s." -msgstr "Les termes suivants (%s) ont été supprimés de la publication : « %s ». La nouvelle liste de termes de la publication est : %s." +#: classes/Display.class.php:159 +msgid "Debugging Disabled" +msgstr "Débogage désactivé" -#: src/Modules/Expirator/ExpirationActions/PostCategoryAdd.php:51 -msgid "The following terms (%s) were added to the post: \"%s\". The full list of terms on the post is: %s." -msgstr "Les termes suivants (%s) ont été ajoutés à la publication : « %s ». La liste complète des termes de la publication est : %s." +#: classes/Display.class.php:164 +msgid "Debugging Enabled" +msgstr "Débogage activé" -#: src/Modules/Expirator/ExpirationActions/DeletePost.php:35 -msgid "Post has been successfully deleted." -msgstr "La publication a bien été supprimée." +#: classes/Display.class.php:171 +msgid "Debugging Table Emptied" +msgstr "Table de débogage vidée" -#: legacy/classes/Facade.class.php:385 legacy/views/bulk-edit.php:133 -#: legacy/views/classic-metabox.php:135 legacy/views/quick-edit.php:96 -msgid "Expiration Taxonomies" -msgstr "Taxonomies d’expiration" +#: classes/Display.class.php:187 +msgid "" +"Below is a dump of the debugging table, this should be useful for " +"troubleshooting." +msgstr "" +"Ci-dessous une extraction de la table de débogage, cela devrait vous aider." -#: legacy/classes/Facade.class.php:380 legacy/views/how-to-expire.php:54 -#: views/how-to-expire.php:54 -msgid "Taxonomy: Remove" -msgstr "Taxonomie : Retirer" +#: classes/Display.class.php:241 classes/Display.class.php:307 +msgid "Saved Options!" +msgstr "Options enregistrées !" -#: legacy/classes/Facade.class.php:379 legacy/views/how-to-expire.php:50 -#: views/how-to-expire.php:50 -msgid "Taxonomy: Add" -msgstr "Taxonomie : Ajouter" +#: classes/Display.class.php:344 +msgid "If you like %s, please leave us a %s rating. Thank you!" +msgstr "Si vous appréciez %s, veuillez nous laisser une note de %s. Merci !" -#: legacy/classes/Facade.class.php:378 legacy/views/how-to-expire.php:46 -#: views/how-to-expire.php:46 -msgid "Taxonomy: Replace" -msgstr "Taxonomie : Remplacer" +#: classes/Display.class.php:359 +msgid "About PublishPress Future" +msgstr "À propos de PublishPress Future" -#: legacy/classes/Facade.class.php:371 -msgid "Taxonomy" -msgstr "Taxonomie" +#: classes/Display.class.php:361 +msgid "About" +msgstr "À propos" -#: legacy/views/menu-diagnostics.php:103 -msgid "Posts and expiration settings" -msgstr "Réglages des publications et de l’expiration" +#: classes/Display.class.php:367 +msgid "Future Documentation" +msgstr "Documentation de Future" -#: legacy/views/expire-column.php:21 -msgid "Cron event not found!" -msgstr "L’évènement cron n’a pas été trouvé !" +#: classes/Display.class.php:369 +msgid "Documentation" +msgstr "Documentation" -#: legacy/views/expire-column.php:18 -msgid "Cron event scheduled." -msgstr "L’évènement cron a été planifié." +#: classes/Display.class.php:375 +msgid "Contact the PublishPress team" +msgstr "Contacter l’équipe PublishPress" -#: legacy/classes/Display.class.php:83 -msgid "You do not have permission to configure PublishPress Future." -msgstr "Vous n’avez pas les droits nécessaires pour configurer PublishPress Future." +#: classes/Display.class.php:377 +msgid "Contact" +msgstr "Contact" -#: legacy/views/tabs.php:36 -msgid "Advanced" -msgstr "Avancé" +#: classes/Facade.class.php:365 views/how-to-expire.php:27 +msgid "Draft" +msgstr "Brouillon" -#: legacy/views/tabs.php:26 -msgid "Display" -msgstr "Afficher" +#: classes/Facade.class.php:366 views/how-to-expire.php:30 +msgid "Delete" +msgstr "Supprimer" -#: legacy/views/menu-editor.php:10 -msgid "Editor" -msgstr "Éditeur" +#: classes/Facade.class.php:367 views/how-to-expire.php:33 +msgid "Trash" +msgstr "Corbeille" -#: legacy/views/menu-defaults.php:130 -msgid "Select whether the PublishPress Future is enabled for all new posts." -msgstr "Sélectionnez si la fonctionnalité PublishPress est activée ou non pour toutes les nouvelles publications." +#: classes/Facade.class.php:368 views/how-to-expire.php:36 +msgid "Private" +msgstr "Privé" -#: legacy/views/menu-advanced.php:51 -msgid "Choose which user roles can use PublishPress Future" -msgstr "Choisir les rôles pouvant utiliser PublishPress Future" +#: classes/Facade.class.php:369 views/how-to-expire.php:39 +msgid "Stick" +msgstr "Épingler" -#: legacy/classes/Display.class.php:504 -msgid "Contact" -msgstr "Contact" +#: classes/Facade.class.php:370 views/how-to-expire.php:42 +msgid "Unstick" +msgstr "Ne plus épingler" -#: legacy/classes/Display.class.php:502 -msgid "Contact the PublishPress team" -msgstr "Contacter l’équipe PublishPress" +#: classes/Facade.class.php:371 views/how-to-expire.php:47 +msgid "Taxonomy: Replace" +msgstr "Taxonomie : Remplacer" -#: legacy/classes/Display.class.php:496 -msgid "Documentation" -msgstr "Documentation" +#: classes/Facade.class.php:372 views/how-to-expire.php:50 +msgid "Taxonomy: Add" +msgstr "Taxonomie : Ajouter" -#: legacy/classes/Display.class.php:494 -msgid "Future Documentation" -msgstr "Documentation de Future" +#: classes/Facade.class.php:373 views/how-to-expire.php:53 +msgid "Taxonomy: Remove" +msgstr "Taxonomie : Retirer" -#: legacy/classes/Display.class.php:488 -msgid "About" -msgstr "À propos" +#: classes/Facade.class.php:375 views/bulk-edit.php:24 +#: views/classic-metabox.php:6 views/quick-edit.php:8 +msgid "Enable Future Action" +msgstr "Autoriser l’expiration de vos contenus" -#: legacy/classes/Display.class.php:486 -msgid "About PublishPress Future" -msgstr "À propos de PublishPress Future" +#: classes/Facade.class.php:376 views/bulk-edit.php:109 +#: views/classic-metabox.php:109 views/menu-defaults.php:84 +#: views/quick-edit.php:72 +msgid "Action" +msgstr "Mode d’expiration" -#: legacy/classes/Display.class.php:471 -msgid "If you like %s, please leave us a %s rating. Thank you!" -msgstr "Si vous appréciez %s, veuillez nous laisser une note de %s. Merci !" +#: classes/Facade.class.php:377 +msgid "Loading" +msgstr "Chargement" -#: legacy/classes/Display.class.php:57 -msgid "Future" -msgstr "Future" +#: classes/Facade.class.php:378 views/bulk-edit.php:127 +#: views/classic-metabox.php:127 views/quick-edit.php:88 +msgid "Expiration Taxonomies" +msgstr "Taxonomies d’expiration" -#: legacy/classes/Display.class.php:56 -msgid "PublishPress Future Options" -msgstr "Options de PublishPress Future" +#: post-expirator-debug.php:77 +msgid "Debugging table is currently empty." +msgstr "La table de débogage est actuellement vide." -#. Plugin Name of the plugin -#: legacy/classes/Facade.class.php:381 legacy/functions.php:356 -#: legacy/views/bulk-edit.php:18 legacy/views/tabs.php:14 -msgid "PublishPress Future" -msgstr "PublishPress Future" +#: post-expirator-debug.php:82 +msgid "Timestamp" +msgstr "Horodatage" -#: legacy/views/menu-advanced.php:104 -msgid "Toggle between preserving or deleting data after the plugin is deactivated." -msgstr "Permutez entre la conservation ou la suppression des données après la désactivation de l’extension." +#: post-expirator-debug.php:83 +msgid "Message" +msgstr "Message" -#: legacy/views/menu-advanced.php:100 -msgid "Delete data" -msgstr "Supprimer les données" +#: post-expirator.php:15 +msgid "l F jS, Y" +msgstr "I j F Y" -#: legacy/views/menu-advanced.php:91 -msgid "Preserve data" -msgstr "Conserver les données" +#: post-expirator.php:16 +msgid "g:ia" +msgstr "g\\hia" -#: legacy/views/menu-advanced.php:82 -msgid "Preserve data after deactivating the plugin" -msgstr "Conserver les données après la désactivation de l’extension" +#: post-expirator.php:17 +msgid "Post expires at EXPIRATIONTIME on ACTIONDATE" +msgstr "La publication expire à EXPIRATIONTIME le ACTIONDATE" -#: legacy/views/menu-diagnostics.php:76 -msgid "No cron events found for the plugin." -msgstr "Aucun évènement cron n’a été trouvé pour l’extension." +#: post-expirator.php:44 +msgid "Settings" +msgstr "Réglages" -#: legacy/classes/Facade.class.php:384 -msgid "Loading" -msgstr "Chargement" +#: post-expirator.php:86 post-expirator.php:172 +msgid "Future action" +msgstr "Future action" -#: legacy/views/tabs.php:31 -msgid "Post Types" -msgstr "Type de publications" +#: post-expirator.php:804 post-expirator.php:826 post-expirator.php:848 +#: post-expirator.php:870 +msgid "" +"%1$s (%2$s) has expired at %3$s. Post status has been successfully changed " +"to \"%4$s\"." +msgstr "" +"%1$s (%2$s) a expiré à %3$s. L’état de la publication a bien été modifié à " +"« %4$s »." -#: legacy/views/menu-advanced.php:42 legacy/views/menu-editor.php:27 -msgid "Toggle between native support for the Block Editor or the backward compatible Classic Editor style metabox." -msgstr "Permuter entre la prise en charge native de l’éditeur de blocs et la boite méta de l’éditeur classique, qui est rétrocompatible." +#: post-expirator.php:892 +msgid "" +"%1$s (%2$s) has expired at %3$s. Post \"%4$s\" status has been successfully " +"set." +msgstr "" +"%1$s (%2$s) a expiré à %3$s. L’état de publication « %4$s » a bien été " +"defini." -#: legacy/views/menu-advanced.php:40 legacy/views/menu-editor.php:25 -msgid "Show Classic Editor style box" -msgstr "Afficher la boîte de style de l’éditeur classique" +#: post-expirator.php:911 +msgid "" +"%1$s (%2$s) has expired at %3$s. Post \"%4$s\" status has been successfully " +"removed." +msgstr "" +"%1$s (%2$s) a expiré à %3$s. L’état de publication « %4$s » a bien été " +"supprimé." -#: legacy/views/menu-advanced.php:34 legacy/views/menu-editor.php:21 -msgid "Show Gutenberg style box" -msgstr "Afficher la boîte de style Gutenberg" +#: post-expirator.php:937 post-expirator.php:979 +msgid "" +"%1$s (%2$s) has expired at %3$s. Post \"%4$s\" have now been set to \"%5$s\"." +msgstr "" +"%1$s (%2$s) a expiré à %3$s. La publication « %4$s » a été définie comme " +"« %5$s »." -#: legacy/views/menu-advanced.php:28 legacy/views/menu-editor.php:17 -msgid "Block Editor Support" -msgstr "Support de l’éditeur de blocs" +#: post-expirator.php:1037 post-expirator.php:1080 +msgid "" +"%1$s (%2$s) has expired at %3$s. The following post \"%4$s\" have now been " +"added: \"%5$s\". The full list of categories on the post are: \"%6$s\"." +msgstr "" +"%1$s (%2$s) a expiré à %3$s. La publication suivante « %4$s » a été " +"ajoutée : « %5$s ». La liste complète des catégories de la publication est " +"la suivante : « %6$s »." -#: legacy/views/menu-advanced.php:18 -msgid "Please do not update anything here unless you know what it entails. For advanced users only." -msgstr "Veuillez ne rien mettre à jour ici si vous ne savez pas ce que cela implique. Pour les utilisateurs/utilisatrices avancés uniquement." +#: post-expirator.php:1145 post-expirator.php:1195 +msgid "" +"%1$s (%2$s) has expired at %3$s. The following post \"%4$s\" have now been " +"removed: \"%5$s\". The full list of categories on the post are: \"%6$s\"." +msgstr "" +"%1$s (%2$s) a expiré à %3$s. La publication suivante « %4$s » a maintenant " +"été retirée : « %5$s ». La liste complète des catégories de la publication " +"est la suivante : « %6$s »." -#: legacy/views/menu-advanced.php:16 -msgid "Advanced Options" -msgstr "Options avancées" +#: post-expirator.php:1247 +msgid "Future Action Complete \"%s\"" +msgstr "Expiration du contenu « %s »" -#: legacy/views/menu-general.php:85 -msgid "The default format to use when displaying the action time within a post using the shortcode or within the footer. For information on valid formatting options, see: %s." -msgstr "Le format par défaut à utiliser pour afficher le délai d’expiration dans une publication à l’aide du code court ou dans le pied de page. Pour plus d’informations sur les options de formatage valides, voir : %s." +#: post-expirator.php:1931 +msgid "" +"Select the hierarchical taxonomy to be used for \"category\" based " +"expiration." +msgstr "" +"Sélectionnez la taxonomie hiérarchique à utiliser pour l’expiration basée " +"sur la catégorie." -#: legacy/views/menu-general.php:68 -msgid "The default format to use when displaying the action date within a post using the shortcode or within the footer. For information on valid formatting options, see: %s." -msgstr "Le format par défaut à utiliser lors de l’affichage de la date d’expiration dans une publication à l’aide du code court ou dans le pied de page. Pour plus d’informations sur les options de formatage valides, voir : %s." +#: post-expirator.php:1936 +msgid "No taxonomies found" +msgstr "Aucune taxonomie trouvée" -#: legacy/views/menu-display.php:37 -msgid "%1$s - valid options are %2$sfull%3$s (default), %4$sdate%5$s, %6$stime%7$s" -msgstr "%1$s - les options valides sont %2$sfull%3$s (par défaut), %4$sdate%5$s, %6$stime%7$s" +#: post-expirator.php:1983 +msgid "You're not allowed to set posts to expire" +msgstr "" +"Vous n’avez pas le droit de définir une date d’expiration pour les " +"publications." -#: legacy/views/menu-display.php:33 -msgid "Valid %s attributes:" -msgstr "Attributs %s valides :" +#: post-expirator.php:1984 +msgid "Forbidden" +msgstr "Interdit" -#: legacy/views/menu-display.php:31 -msgid "Shortcode" -msgstr "Code court" +#: views/bulk-edit.php:21 views/menu-diagnostics.php:90 views/quick-edit.php:14 +msgid "Date" +msgstr "Date" -#: legacy/views/menu-diagnostics.php:16 -msgid "Debug Logging" -msgstr "Journalisation de débogage" +#: views/bulk-edit.php:28 +msgid "No Change" +msgstr "Aucune modification" -#: legacy/views/bulk-edit.php:109 legacy/views/quick-edit.php:74 -msgid "Type" -msgstr "Type" +#: views/bulk-edit.php:32 +msgid "Change expiry date if enabled on posts" +msgstr "Modifiez la date d’expiration si elle est activée sur les publications" -#: legacy/functions.php:1168 -msgid "No taxonomies found" -msgstr "Aucune taxonomie trouvée" +#: views/bulk-edit.php:33 +msgid "Change on posts" +msgstr "Modification des publications" -#. Author URI of the plugin -msgid "http://publishpress.com" -msgstr "http://publishpress.com" +#: views/bulk-edit.php:36 +msgid "Add expiry date if not enabled on posts" +msgstr "" +"Ajouter la date d’expiration si elle n’est pas activée sur les publications" -#. Author of the plugin -msgid "PublishPress" -msgstr "PublishPress" +#: views/bulk-edit.php:37 +msgid "Add to posts" +msgstr "Ajouter aux publications" -#: legacy/views/menu-defaults.php:194 legacy/views/menu-general.php:103 -msgid "Set the offset to use for the default action date and time. For information on formatting, see %1$s. For example, you could enter %2$s+1 month%3$s or %4$s+1 week 2 days 4 hours 2 seconds%5$s or %6$snext Thursday%7$s." -msgstr "Définissez le décalage à utiliser pour la date et l’heure d’expiration par défaut. Pour plus d’informations sur le formatage, voir %1$s. Par exemple, vous pouvez saisir %2$s + 1 mois%3$s ou %4$s + 1 semaine 2 jours 4 heures 2 secondes%5$s ou %6$sprochain jeudi%7$s." +#: views/bulk-edit.php:40 +msgid "Change & Add" +msgstr "Modifier et ajouter" -#: legacy/views/bulk-edit.php:46 +#: views/bulk-edit.php:43 msgid "Remove from posts" msgstr "Retirer des publications" -#: legacy/views/bulk-edit.php:43 -msgid "Change & Add" -msgstr "Modifier et ajouter" +#: views/bulk-edit.php:49 views/classic-metabox.php:50 views/quick-edit.php:17 +msgid "Month" +msgstr "Mois" -#: legacy/views/bulk-edit.php:39 -msgid "Add to posts" -msgstr "Ajouter aux publications" +#: views/bulk-edit.php:73 views/classic-metabox.php:71 views/quick-edit.php:39 +msgid "Day" +msgstr "Jour" -#: legacy/views/bulk-edit.php:38 -msgid "Add expiry date if not enabled on posts" -msgstr "Ajouter la date d’expiration si elle n’est pas activée sur les publications" +#: views/bulk-edit.php:80 views/classic-metabox.php:22 views/quick-edit.php:46 +msgid "Year" +msgstr "Année" -#: legacy/views/bulk-edit.php:35 -msgid "Change on posts" -msgstr "Modification des publications" +#: views/bulk-edit.php:87 views/classic-metabox.php:78 views/quick-edit.php:53 +msgid "Hour" +msgstr "Heure" -#: legacy/views/bulk-edit.php:34 -msgid "Change expiry date if enabled on p osts" -msgstr "Modifier la date d’expiration si elle est activée sur les publications" +#: views/bulk-edit.php:94 views/classic-metabox.php:102 views/quick-edit.php:59 +msgid "Minute" +msgstr "Minute" -#: legacy/views/bulk-edit.php:30 -msgid "No Change" -msgstr "Aucune modification" +#: views/bulk-edit.php:107 views/quick-edit.php:70 +msgid "Type" +msgstr "Type" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:450 -msgid "[%1$s] %2$s" -msgstr "[%1$s] %2$s" +#: views/classic-metabox.php:13 +msgid "The published date/time will be used as the expiration value" +msgstr "La date/heure publiée sera utilisée comme valeur d’expiration" -#: legacy/classes/Facade.class.php:377 legacy/views/how-to-expire.php:42 -#: views/how-to-expire.php:42 -msgid "Unstick" -msgstr "Ne plus épingler" +#: views/classic-metabox.php:135 +msgid "" +"You must assign a hierarchical taxonomy to this post type to use this " +"feature." +msgstr "" +"Vous devez assigner une taxonomie hiérarchique à ce type de publication pour " +"utiliser cette fonctionnalité." -#: legacy/classes/Facade.class.php:376 legacy/views/how-to-expire.php:38 -#: views/how-to-expire.php:38 -msgid "Stick" -msgstr "Épingler" +#: views/classic-metabox.php:140 +msgid "" +"More than 1 heirachical taxonomy detected. You must assign a default " +"taxonomy on the settings screen." +msgstr "" +"Plus de 1 taxonomie de hiérarchie détectée. Vous devez attribuer une " +"taxonomie par défaut sur l’écran des paramètres." -#: legacy/classes/Facade.class.php:374 legacy/views/how-to-expire.php:30 -#: views/how-to-expire.php:30 -msgid "Trash" -msgstr "Corbeille" +#: views/classic-metabox.php:158 +msgid "Taxonomy Name" +msgstr "Nom de la taxonomie" -#: legacy/views/menu-defaults.php:163 -msgid "Enter a comma separate list of emails that you would like to be notified when the action runs." -msgstr "Saisissez une liste d’e-mails (séparés par des virgules) que vous voulez notifier quand la publication arrive à expiration." +#: views/expire-column.php:12 +msgid "Never" +msgstr "Jamais" -#: legacy/views/menu-general.php:212 -msgid "Enter a comma separate list of emails that you would like to be notified when the action runs. This will be applied to ALL post types. You can set post type specific emails on the Defaults tab." -msgstr "Saisissez une liste d’e-mails (séparés par des virgules) que vous voulez notifier quand la publication arrive à expiration. Cela s’appliquera à TOUS les types de contenu. Vous pouvez définir des e-mails spécifiques en fonction du type de contenu dans l’onglet Par défaut." +#: views/menu-defaults.php:5 +msgid "Default Expiration Values" +msgstr "Valeurs d’expiration par défaut" -#: legacy/views/menu-defaults.php:156 legacy/views/menu-general.php:205 -msgid "Who to notify" -msgstr "Personne à notifier" +#: views/menu-defaults.php:8 +msgid "" +"Use the values below to set the default actions/values to be used for each " +"for the corresponding post types. These values can all be overwritten when " +"creating/editing the post/page." +msgstr "" +"Utilisez les valeurs ci-dessous pour définir les actions/valeurs par défaut " +"à utiliser pour chaque type de publication correspondant. Ces valeurs " +"peuvent toutes être remplacées lors de la création/modification de la " +"publication/page." -#: legacy/views/menu-general.php:196 -msgid "This will include all users with the role of \"Administrator\" in the email." -msgstr "Inclus tous les utilisateurs avec le rôle « Administrateur » dans l’e-mail informant de l’expiration d’un contenu." +#: views/menu-defaults.php:59 views/menu-defaults.php:66 +msgid "Active" +msgstr "Actif" -#: legacy/views/menu-general.php:178 -msgid "Include Blog Administrators?" -msgstr "Inclure les Admins ?" +#: views/menu-defaults.php:73 +msgid "Inactive" +msgstr "Inactif" -#: legacy/views/menu-general.php:170 -msgid "This will enable or disable the send of email notification on future action." -msgstr "Cela activera ou désactivera l’envoi d’une notification par e-mail au moment de l’expiration d’un contenu." +#: views/menu-defaults.php:75 +msgid "" +"Select whether the PublishPress Future meta box is active for this post type." +msgstr "" +"Sélectionnez si la boîte méta d’expiration de la publication est active pour " +"ce type de publication." -#: legacy/views/menu-general.php:154 -msgid "Enable Email Notification?" -msgstr "Activer la notification par e-mail ?" +#: views/menu-defaults.php:94 +msgid "Select the default action for the post type." +msgstr "" +"Sélectionnez le mode d’expiration par défaut pour ce type de publication." -#: legacy/views/menu-general.php:147 -msgid "Whenever an action runs, an email can be sent to alert users." -msgstr "Dès qu’un contenu arrive à expiration, un e-mail peut être envoyé pour informer les utilisateurs de l’expiration." +#: views/menu-defaults.php:100 +msgid "Auto-Enable?" +msgstr "Activer automatiquement" -#: legacy/views/menu-general.php:145 -msgid "Email Notification" -msgstr "Notification e-mail de l’expiration" +#: views/menu-defaults.php:107 views/menu-diagnostics.php:14 +#: views/menu-diagnostics.php:53 views/menu-display.php:73 +#: views/menu-general.php:191 views/menu-general.php:214 +#: views/menu-general.php:263 +msgid "Enabled" +msgstr "Activé" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:447 -msgid "Future Action Complete \"%s\"" -msgstr "Expiration du contenu « %s »" +#: views/menu-defaults.php:114 views/menu-diagnostics.php:27 +#: views/menu-diagnostics.php:57 views/menu-display.php:77 +#: views/menu-general.php:197 views/menu-general.php:221 +#: views/menu-general.php:269 +msgid "Disabled" +msgstr "Désactivé" -#. Description of the plugin -msgid "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." -msgstr "Autorise l’ajout à vos publications d’une date d’expiration (à la minute près) que vous pouvez configurer pour supprimer la publication, la mettre en brouillon ou mettre à jour les catégories au moment de l’expiration." +#: views/menu-defaults.php:116 +msgid "Select whether the PublishPress Future is enabled for all new posts." +msgstr "" +"Sélectionnez si la fonctionnalité PublishPress est activée ou non pour " +"toutes les nouvelles publications." -#. Plugin URI of the plugin -msgid "http://wordpress.org/extend/plugins/post-expirator/" -msgstr "http://wordpress.org/extend/plugins/post-expirator/" +#: views/menu-defaults.php:125 +msgid "Taxonomy (hierarchical)" +msgstr "Taxonomie (hiérarchique)" -#: legacy/classes/Facade.class.php:375 legacy/views/how-to-expire.php:34 -#: views/how-to-expire.php:34 -msgid "Private" -msgstr "Privé" +#: views/menu-defaults.php:140 views/menu-general.php:232 +msgid "Who to notify" +msgstr "Personne à notifier" -#: legacy/classes/Facade.class.php:373 legacy/views/how-to-expire.php:26 -#: views/how-to-expire.php:26 -msgid "Delete" -msgstr "Supprimer" +#: views/menu-defaults.php:147 +msgid "" +"Enter a comma separate list of emails that you would like to be notified " +"when the action runs." +msgstr "" +"Saisissez une liste d’e-mails (séparés par des virgules) que vous voulez " +"notifier quand la publication arrive à expiration." -#: legacy/classes/Facade.class.php:372 legacy/views/how-to-expire.php:22 -#: views/how-to-expire.php:22 -msgid "Draft" -msgstr "Brouillon" +#: views/menu-defaults.php:155 views/menu-general.php:109 +msgid "None" +msgstr "Aucun" -#: legacy/classes/Display.class.php:203 -msgid "Below is a dump of the debugging table, this should be useful for troubleshooting." -msgstr "Ci-dessous une extraction de la table de débogage, cela devrait vous aider." +#: views/menu-defaults.php:156 +msgid "Inherit from General Settings" +msgstr "Hérite de réglages généraux" -#: legacy/views/menu-diagnostics.php:100 -msgid "Event" -msgstr "Évènement" +#: views/menu-defaults.php:157 views/menu-defaults.php:198 +#: views/menu-general.php:112 views/menu-general.php:128 +msgid "Custom" +msgstr "Personnalisé" -#: legacy/views/bulk-edit.php:23 legacy/views/menu-diagnostics.php:97 -#: legacy/views/quick-edit.php:18 -msgid "Date" -msgstr "Date" +#: views/menu-defaults.php:158 +msgid "Publish Time" +msgstr "Heure de publication" -#: legacy/views/menu-diagnostics.php:85 -msgid "The below table will show all currently scheduled cron events for the plugin with the next run time." -msgstr "Le tableau ci-dessous affiche tous les évènements cron actuellement planifiés pour l’extension avec la prochaine date d’exécution." +#: views/menu-defaults.php:173 views/menu-general.php:103 +msgid "Default date/time offset" +msgstr "Décalage date/heure par défaut" -#: legacy/views/menu-diagnostics.php:68 -msgid "Current Cron Schedule" -msgstr "Planification cron actuelle" +#: views/menu-defaults.php:188 +msgid "" +"Set the default expiration date to be used when creating a new post of this " +"type." +msgstr "" +"Définissez la date d’expiration par défaut à utiliser lors de la création " +"des nouvelles publications de ce type." -#: legacy/views/menu-diagnostics.php:55 -msgid "WP-Cron Status" -msgstr "État de WP-Cron" +#: views/menu-defaults.php:205 views/menu-general.php:134 +msgid "" +"Set the offset to use for the default action date and time. For information " +"on formatting, see %1$s. For example, you could enter %2$s+1 month%3$s or " +"%4$s+1 week 2 days 4 hours 2 seconds%5$s or %6$snext Thursday%7$s." +msgstr "" +"Définissez le décalage à utiliser pour la date et l’heure d’expiration par " +"défaut. Pour plus d’informations sur le formatage, voir %1$s. Par exemple, " +"vous pouvez saisir %2$s + 1 mois%3$s ou %4$s + 1 semaine 2 jours 4 heures 2 " +"secondes%5$s ou %6$sprochain jeudi%7$s." -#: legacy/views/menu-diagnostics.php:47 legacy/views/menu-diagnostics.php:50 -msgid "Purge Debug Log" -msgstr "Purge le log de débogage" +#: views/menu-defaults.php:228 views/menu-display.php:126 +#: views/menu-editor.php:33 views/menu-general.php:438 +msgid "Save Changes" +msgstr "Enregistrer les modifications" -#: legacy/views/menu-diagnostics.php:38 -msgid "Enable Debugging" -msgstr "Activer le débogage" +#: views/menu-diagnostics.php:5 +msgid "Advanced Diagnostics" +msgstr "Diagnostics avancés" + +#: views/menu-diagnostics.php:9 +msgid "Debug Logging" +msgstr "Journalisation de débogage" -#: legacy/views/menu-diagnostics.php:23 +#: views/menu-diagnostics.php:16 msgid "Disable Debugging" msgstr "Désactiver le débogage" -#: legacy/views/menu-diagnostics.php:12 -msgid "Advanced Diagnostics" -msgstr "Diagnostics avancés" +#: views/menu-diagnostics.php:23 views/tabs.php:32 +msgid "View Debug Logs" +msgstr "Voir les logs de déboguage" -#: legacy/classes/Display.class.php:189 -msgid "Debugging Table Emptied" -msgstr "Table de débogage vidée" +#: views/menu-diagnostics.php:29 +msgid "Enable Debugging" +msgstr "Activer le débogage" -#: legacy/classes/Display.class.php:181 -msgid "Debugging Enabled" -msgstr "Débogage activé" +#: views/menu-diagnostics.php:40 views/menu-diagnostics.php:43 +msgid "Purge Debug Log" +msgstr "Purge le log de débogage" -#: legacy/classes/Display.class.php:176 -msgid "Debugging Disabled" -msgstr "Débogage désactivé" +#: views/menu-diagnostics.php:48 +msgid "WP-Cron Status" +msgstr "État de WP-Cron" -#: legacy/views/taxonomy-field.php:10 -msgid "Select the hierarchical taxonomy to be used for \"category\" based expiration." -msgstr "Sélectionnez la taxonomie hiérarchique à utiliser pour l’expiration basée sur la catégorie." +#: views/menu-diagnostics.php:65 +msgid "Current Cron Schedule" +msgstr "Planification cron actuelle" -#: legacy/views/menu-defaults.php:139 -msgid "Taxonomy (hierarchical)" -msgstr "Taxonomie (hiérarchique)" +#: views/menu-diagnostics.php:73 +msgid "No cron events found for the plugin." +msgstr "Aucun évènement cron n’a été trouvé pour l’extension." -#: legacy/views/menu-defaults.php:112 -msgid "Auto-Enable?" -msgstr "Activer automatiquement" +#: views/menu-diagnostics.php:81 +#| msgid "" +#| "The below table will show all currently scheduled cron events for the " +#| "plugin with the next run time." +msgid "" +"The below table will show all currently scheduled cron events for the " +"pluginwith the next run time." +msgstr "" +"Le tableau ci-dessous affiche tous les événements cron actuellement " +"programmés pour l’extension avec la prochaine heure d’exécution." -#: legacy/views/menu-defaults.php:106 -msgid "Select the default action for the post type." -msgstr "Sélectionnez le mode d’expiration par défaut pour ce type de publication." +#: views/menu-diagnostics.php:92 +msgid "Event" +msgstr "Évènement" -#: legacy/views/menu-defaults.php:87 -msgid "Select whether the PublishPress Future meta box is active for this post type." -msgstr "Sélectionnez si la boîte méta d’expiration de la publication est active pour ce type de publication." +#: views/menu-diagnostics.php:94 +#| msgid "Current Cron Schedule" +msgid "Arguments / Schedule" +msgstr "Arguments / Programme" -#: legacy/views/menu-defaults.php:85 -msgid "Inactive" -msgstr "Inactif" +#: views/menu-diagnostics.php:96 +msgid "Post" +msgstr "Publication" -#: legacy/views/menu-defaults.php:69 legacy/views/menu-defaults.php:77 -msgid "Active" -msgstr "Actif" +#: views/menu-diagnostics.php:113 +msgid "No Arguments" +msgstr "Aucun argument" -#: legacy/views/menu-defaults.php:16 -msgid "Use the values below to set the default actions/values to be used for each for the corresponding post types. These values can all be overwritten when creating/editing the post/page." -msgstr "Utilisez les valeurs ci-dessous pour définir les actions/valeurs par défaut à utiliser pour chaque type de publication correspondant. Ces valeurs peuvent toutes être remplacées lors de la création/modification de la publication/page." +#: views/menu-diagnostics.php:126 +msgid "Single Event" +msgstr "Évènement unique" -#: legacy/views/menu-defaults.php:13 -msgid "Default Expiration Values" -msgstr "Valeurs d’expiration par défaut" +#: views/menu-display.php:27 +msgid "Shortcode" +msgstr "Code court" -#: legacy/views/menu-advanced.php:116 legacy/views/menu-defaults.php:217 -#: legacy/views/menu-display.php:132 legacy/views/menu-editor.php:37 -#: legacy/views/menu-general.php:223 -msgid "Save Changes" -msgstr "Enregistrer les modifications" +#: views/menu-display.php:29 +msgid "Valid %s attributes:" +msgstr "Attributs %s valides :" -#: legacy/views/menu-display.php:125 -msgid "The inline css which will be used to style the footer text." -msgstr "Les CSS en ligne qui seront utilisées pour styler le texte de pied de page." +#: views/menu-display.php:33 +msgid "" +"%1$s - valid options are %2$sfull%3$s (default), %4$sdate%5$s, %6$stime%7$s" +msgstr "" +"%1$s - les options valides sont %2$sfull%3$s (par défaut), %4$sdate%5$s, " +"%6$stime%7$s" -#: legacy/views/menu-display.php:122 -msgid "This post will expire on" -msgstr "Cette publication expirera le" +#: views/menu-display.php:47 views/menu-display.php:52 +msgid "%s - format set here will override the value set on the settings page" +msgstr "" +"%s - le format défini ici remplacera la valeur définie sur la page des " +"réglages." -#: legacy/views/menu-display.php:116 -msgid "Footer Style" -msgstr "Style du pied de page" +#: views/menu-display.php:60 views/menu-general.php:248 +msgid "Post Footer Display" +msgstr "Affichage dans le pied de page" + +#: views/menu-display.php:62 views/menu-general.php:250 +msgid "" +"Enabling this below will display the action date automatically at the end of " +"any post which is set to run an action." +msgstr "" +"L’activation de cette option affichera la date d’expiration automatiquement " +"à la fin de toute publication qui doit expirer." -#: legacy/views/menu-display.php:98 -msgid "Enter the text you would like to appear at the bottom of every post which has an action scheduled. The following placeholders will be replaced with the future action date in the following format:" -msgstr "Entrez le texte que vous souhaitez afficher au bas de chaque publication qui expirera. Les textes indicatifs ci-après seront remplacées par la date d’expiration dans le format indiqué :" +#: views/menu-display.php:69 views/menu-general.php:257 +msgid "Show in post footer?" +msgstr "Afficher dans le pied de page de la publication ?" + +#: views/menu-display.php:79 views/menu-general.php:271 +msgid "" +"This will enable or disable displaying the future action date in the post " +"footer." +msgstr "" +"Active ou désactive l’affichage de la date d’expiration de la publication " +"dans le pied de page." -#: legacy/views/menu-display.php:93 +#: views/menu-display.php:87 views/menu-general.php:280 msgid "Footer Contents" msgstr "Contenus du pied de page" -#: legacy/views/menu-display.php:85 -msgid "This will enable or disable displaying the future action date in the post footer." -msgstr "Active ou désactive l’affichage de la date d’expiration de la publication dans le pied de page." +#: views/menu-display.php:92 views/menu-general.php:287 +msgid "" +"Enter the text you would like to appear at the bottom of every post which " +"has an action scheduled. The following placeholders will be replaced with " +"the future action date in the following format:" +msgstr "" +"Entrez le texte que vous souhaitez afficher au bas de chaque publication qui " +"expirera. Les textes indicatifs ci-après seront remplacées par la date " +"d’expiration dans le format indiqué :" -#: legacy/views/menu-defaults.php:128 legacy/views/menu-diagnostics.php:35 -#: legacy/views/menu-diagnostics.php:62 legacy/views/menu-display.php:83 -#: legacy/views/menu-general.php:168 legacy/views/menu-general.php:194 -msgid "Disabled" -msgstr "Désactivé" +#: views/menu-display.php:110 views/menu-general.php:319 +msgid "Footer Style" +msgstr "Style du pied de page" -#: legacy/views/menu-defaults.php:120 legacy/views/menu-diagnostics.php:20 -#: legacy/views/menu-diagnostics.php:59 legacy/views/menu-display.php:78 -#: legacy/views/menu-general.php:161 legacy/views/menu-general.php:186 -msgid "Enabled" -msgstr "Activé" +#: views/menu-display.php:116 views/menu-general.php:326 +msgid "This post will expire on" +msgstr "Cette publication expirera le" -#: legacy/views/menu-display.php:73 -msgid "Show in post footer?" -msgstr "Afficher dans le pied de page de la publication ?" +#: views/menu-display.php:119 views/menu-general.php:332 +msgid "The inline css which will be used to style the footer text." +msgstr "" +"Les CSS en ligne qui seront utilisées pour styler le texte de pied de page." -#: legacy/views/menu-display.php:66 -msgid "Enabling this below will display the action date automatically at the end of any post which is set to run an action." -msgstr "L’activation de cette option affichera la date d’expiration automatiquement à la fin de toute publication qui doit expirer." +#: views/menu-editor.php:6 +msgid "Editor" +msgstr "Éditeur" -#: legacy/views/menu-display.php:64 -msgid "Post Footer Display" -msgstr "Affichage dans le pied de page" +#: views/menu-editor.php:13 views/menu-general.php:350 +msgid "Block Editor Support" +msgstr "Support de l’éditeur de blocs" -#: legacy/views/menu-general.php:139 -msgid "Sets the default expiration taxonomy for the post." -msgstr "Définissez la taxonomie d’expiration par défaut pour la publication" +#: views/menu-editor.php:17 views/menu-general.php:356 +msgid "Show Gutenberg style box" +msgstr "Afficher la boîte de style Gutenberg" -#: legacy/views/menu-general.php:120 -msgid "Default Expiration Taxonomy" -msgstr "Expiration de taxonomie par défaut" +#: views/menu-editor.php:21 views/menu-general.php:362 +msgid "Show Classic Editor style box" +msgstr "Afficher la boîte de style de l’éditeur classique" -#: legacy/views/menu-general.php:78 -msgid "Time Format" -msgstr "Format d’heure" +#: views/menu-editor.php:23 views/menu-general.php:364 +msgid "" +"Toggle between native support for the Block Editor or the backward " +"compatible Classic Editor style metabox." +msgstr "" +"Permuter entre la prise en charge native de l’éditeur de blocs et la boite " +"méta de l’éditeur classique, qui est rétrocompatible." + +#: views/menu-general.php:50 views/menu-general.php:56 +msgid "" +"The PublishPress Future plugin sets a custom meta value, and then optionally " +"allows you to select if you want the post changed to a draft status or " +"deleted when it expires." +msgstr "" +"L’extension PublishPress Future définit une valeur méta personnalisée, puis " +"vous permet de choisir si vous souhaitez que la publication passe à l’état " +"de brouillon ou soit supprimée lorsqu’elle expire." -#: legacy/views/menu-general.php:61 +#: views/menu-general.php:65 views/tabs.php:15 +msgid "Defaults" +msgstr "Défaut" + +#: views/menu-general.php:69 msgid "Date Format" msgstr "Format de date" -#: legacy/views/menu-display.php:51 legacy/views/menu-display.php:56 -msgid "%s - format set here will override the value set on the settings page" -msgstr "%s - le format défini ici remplacera la valeur définie sur la page des réglages." +#: views/menu-general.php:76 +msgid "" +"The default format to use when displaying the action date within a post " +"using the shortcode or within the footer. For information on valid " +"formatting options, see: %s." +msgstr "" +"Le format par défaut à utiliser lors de l’affichage de la date d’expiration " +"dans une publication à l’aide du code court ou dans le pied de page. Pour " +"plus d’informations sur les options de formatage valides, voir : %s." -#: legacy/classes/Display.class.php:278 legacy/classes/Display.class.php:341 -#: legacy/classes/Display.class.php:393 -msgid "Saved Options!" -msgstr "Options enregistrées !" +#: views/menu-general.php:86 +msgid "Time Format" +msgstr "Format d’heure" -#: legacy/views/menu-diagnostics.php:32 legacy/views/tabs.php:48 -msgid "View Debug Logs" -msgstr "Voir les logs de déboguage" +#: views/menu-general.php:93 +msgid "" +"The default format to use when displaying the action time within a post " +"using the shortcode or within the footer. For information on valid " +"formatting options, see: %s." +msgstr "" +"Le format par défaut à utiliser pour afficher le délai d’expiration dans une " +"publication à l’aide du code court ou dans le pied de page. Pour plus " +"d’informations sur les options de formatage valides, voir : %s." -#: legacy/views/tabs.php:41 -msgid "Diagnostics" -msgstr "Diagnostics" +#: views/menu-general.php:115 +msgid "Post/Page Publish Time" +msgstr "Heure de publication de la publication ou de la page" -#: legacy/views/menu-general.php:57 legacy/views/tabs.php:21 -msgid "Defaults" -msgstr "Défaut" +#: views/menu-general.php:118 +msgid "" +"Set the default expiration date to be used when creating new posts and " +"pages. Defaults to custom." +msgstr "" +"Définissez la date d’expiration par défaut à utiliser lors de la création de " +"nouvelles publications et pages. La valeur par défaut est « personnalisé »." -#: legacy/views/classic-metabox.php:167 -msgid "Taxonomy Name" -msgstr "Nom de la taxonomie" +#: views/menu-general.php:176 +msgid "Email Notification" +msgstr "Notification e-mail de l’expiration" -#: legacy/views/classic-metabox.php:149 -msgid "More than 1 heirachical taxonomy detected. You must assign a default taxonomy on the settings screen." -msgstr "Plus de 1 taxonomie de hiérarchie détectée. Vous devez attribuer une taxonomie par défaut sur l’écran des paramètres." +#: views/menu-general.php:178 +msgid "Whenever an action runs, an email can be sent to alert users." +msgstr "" +"Dès qu’un contenu arrive à expiration, un e-mail peut être envoyé pour " +"informer les utilisateurs de l’expiration." -#: legacy/views/classic-metabox.php:144 -msgid "You must assign a hierarchical taxonomy to this post type to use this feature." -msgstr "Vous devez assigner une taxonomie hiérarchique à ce type de publication pour utiliser cette fonctionnalité." +#: views/menu-general.php:185 +msgid "Enable Email Notification?" +msgstr "Activer la notification par e-mail ?" -#: legacy/classes/Facade.class.php:383 legacy/views/bulk-edit.php:111 -#: legacy/views/classic-metabox.php:117 legacy/views/menu-defaults.php:96 -#: legacy/views/quick-edit.php:76 -msgid "Action" -msgstr "Mode d’expiration" +#: views/menu-general.php:199 +msgid "" +"This will enable or disable the send of email notification on future action." +msgstr "" +"Cela activera ou désactivera l’envoi d’une notification par e-mail au moment " +"de l’expiration d’un contenu." -#: legacy/views/bulk-edit.php:97 legacy/views/classic-metabox.php:110 -#: legacy/views/quick-edit.php:63 -msgid "Minute" -msgstr "Minute" +#: views/menu-general.php:207 +msgid "Include Blog Administrators?" +msgstr "Inclure les Admins ?" -#: legacy/views/bulk-edit.php:90 legacy/views/classic-metabox.php:85 -#: legacy/views/quick-edit.php:57 -msgid "Hour" -msgstr "Heure" +#: views/menu-general.php:223 +msgid "" +"This will include all users with the role of \"Administrator\" in the email." +msgstr "" +"Inclus tous les utilisateurs avec le rôle « Administrateur » dans l’e-mail " +"informant de l’expiration d’un contenu." -#: legacy/views/bulk-edit.php:76 legacy/views/classic-metabox.php:78 -#: legacy/views/quick-edit.php:43 -msgid "Day" -msgstr "Jour" +#: views/menu-general.php:239 +msgid "" +"Enter a comma separate list of emails that you would like to be notified " +"when the action runs. This will be applied to ALL post types. You can set " +"post type specific emails on the Defaults tab." +msgstr "" +"Saisissez une liste d’e-mails (séparés par des virgules) que vous voulez " +"notifier quand la publication arrive à expiration. Cela s’appliquera à TOUS " +"les types de contenu. Vous pouvez définir des e-mails spécifiques en " +"fonction du type de contenu dans l’onglet Par défaut." -#: legacy/views/bulk-edit.php:52 legacy/views/classic-metabox.php:56 -#: legacy/views/quick-edit.php:21 -msgid "Month" -msgstr "Mois" +#: views/menu-general.php:338 +msgid "Advanced Options" +msgstr "Options avancées" -#: legacy/views/bulk-edit.php:83 legacy/views/classic-metabox.php:27 -#: legacy/views/quick-edit.php:50 -msgid "Year" -msgstr "Année" +#: views/menu-general.php:340 +msgid "" +"Please do not update anything here unless you know what it entails. For " +"advanced users only." +msgstr "" +"Veuillez ne rien mettre à jour ici si vous ne savez pas ce que cela " +"implique. Pour les utilisateurs/utilisatrices avancés uniquement." -#: legacy/views/classic-metabox.php:18 -msgid "The published date/time will be used as the expiration value" -msgstr "La date/heure publiée sera utilisée comme valeur d’expiration" +#: views/menu-general.php:373 +msgid "Choose which user roles can use PublishPress Future" +msgstr "Choisir les rôles pouvant utiliser PublishPress Future" -#: legacy/classes/Facade.class.php:382 legacy/views/bulk-edit.php:26 -#: legacy/views/classic-metabox.php:11 legacy/views/quick-edit.php:12 -msgid "Enable Future Action" -msgstr "Autoriser l’expiration de vos contenus" +#: views/menu-general.php:404 +msgid "Preserve data after deactivating the plugin" +msgstr "Conserver les données après la désactivation de l’extension" -#: legacy/views/expire-column.php:24 -msgid "Never" -msgstr "Jamais" +#: views/menu-general.php:413 +msgid "Preserve data" +msgstr "Conserver les données" -#: legacy/functions.php:77 legacy/functions.php:167 -msgid "Future action" -msgstr "Future action" +#: views/menu-general.php:422 +msgid "Delete data" +msgstr "Supprimer les données" -#: legacy/functions.php:24 -msgid "Settings" -msgstr "Réglages" +#: views/menu-general.php:426 +msgid "" +"Toggle between preserving or deleting data after the plugin is deactivated." +msgstr "" +"Permutez entre la conservation ou la suppression des données après la " +"désactivation de l’extension." -#: services.php:48 -msgid "Post expires at EXPIRATIONTIME on ACTIONDATE" -msgstr "La publication expire à EXPIRATIONTIME le ACTIONDATE" +#: views/tabs.php:20 +msgid "Post Types" +msgstr "Type de publications" -#: services.php:47 -msgid "g:ia" -msgstr "g\\hia" +#: views/tabs.php:25 +msgid "Diagnostics" +msgstr "Diagnostics" -#: services.php:46 -msgid "l F jS, Y" -msgstr "I j F Y" +#~ msgid "Post has been removed from stickies list." +#~ msgstr "La publication a été supprimée de la liste des épinglés." -#: legacy/classes/Display.class.php:219 -msgid "Message" -msgstr "Message" +#~ msgid "Post has been added to stickies list." +#~ msgstr "La publication a été ajoutée à la liste des épinglés." -#: legacy/classes/Display.class.php:218 -msgid "Timestamp" -msgstr "Horodatage" +#~ msgid "" +#~ "The following terms (%s) were set to the post: \"%s\". The old list of " +#~ "terms on the post was: %s." +#~ msgstr "" +#~ "Les termes suivants (%s) ont été définis pour la publication : « %s ». " +#~ "L’ancienne liste de termes de la publication était : %s." -#: legacy/classes/Display.class.php:211 -msgid "Debugging table is currently empty." -msgstr "La table de débogage est actuellement vide." +#~ msgid "" +#~ "The following terms (%s) were removed from the post: \"%s\". The new list " +#~ "of terms on the post is: %s." +#~ msgstr "" +#~ "Les termes suivants (%s) ont été supprimés de la publication : « %s ». La " +#~ "nouvelle liste de termes de la publication est : %s." + +#~ msgid "Post has been successfully deleted." +#~ msgstr "La publication a bien été supprimée." + +#~ msgid "Taxonomy" +#~ msgstr "Taxonomie" + +#~ msgid "Posts and expiration settings" +#~ msgstr "Réglages des publications et de l’expiration" + +#~ msgid "Cron event not found!" +#~ msgstr "L’évènement cron n’a pas été trouvé !" + +#~ msgid "Cron event scheduled." +#~ msgstr "L’évènement cron a été planifié." + +#~ msgid "You do not have permission to configure PublishPress Future." +#~ msgstr "" +#~ "Vous n’avez pas les droits nécessaires pour configurer PublishPress " +#~ "Future." + +#~ msgid "Advanced" +#~ msgstr "Avancé" + +#~ msgid "Display" +#~ msgstr "Afficher" + +#~ msgid "Future" +#~ msgstr "Future" + +#~ msgid "[%1$s] %2$s" +#~ msgstr "[%1$s] %2$s" + +#~ msgid "Default Expiration Taxonomy" +#~ msgstr "Expiration de taxonomie par défaut" diff --git a/languages/post-expirator.pot b/languages/post-expirator.pot index a7917f413..e1d514017 100644 --- a/languages/post-expirator.pot +++ b/languages/post-expirator.pot @@ -2,21 +2,21 @@ # This file is distributed under the same license as the PublishPress Future plugin. msgid "" msgstr "" -"Project-Id-Version: PublishPress Future 3.0.3\n" +"Project-Id-Version: PublishPress Future 3.0.4\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/project\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-06-20T20:58:05+00:00\n" +"POT-Creation-Date: 2023-07-04T19:41:08+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: post-expirator\n" #. Plugin Name of the plugin -#: legacy/classes/Facade.class.php:365 -#: legacy/functions.php:360 +#: legacy/classes/Facade.class.php:400 +#: legacy/functions.php:337 #: src/Modules/Expirator/Controllers/ScheduledActionsController.php:80 #: src/Views/tabs.php:60 msgid "PublishPress Future" @@ -87,18 +87,18 @@ msgstr "" msgid "Contact" msgstr "" -#: legacy/classes/Facade.class.php:364 +#: legacy/classes/Facade.class.php:399 msgid "Taxonomy" msgstr "" -#: legacy/classes/Facade.class.php:366 +#: legacy/classes/Facade.class.php:401 #: src/Views/bulk-edit.php:36 #: src/Views/classic-metabox.php:11 #: src/Views/quick-edit.php:16 msgid "Enable Future Action" msgstr "" -#: legacy/classes/Facade.class.php:367 +#: legacy/classes/Facade.class.php:402 #: src/Modules/Expirator/Tables/ScheduledActionsTable.php:38 #: src/Modules/Settings/Controllers/Controller.php:223 #: src/Views/bulk-edit.php:129 @@ -109,27 +109,32 @@ msgstr "" msgid "Action" msgstr "" -#: legacy/classes/Facade.class.php:368 +#: legacy/classes/Facade.class.php:403 msgid "Loading" msgstr "" -#: legacy/classes/Facade.class.php:369 +#: legacy/classes/Facade.class.php:404 #: src/Views/bulk-edit.php:148 #: src/Views/quick-edit.php:100 msgid "Terms" msgstr "" +#: legacy/classes/Facade.class.php:405 +#: src/Views/classic-metabox.php:138 +msgid "You must assign a hierarchical taxonomy to this post type to use this feature." +msgstr "" + #: legacy/functions.php:32 #: src/Modules/Expirator/Controllers/ScheduledActionsController.php:103 msgid "Settings" msgstr "" -#: legacy/functions.php:85 +#: legacy/functions.php:62 #: src/Views/bulk-edit.php:30 msgid "Future Action" msgstr "" -#: legacy/functions.php:1232 +#: legacy/functions.php:1209 #: src/Modules/Settings/Controllers/Controller.php:236 msgid "No taxonomies found" msgstr "" @@ -255,27 +260,27 @@ msgstr "" msgid "Unstick" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:420 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:435 msgid "Email is disabled" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:424 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:439 msgid "Email sent" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:424 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:439 msgid "Email not sent" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:495 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:510 msgid "%s. %s on %s. The post link is %s" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:512 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:527 msgid "Future Action Complete \"%s\"" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:515 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:530 msgid "[%1$s] %2$s" msgstr "" @@ -556,10 +561,6 @@ msgstr "" msgid "The published date/time will be used as the expiration value" msgstr "" -#: src/Views/classic-metabox.php:138 -msgid "You must assign a hierarchical taxonomy to this post type to use this feature." -msgstr "" - #: src/Views/classic-metabox.php:143 msgid "More than 1 hierarchical taxonomy detected. You must assign a default taxonomy on the settings screen." msgstr "" diff --git a/legacy/classes/Facade.class.php b/legacy/classes/Facade.class.php index bf137ab54..4a1689c1d 100644 --- a/legacy/classes/Facade.class.php +++ b/legacy/classes/Facade.class.php @@ -271,6 +271,24 @@ public function register_rest_api() ], ] ]); + + register_rest_route( $apiNamespace, '/taxonomies/(?P[a-z\-_0-9A-Z]+)', [ + 'methods' => 'GET', + 'callback' => [$this, 'api_get_post_type_taxonomies'], + 'permission_callback' => function () { + return current_user_can(CapabilitiesAbstract::EXPIRE_POST); + }, + 'args' => [ + 'postType' => [ + 'validate_callback' => function ($param, $request, $key) { + return sanitize_key($param); + }, + 'sanitize_callback' => 'sanitize_key', + 'required' => true, + 'type' => 'string', + ], + ] + ]); } public function api_get_expiration_data(WP_REST_Request $request) @@ -309,6 +327,21 @@ public function api_save_expiration_data(WP_REST_Request $request) return rest_ensure_response(true); } + public function api_get_post_type_taxonomies(WP_REST_Request $request) + { + $postType = $request->get_param('postType'); + + $taxonomies = get_object_taxonomies($postType, 'objects'); + $taxonomies = array_map(function ($taxonomy) { + return [ + 'name' => $taxonomy->name, + 'label' => $taxonomy->label, + ]; + }, $taxonomies); + + return rest_ensure_response(['taxonomies' => $taxonomies]); + } + /** * Load the block's backend assets only if the meta box is active for this post type. */ @@ -324,18 +357,21 @@ public function block_editor_assets() $settingsFacade = $container->get(ServicesAbstract::SETTINGS); $actionsModel = $container->get(ServicesAbstract::EXPIRATION_ACTIONS_MODEL); - $defaults = $settingsFacade->getPostTypeDefaults($post->post_type); + $postTypeDefaultConfig = $settingsFacade->getPostTypeDefaults($post->post_type); // if settings are not configured, show the metabox by default only for posts and pages if ( - (! isset($defaults['activeMetaBox']) && in_array( + (! isset($postTypeDefaultConfig['activeMetaBox']) + && in_array( $post->post_type, [ 'post', 'page', ], true - )) || $defaults['activeMetaBox'] === 'active' + ) + ) + || $postTypeDefaultConfig['activeMetaBox'] === 'active' ) { wp_enqueue_script( 'postexpirator-gutenberg-panel', @@ -348,25 +384,25 @@ public function block_editor_assets() $defaultDataModel = $container->get(ServicesAbstract::DEFAULT_DATA_MODEL); $debug = $container->get(ServicesAbstract::DEBUG); - $default_expiry = $defaultDataModel->getDefaultExpirationDateForPostType($post->post_type); + $defaultExpirationDate = $defaultDataModel->getDefaultExpirationDateForPostType($post->post_type); wp_localize_script( 'postexpirator-gutenberg-panel', 'postExpiratorPanelConfig', [ - 'defaults' => $defaults, - 'default_date' => $default_expiry['ts'], - 'default_categories' => get_option('expirationdateCategoryDefaults'), - 'is_12_hours' => get_option('time_format') !== 'H:i', - 'timezone_offset' => PostExpirator_Util::get_timezone_offset() / 60, - 'actions_options' => $actionsModel->getActionsAsOptions($post->post_type), - 'is_debug_enabled' => $debug->isEnabled(), + 'postTypeDefaultConfig' => $postTypeDefaultConfig, + 'defaultDate' => $defaultExpirationDate['ts'], + 'is12hours' => get_option('time_format') !== 'H:i', + 'startOfWeek' => get_option('start_of_week', 0), + 'actionsSelectOptions' => $actionsModel->getActionsAsOptions($post->post_type), + 'isDebugEnabled' => $debug->isEnabled(), 'strings' => [ 'category' => __('Taxonomy', 'post-expirator'), - 'postExpirator' => __('PublishPress Future', 'post-expirator'), + 'panelTitle' => __('PublishPress Future', 'post-expirator'), 'enablePostExpiration' => __('Enable Future Action', 'post-expirator'), - 'howToExpire' => __('Action', 'post-expirator'), + 'action' => __('Action', 'post-expirator'), 'loading' => __('Loading', 'post-expirator'), - 'expirationCategories' => __('Terms', 'post-expirator'), + 'terms' => __('Terms', 'post-expirator'), + 'noTermsFound' => __('You must assign a hierarchical taxonomy to this post type to use this feature.', 'post-expirator'), ] ] ); diff --git a/legacy/functions.php b/legacy/functions.php index cb37fd139..dcfce9d3e 100644 --- a/legacy/functions.php +++ b/legacy/functions.php @@ -37,29 +37,6 @@ function postexpirator_plugin_action_links($links, $file) add_filter('plugin_action_links', 'postexpirator_plugin_action_links', 10, 2); -/** - * Load translation, if it exists. - * - * @internal - * - * @access private - */ -function postexpirator_init() -{ - $container = Container::getInstance(); - $plugin_dir = basename($container->get(ServicesAbstract::BASE_PATH)); - load_plugin_textdomain('post-expirator', null, $plugin_dir . '/languages/'); - - PostExpirator_Reviews::init(); - - if (class_exists('WP_CLI')) { - PostExpirator_Cli::getInstance(); - } - - add_action('wp_insert_post', 'postexpirator_set_default_meta_for_post', 10, 3); -} - -add_action('plugins_loaded', 'postexpirator_init'); /** * Adds an 'Future action' column to the post display table. @@ -470,7 +447,7 @@ function postexpirator_set_default_meta_for_post($postId, $post, $update) 'enabled' => true, ]; - do_action(ExpiratorHooks::ACTION_SCHEDULE_POST_EXPIRATION, $postId, $defaultExpire['ts'], $opts); + do_action(ExpiratorHooks::ACTION_SCHEDULE_POST_EXPIRATION, $postId, $defaultExpire['ts'], $opts); } /** diff --git a/post-expirator.php b/post-expirator.php index 892c65bd5..56b1960cd 100644 --- a/post-expirator.php +++ b/post-expirator.php @@ -4,7 +4,7 @@ * Plugin URI: http://wordpress.org/extend/plugins/post-expirator/ * Description: PublishPress Future allows you to schedule automatic changes to posts, pages and other content types. * Author: PublishPress - * Version: 3.0.3 + * Version: 3.0.4 * Author URI: http://publishpress.com * Text Domain: post-expirator * Domain Path: /languages @@ -27,7 +27,7 @@ define('PUBLISHPRESS_FUTURE_LOADED', true); if (! defined('PUBLISHPRESS_FUTURE_VERSION')) { - define('PUBLISHPRESS_FUTURE_VERSION', '3.0.3'); + define('PUBLISHPRESS_FUTURE_VERSION', '3.0.4'); } $vendorAutoloadPath = __DIR__ . '/vendor/autoload.php'; diff --git a/readme.txt b/readme.txt index 0373bc578..b74873090 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Tags: expire posts, update posts, schedule changes, automatic changes, Requires at least: 5.3 Requires PHP: 5.6 Tested up to: 6.2 -Stable tag: 3.0.3 +Stable tag: 3.0.4 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. @@ -140,6 +140,20 @@ Yes, the PublishPress Future plugin allows you to schedule automatic changes to == Changelog == += [3.0.4] - [04 Jul, 2023] = + +* FIXED: Fix "Save changes" notification on block editor when post is not edited, #449; +* FIXED: Fix unchecked category on classic editor when editing a post with future action enabled, #481; +* FIXED: Update French translation, #473; +* FIXED: Fix the plugin initialization to properly load the plugin text domain, and CLI commands; +* FIXED: Fix the start of the week on the calendar, honoring the site setting, #484; +* FIXED: Fix the taxonomy field for custom post types; +* FIXED: Fix consistency in the message in the block editor, compared to classic editor, when no taxonomy is selected; +* FIXED: Update the .pot file; +* CHANGED: The name of the block editor component changed from `postexpirator-sidebar` to `publishpress-future-action`, #449; +* CHANGED: Update the Action Scheduler library from 3.6.0 to 3.6.1; +* REMOVED: Remove internal function `postexpirator_init`; + = [3.0.3] - [20 Jun, 2023] = * FIXED: Error on the block editor: The "postexpirator-sidebar" plugin has encountered an error and cannot be rendered, #475; diff --git a/services.php b/services.php index 83acfbad9..bcba9dbd2 100644 --- a/services.php +++ b/services.php @@ -324,7 +324,8 @@ $container->get(ServicesAbstract::CURRENT_USER_MODEL_FACTORY), $container->get(ServicesAbstract::REQUEST), $container->get(ServicesAbstract::ACTION_ARGS_MODEL_FACTORY), - $container->get(ServicesAbstract::SCHEDULED_ACTIONS_TABLE_FACTORY) + $container->get(ServicesAbstract::SCHEDULED_ACTIONS_TABLE_FACTORY), + $container->get(ServicesAbstract::POST_TYPE_SETTINGS_MODEL_FACTORY) ); }, diff --git a/src/Core/HooksAbstract.php b/src/Core/HooksAbstract.php index 5b33863c7..c5d0b495e 100644 --- a/src/Core/HooksAbstract.php +++ b/src/Core/HooksAbstract.php @@ -17,4 +17,5 @@ abstract class HooksAbstract const ACTION_DEACTIVATE_PLUGIN = 'publishpressfuture_deactivate_plugin'; const ACTION_ADMIN_ENQUEUE_SCRIPT= 'admin_enqueue_scripts'; const FILTER_MODULES_LIST = 'publishpressfuture_list_modules'; + const ACTION_INSERT_POST = 'wp_insert_post'; } diff --git a/src/Core/Plugin.php b/src/Core/Plugin.php index d2359cdab..16e5f93b5 100644 --- a/src/Core/Plugin.php +++ b/src/Core/Plugin.php @@ -71,6 +71,16 @@ public function initialize() $this->initialized = true; + $pluginDir = basename($this->basePath); + load_plugin_textdomain('post-expirator', null, $pluginDir . '/languages/'); + + \PostExpirator_Reviews::init(); + + if (class_exists('WP_CLI')) { + \PostExpirator_Cli::getInstance(); + } + + $this->hooks->addAction(HooksAbstract::ACTION_INSERT_POST, 'postexpirator_set_default_meta_for_post', 10, 3); $this->hooks->doAction(HooksAbstract::ACTION_INIT_PLUGIN); $pluginFile = $this->basePath . '/' . $this->pluginSlug . '.php'; diff --git a/src/Modules/Expirator/Controllers/ExpirationController.php b/src/Modules/Expirator/Controllers/ExpirationController.php index f5cd18db4..040adfadb 100644 --- a/src/Modules/Expirator/Controllers/ExpirationController.php +++ b/src/Modules/Expirator/Controllers/ExpirationController.php @@ -11,12 +11,14 @@ use PublishPress\Future\Framework\InitializableInterface; use PublishPress\Future\Framework\WordPress\Facade\SiteFacade; use PublishPress\Future\Modules\Expirator\Adapters\CronToWooActionSchedulerAdapter; +use PublishPress\Future\Modules\Expirator\CapabilitiesAbstract; use PublishPress\Future\Modules\Expirator\HooksAbstract; use PublishPress\Future\Modules\Expirator\Interfaces\CronInterface; use PublishPress\Future\Modules\Expirator\Interfaces\SchedulerInterface; use PublishPress\Future\Modules\Expirator\Models\ExpirablePostModel; use PublishPress\Future\Modules\Expirator\Schemas\ActionArgsSchema; use PublishPress\Future\Modules\Settings\HooksAbstract as SettingsHooksAbstract; +use PublishPress\Future\Modules\Settings\SettingsFacade; defined('ABSPATH') or die('Direct access not allowed.'); @@ -47,25 +49,33 @@ class ExpirationController implements InitializableInterface */ private $expirablePostModelFactory; + /** + * @var \Closure + */ + private $settingsModelFactory; + /** * @param HookableInterface $hooksFacade * @param SiteFacade $siteFacade * @param CronInterface $cron * @param SchedulerInterface $scheduler * @param Closure $expirablePostModelFactory + * @param Closure $settingsModelFactory */ public function __construct( HookableInterface $hooksFacade, SiteFacade $siteFacade, CronInterface $cron, SchedulerInterface $scheduler, - Closure $expirablePostModelFactory + Closure $expirablePostModelFactory, + Closure $settingsModelFactory ) { $this->hooks = $hooksFacade; $this->site = $siteFacade; $this->cron = $cron; $this->scheduler = $scheduler; $this->expirablePostModelFactory = $expirablePostModelFactory; + $this->settingsModelFactory = $settingsModelFactory; } public function initialize() @@ -96,14 +106,10 @@ public function initialize() HooksAbstract::ACTION_LEGACY_EXPIRE_POST1, [$this, 'onActionRunPostExpiration'] ); - } - - public function onActionDeleteAllSettings() - { - $this->cron->clearScheduledAction(HooksAbstract::ACTION_LEGACY_DELETE); - - $this->cron->cancelActionsByGroup(CronToWooActionSchedulerAdapter::SCHEDULED_ACTION_GROUP); - + $this->hooks->addAction( + HooksAbstract::ACTION_REST_API_INIT, + [$this, 'handleRestAPIInit'] + ); } public function onActionSchedulePostExpiration($postId, $timestamp, $opts) @@ -131,4 +137,70 @@ public function onActionRunPostExpiration($postId, $force = false) $postModel->expire($force); } + + public function handleRestAPIInit() + { + $factory = $this->settingsModelFactory; + $settingsModel = $factory(); + $settings = $settingsModel->getPostTypesSettings(); + + $activePostTypes = array_filter($settings, function ($postTypeSettings) { + return $postTypeSettings['active']; + }); + $activePostTypes = array_keys($activePostTypes); + + foreach ($activePostTypes as $postType) { + register_rest_field( + $postType, + 'publishpress_future_action', + [ + 'get_callback' => function ($post) { + $postModelFactory = $this->expirablePostModelFactory; + $postModel = $postModelFactory($post['id']); + + $isEnabled = $postModel->isExpirationEnabled(); + + if ('auto-draft' === $post['status'] && ! $isEnabled) { + return [ + 'enabled' => false, + 'date' => 0, + 'action' => '', + 'terms' => [], + 'taxonomy' => '' + ]; + } + + return [ + 'enabled' => $postModel->isExpirationEnabled(), + 'date' => $postModel->getExpirationDate(), + 'action' => $postModel->getExpirationType(), + 'terms' => $postModel->getExpirationCategoryIDs(), + 'taxonomy' => $postModel->getExpirationTaxonomy(), + ]; + }, + 'update_callback' => function ($value, $post) { + if (isset($value['enabled']) && (bool)$value['enabled']) { + $opts = [ + 'expireType' => $value['action'], + 'category' => $value['terms'], + 'categoryTaxonomy' => $value['taxonomy'], + 'enabled' => true, + ]; + + do_action(HooksAbstract::ACTION_SCHEDULE_POST_EXPIRATION, $post->ID, $value['date'], $opts); + return true; + } + + do_action(HooksAbstract::ACTION_UNSCHEDULE_POST_EXPIRATION, $post->ID); + + return true; + }, + 'schema' => [ + 'description' => 'Future action', + 'type' => 'object', + ] + ] + ); + } + } } diff --git a/src/Modules/Expirator/HooksAbstract.php b/src/Modules/Expirator/HooksAbstract.php index 48c8de9bd..e4011c99b 100644 --- a/src/Modules/Expirator/HooksAbstract.php +++ b/src/Modules/Expirator/HooksAbstract.php @@ -9,8 +9,10 @@ abstract class HooksAbstract { + const ACTION_INIT = 'init'; const ACTION_ADMIN_INIT = 'admin_init'; const ACTION_ADMIN_MENU = 'admin_menu'; + const ACTION_REST_API_INIT = 'rest_api_init'; const ACTION_LEGACY_SCHEDULE = 'postexpirator_schedule'; const ACTION_LEGACY_UNSCHEDULE = 'postexpirator_unschedule'; const ACTION_LEGACY_EXPIRE_POST1 = 'postExpiratorExpire'; diff --git a/src/Modules/Expirator/Models/ExpirablePostModel.php b/src/Modules/Expirator/Models/ExpirablePostModel.php index 577faab21..dfc8fb156 100644 --- a/src/Modules/Expirator/Models/ExpirablePostModel.php +++ b/src/Modules/Expirator/Models/ExpirablePostModel.php @@ -223,6 +223,21 @@ public function getExpirationType() public function getExpirationCategoryIDs() { if (empty($this->expirationCategories)) { + $postType = $this->getPostType(); + + try { + if ($this->getPostStatus() === 'auto-draft') { + $settings = $this->settings->getPostTypeDefaults($this->getPostType()); + + if (! empty($settings['terms'])) { + $this->expirationCategories = $settings['terms']; + + return explode(',', $this->expirationCategories); + } + } + } catch (NonexistentPostException $e) { + } + $options = $this->getExpirationOptions(); $this->expirationCategories = isset($options['category']) ? $options['category'] : []; diff --git a/src/Modules/Expirator/Module.php b/src/Modules/Expirator/Module.php index dfa4b0081..9face0095 100644 --- a/src/Modules/Expirator/Module.php +++ b/src/Modules/Expirator/Module.php @@ -76,6 +76,11 @@ class Module implements ModuleInterface */ private $scheduledActionsTableFactory; + /** + * @var \Closure + */ + private $settingsModelFactory; + public function __construct( $hooks, $site, @@ -86,7 +91,8 @@ public function __construct( $currentUserModelFactory, $request, \Closure $actionArgsModelFactory, - \Closure $scheduledActionsTableFactory + \Closure $scheduledActionsTableFactory, + \Closure $settingsModelFactory ) { $this->hooks = $hooks; $this->site = $site; @@ -98,6 +104,7 @@ public function __construct( $this->request = $request; $this->actionArgsModelFactory = $actionArgsModelFactory; $this->scheduledActionsTableFactory = $scheduledActionsTableFactory; + $this->settingsModelFactory = $settingsModelFactory; $this->controllers['expiration'] = $this->factoryExpirationController(); $this->controllers['bulk_edit'] = $this->factoryBulkEditController(); @@ -122,7 +129,8 @@ private function factoryExpirationController() $this->site, $this->cron, $this->scheduler, - $this->expirablePostModelFactory + $this->expirablePostModelFactory, + $this->settingsModelFactory ); } diff --git a/src/Modules/Settings/SettingsFacade.php b/src/Modules/Settings/SettingsFacade.php index afe00bfaa..5983aea99 100644 --- a/src/Modules/Settings/SettingsFacade.php +++ b/src/Modules/Settings/SettingsFacade.php @@ -153,6 +153,10 @@ public function getPostTypeDefaults($postType) (array)$this->options->getOption('expirationdateDefaults' . ucfirst($postType)) ); + if (empty($defaults['expireType'])) { + $defaults['expireType'] = 'draft'; + } + if ($defaults['default-expire-type'] === 'null' || empty($defaults['default-expire-type'])) { $defaults['default-expire-type'] = 'inherit'; } diff --git a/src/Views/classic-metabox.php b/src/Views/classic-metabox.php index 74d2be96c..eb0ceb12e 100644 --- a/src/Views/classic-metabox.php +++ b/src/Views/classic-metabox.php @@ -166,7 +166,10 @@ echo '
    '; - $categories = []; + if (! is_array($categories) || empty($categories)) { + $categories = []; + } + if (empty($categories) && isset($defaultsOption['terms'])) { $categories = explode(',', $defaultsOption['terms']); $categories = array_map('intval', $categories);