diff --git a/.wordpress-org/icon-128x128.png b/.wordpress-org/icon-128x128.png index fa769bd9c..5d56283b1 100644 Binary files a/.wordpress-org/icon-128x128.png and b/.wordpress-org/icon-128x128.png differ diff --git a/.wordpress-org/icon-256x256.png b/.wordpress-org/icon-256x256.png new file mode 100644 index 000000000..eaf0c0d68 Binary files /dev/null and b/.wordpress-org/icon-256x256.png differ diff --git a/assets/css/edit.css b/assets/css/edit.css index 0a21f2a40..102a2a609 100644 --- a/assets/css/edit.css +++ b/assets/css/edit.css @@ -35,10 +35,6 @@ div.pe-qe-fields > div { color: #e08f63; } -.post-expire-col .dashicons { - cursor: help; -} - .pe-qe-fields input.invalid { border: 2px solid #b15b5b; background-color: #ffdede; diff --git a/assets/images/publishpress-future-256.png b/assets/images/publishpress-future-256.png index bab86f4f9..eaf0c0d68 100644 Binary files a/assets/images/publishpress-future-256.png and b/assets/images/publishpress-future-256.png differ diff --git a/composer.lock b/composer.lock index 6d774b1b0..ef90e7c05 100644 --- a/composer.lock +++ b/composer.lock @@ -9,16 +9,16 @@ "packages-dev": [ { "name": "antecedent/patchwork", - "version": "2.1.25", + "version": "2.1.26", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "17314e042d45e0dacb0a494c2d1ef50e7621136a" + "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/17314e042d45e0dacb0a494c2d1ef50e7621136a", - "reference": "17314e042d45e0dacb0a494c2d1ef50e7621136a", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/f2dae0851b2eae4c51969af740fdd0356d7f8f55", + "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55", "shasum": "" }, "require": { @@ -51,9 +51,9 @@ ], "support": { "issues": "https://github.com/antecedent/patchwork/issues", - "source": "https://github.com/antecedent/patchwork/tree/2.1.25" + "source": "https://github.com/antecedent/patchwork/tree/2.1.26" }, - "time": "2023-02-19T12:51:24+00:00" + "time": "2023-09-18T08:18:37+00:00" }, { "name": "automattic/vipwpcs", @@ -1123,16 +1123,16 @@ }, { "name": "composer/pcre", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", "shasum": "" }, "require": { @@ -1174,7 +1174,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.0" + "source": "https://github.com/composer/pcre/tree/3.1.1" }, "funding": [ { @@ -1190,7 +1190,7 @@ "type": "tidelift" } ], - "time": "2022-11-17T09:50:14+00:00" + "time": "2023-10-11T07:11:09+00:00" }, { "name": "composer/semver", @@ -1678,16 +1678,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.25.1", + "version": "v3.34.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "8e21d69801de6b5ecb0dbe0bcdf967b335b1260b" + "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/8e21d69801de6b5ecb0dbe0bcdf967b335b1260b", - "reference": "8e21d69801de6b5ecb0dbe0bcdf967b335b1260b", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3", + "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3", "shasum": "" }, "require": { @@ -1761,7 +1761,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.25.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.1" }, "funding": [ { @@ -1769,7 +1769,7 @@ "type": "github" } ], - "time": "2023-09-04T01:22:52+00:00" + "time": "2023-10-03T23:51:05+00:00" }, { "name": "gettext/gettext", @@ -2253,7 +2253,7 @@ }, { "name": "illuminate/collections", - "version": "v9.52.15", + "version": "v9.52.16", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", @@ -2308,7 +2308,7 @@ }, { "name": "illuminate/conditionable", - "version": "v9.52.15", + "version": "v9.52.16", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -2354,7 +2354,7 @@ }, { "name": "illuminate/contracts", - "version": "v9.52.15", + "version": "v9.52.16", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2402,7 +2402,7 @@ }, { "name": "illuminate/macroable", - "version": "v9.52.15", + "version": "v9.52.16", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -2448,7 +2448,7 @@ }, { "name": "illuminate/support", - "version": "v9.52.15", + "version": "v9.52.16", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", @@ -2519,16 +2519,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "5.2.12", + "version": "v5.2.13", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60" + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", - "reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", "shasum": "" }, "require": { @@ -2583,28 +2583,35 @@ ], "support": { "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/5.2.12" + "source": "https://github.com/justinrainbow/json-schema/tree/v5.2.13" }, - "time": "2022-04-13T08:02:27+00:00" + "time": "2023-09-26T02:20:38+00:00" }, { "name": "lucatume/wp-browser", - "version": "3.1.10", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/lucatume/wp-browser.git", - "reference": "d591a12891305b29ff0e1e08e2a173e6f915abf4" + "reference": "95a189fda634fd52cb44eebbbda3fabe0fdabdb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/d591a12891305b29ff0e1e08e2a173e6f915abf4", - "reference": "d591a12891305b29ff0e1e08e2a173e6f915abf4", + "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/95a189fda634fd52cb44eebbbda3fabe0fdabdb2", + "reference": "95a189fda634fd52cb44eebbbda3fabe0fdabdb2", "shasum": "" }, "require": { "antecedent/patchwork": "^2.0", "bordoni/phpass": "^0.3", - "codeception/codeception": "^2.5 || ^3.0 || ^4.0", + "codeception/codeception": "^4", + "codeception/module-asserts": "^1.0", + "codeception/module-cli": "^1.0", + "codeception/module-db": "^1.0", + "codeception/module-filesystem": "^1.0", + "codeception/module-phpbrowser": "^1.0", + "codeception/module-webdriver": "^1.0", + "codeception/util-universalframework": "^1.0", "dg/mysql-dump": "^1.3", "ext-fileinfo": "*", "ext-json": "*", @@ -2681,7 +2688,7 @@ ], "support": { "issues": "https://github.com/lucatume/wp-browser/issues", - "source": "https://github.com/lucatume/wp-browser/tree/3.1.10" + "source": "https://github.com/lucatume/wp-browser/tree/3.2.1" }, "funding": [ { @@ -2689,7 +2696,7 @@ "type": "github" } ], - "time": "2023-07-20T16:11:45+00:00" + "time": "2023-09-21T06:36:09+00:00" }, { "name": "mck89/peast", @@ -3002,16 +3009,16 @@ }, { "name": "nesbot/carbon", - "version": "2.69.0", + "version": "2.71.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4308217830e4ca445583a37d1bf4aff4153fa81c" + "reference": "98276233188583f2ff845a0f992a235472d9466a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4308217830e4ca445583a37d1bf4aff4153fa81c", - "reference": "4308217830e4ca445583a37d1bf4aff4153fa81c", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/98276233188583f2ff845a0f992a235472d9466a", + "reference": "98276233188583f2ff845a0f992a235472d9466a", "shasum": "" }, "require": { @@ -3104,7 +3111,7 @@ "type": "tidelift" } ], - "time": "2023-08-03T09:00:52+00:00" + "time": "2023-09-25T11:31:05+00:00" }, { "name": "nikic/php-parser", @@ -3234,16 +3241,16 @@ }, { "name": "pdepend/pdepend", - "version": "2.14.0", + "version": "2.15.1", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "1121d4b04af06e33e9659bac3a6741b91cab1de1" + "reference": "d12f25bcdfb7754bea458a4a5cb159d55e9950d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1121d4b04af06e33e9659bac3a6741b91cab1de1", - "reference": "1121d4b04af06e33e9659bac3a6741b91cab1de1", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/d12f25bcdfb7754bea458a4a5cb159d55e9950d0", + "reference": "d12f25bcdfb7754bea458a4a5cb159d55e9950d0", "shasum": "" }, "require": { @@ -3285,7 +3292,7 @@ ], "support": { "issues": "https://github.com/pdepend/pdepend/issues", - "source": "https://github.com/pdepend/pdepend/tree/2.14.0" + "source": "https://github.com/pdepend/pdepend/tree/2.15.1" }, "funding": [ { @@ -3293,7 +3300,7 @@ "type": "tidelift" } ], - "time": "2023-05-26T13:15:18+00:00" + "time": "2023-09-28T12:00:56+00:00" }, { "name": "phar-io/manifest", @@ -3580,22 +3587,22 @@ }, { "name": "phpmd/phpmd", - "version": "2.13.0", + "version": "2.14.1", "source": { "type": "git", "url": "https://github.com/phpmd/phpmd.git", - "reference": "dad0228156856b3ad959992f9748514fa943f3e3" + "reference": "442fc2c34edcd5198b442d8647c7f0aec3afabe8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/dad0228156856b3ad959992f9748514fa943f3e3", - "reference": "dad0228156856b3ad959992f9748514fa943f3e3", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/442fc2c34edcd5198b442d8647c7f0aec3afabe8", + "reference": "442fc2c34edcd5198b442d8647c7f0aec3afabe8", "shasum": "" }, "require": { "composer/xdebug-handler": "^1.0 || ^2.0 || ^3.0", "ext-xml": "*", - "pdepend/pdepend": "^2.12.1", + "pdepend/pdepend": "^2.15.1", "php": ">=5.3.9" }, "require-dev": { @@ -3605,7 +3612,7 @@ "gregwar/rst": "^1.0", "mikey179/vfsstream": "^1.6.8", "phpunit/phpunit": "^4.8.36 || ^5.7.27", - "squizlabs/php_codesniffer": "^2.0" + "squizlabs/php_codesniffer": "^2.9.2 || ^3.7.2" }, "bin": [ "src/bin/phpmd" @@ -3642,6 +3649,7 @@ "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", "homepage": "https://phpmd.org/", "keywords": [ + "dev", "mess detection", "mess detector", "pdepend", @@ -3651,7 +3659,7 @@ "support": { "irc": "irc://irc.freenode.org/phpmd", "issues": "https://github.com/phpmd/phpmd/issues", - "source": "https://github.com/phpmd/phpmd/tree/2.13.0" + "source": "https://github.com/phpmd/phpmd/tree/2.14.1" }, "funding": [ { @@ -3659,7 +3667,7 @@ "type": "tidelift" } ], - "time": "2022-09-10T08:44:15+00:00" + "time": "2023-09-28T13:07:44+00:00" }, { "name": "phpstan/extension-installer", @@ -3707,16 +3715,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.33", + "version": "1.10.38", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1" + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1", - "reference": "03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", "shasum": "" }, "require": { @@ -3765,20 +3773,20 @@ "type": "tidelift" } ], - "time": "2023-09-04T12:20:53+00:00" + "time": "2023-10-06T14:19:14+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.27", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { @@ -3835,7 +3843,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, "funding": [ { @@ -3843,7 +3851,7 @@ "type": "github" } ], - "time": "2023-07-26T13:44:30+00:00" + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4088,16 +4096,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.11", + "version": "9.6.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "shasum": "" }, "require": { @@ -4112,7 +4120,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -4171,7 +4179,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" }, "funding": [ { @@ -4187,7 +4195,7 @@ "type": "tidelift" } ], - "time": "2023-08-19T07:10:56+00:00" + "time": "2023-09-19T05:39:22+00:00" }, { "name": "psr/clock", @@ -4342,16 +4350,16 @@ }, { "name": "psr/http-client", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { @@ -4388,9 +4396,9 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/1.0.2" + "source": "https://github.com/php-fig/http-client" }, - "time": "2023-04-10T20:12:12+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", @@ -8088,16 +8096,16 @@ }, { "name": "wp-cli/i18n-command", - "version": "v2.4.3", + "version": "v2.4.4", "source": { "type": "git", "url": "https://github.com/wp-cli/i18n-command.git", - "reference": "203b020318fe2596a218bf52db25adc6b187f42d" + "reference": "7d82e675f271359b1af614e6325d8eeaeb7d7474" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/203b020318fe2596a218bf52db25adc6b187f42d", - "reference": "203b020318fe2596a218bf52db25adc6b187f42d", + "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/7d82e675f271359b1af614e6325d8eeaeb7d7474", + "reference": "7d82e675f271359b1af614e6325d8eeaeb7d7474", "shasum": "" }, "require": { @@ -8108,7 +8116,7 @@ }, "require-dev": { "wp-cli/scaffold-command": "^1.2 || ^2", - "wp-cli/wp-cli-tests": "^3.1" + "wp-cli/wp-cli-tests": "^4" }, "suggest": { "ext-json": "Used for reading and generating JSON translation files", @@ -8150,9 +8158,9 @@ "homepage": "https://github.com/wp-cli/i18n-command", "support": { "issues": "https://github.com/wp-cli/i18n-command/issues", - "source": "https://github.com/wp-cli/i18n-command/tree/v2.4.3" + "source": "https://github.com/wp-cli/i18n-command/tree/v2.4.4" }, - "time": "2023-03-24T18:15:59+00:00" + "time": "2023-08-30T18:00:10+00:00" }, { "name": "wp-cli/mustangostang-spyc", @@ -8207,16 +8215,16 @@ }, { "name": "wp-cli/php-cli-tools", - "version": "v0.11.19", + "version": "v0.11.21", "source": { "type": "git", "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "2d27f0db5c36f5aa0064abecddd6d05f28c4d001" + "reference": "b3457a8d60cd0b1c48cab76ad95df136d266f0b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/2d27f0db5c36f5aa0064abecddd6d05f28c4d001", - "reference": "2d27f0db5c36f5aa0064abecddd6d05f28c4d001", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/b3457a8d60cd0b1c48cab76ad95df136d266f0b6", + "reference": "b3457a8d60cd0b1c48cab76ad95df136d266f0b6", "shasum": "" }, "require": { @@ -8224,7 +8232,7 @@ }, "require-dev": { "roave/security-advisories": "dev-latest", - "wp-cli/wp-cli-tests": "^3.1.6" + "wp-cli/wp-cli-tests": "^4" }, "type": "library", "extra": { @@ -8264,9 +8272,9 @@ ], "support": { "issues": "https://github.com/wp-cli/php-cli-tools/issues", - "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.19" + "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.21" }, - "time": "2023-07-21T11:37:15+00:00" + "time": "2023-09-29T15:28:10+00:00" }, { "name": "wp-cli/wp-cli", diff --git a/dev-workspace/docker/compose.yaml b/dev-workspace/docker/compose.yaml index 8337b0fb3..4a66e9775 100644 --- a/dev-workspace/docker/compose.yaml +++ b/dev-workspace/docker/compose.yaml @@ -1,7 +1,7 @@ name: devworkspace_future_free services: terminal: - build: ./docker + build: . image: publishpress/dev-workspace-terminal:future-free-2 command: ["zsh"] stdin_open: true diff --git a/languages/post-expirator.pot b/languages/post-expirator.pot index ad0cb620e..775111127 100644 --- a/languages/post-expirator.pot +++ b/languages/post-expirator.pot @@ -2,14 +2,14 @@ # This file is distributed under the same license as the PublishPress Future plugin. msgid "" msgstr "" -"Project-Id-Version: PublishPress Future 3.1.0\n" +"Project-Id-Version: PublishPress Future 3.1.1-beta.2\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-09-06T15:24:49+00:00\n" +"POT-Creation-Date: 2023-09-28T14:45:54+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" @@ -116,7 +116,7 @@ msgstr "" #: legacy/classes/Facade.class.php:418 #: src/Modules/Expirator/Tables/ScheduledActionsTable.php:44 -#: src/Modules/Settings/Controllers/Controller.php:187 +#: src/Modules/Settings/Controllers/Controller.php:179 #: src/Views/bulk-edit.php:129 #: src/Views/bulk-edit.php:131 #: src/Views/classic-metabox.php:117 @@ -149,22 +149,34 @@ msgid "Future Action" msgstr "" #: legacy/functions.php:1167 -#: src/Modules/Settings/Controllers/Controller.php:200 +#: src/Modules/Settings/Controllers/Controller.php:192 msgid "No taxonomies found" msgstr "" -#: services.php:68 +#: services.php:69 msgid "l F jS, Y" msgstr "" -#: services.php:69 +#: services.php:70 msgid "g:ia" msgstr "" -#: services.php:70 +#: services.php:71 msgid "Post expires at EXPIRATIONTIME on ACTIONDATE" msgstr "" +#: src/Modules/Expirator/Controllers/BulkActionController.php:107 +msgid "No posts selected. Unable to sync Future Actions." +msgstr "" + +#: src/Modules/Expirator/Controllers/BulkActionController.php:112 +msgid "Future Actions successfully synced with Post Metadata." +msgstr "" + +#: src/Modules/Expirator/Controllers/BulkActionController.php:118 +msgid "Update Future Actions from Post Metadata" +msgstr "" + #: src/Modules/Expirator/Controllers/ScheduledActionsController.php:81 msgid "Future" msgstr "" @@ -274,27 +286,27 @@ msgstr "" msgid "Unstick" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:456 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:457 msgid "Email is disabled" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:460 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:461 msgid "Email sent" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:460 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:461 msgid "Email not sent" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:563 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:579 msgid "%s. %s on %s. The post link is %s" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:580 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:596 msgid "Future Action Complete \"%s\"" msgstr "" -#: src/Modules/Expirator/Models/ExpirablePostModel.php:583 +#: src/Modules/Expirator/Models/ExpirablePostModel.php:599 msgid "[%1$s] %2$s" msgstr "" @@ -362,36 +374,36 @@ msgstr "" msgid "Async" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:175 +#: src/Modules/Settings/Controllers/Controller.php:167 msgid "Default Values" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:176 +#: src/Modules/Settings/Controllers/Controller.php:168 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 "" -#: src/Modules/Settings/Controllers/Controller.php:180 -#: src/Modules/Settings/Controllers/Controller.php:181 +#: src/Modules/Settings/Controllers/Controller.php:172 +#: src/Modules/Settings/Controllers/Controller.php:173 msgid "Active" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:182 +#: src/Modules/Settings/Controllers/Controller.php:174 msgid "Inactive" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:183 +#: src/Modules/Settings/Controllers/Controller.php:175 msgid "Select whether the PublishPress Future meta box is active for this post type." msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:188 +#: src/Modules/Settings/Controllers/Controller.php:180 msgid "Select the default action for the post type." msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:192 +#: src/Modules/Settings/Controllers/Controller.php:184 msgid "Auto-enable?" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:193 +#: src/Modules/Settings/Controllers/Controller.php:185 #: src/Views/menu-diagnostics.php:62 #: src/Views/menu-display.php:81 #: src/Views/menu-general.php:145 @@ -399,7 +411,7 @@ msgstr "" msgid "Enabled" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:194 +#: src/Modules/Settings/Controllers/Controller.php:186 #: src/Views/menu-diagnostics.php:82 #: src/Views/menu-display.php:86 #: src/Views/menu-general.php:152 @@ -407,52 +419,52 @@ msgstr "" msgid "Disabled" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:195 +#: src/Modules/Settings/Controllers/Controller.php:187 msgid "Select whether the PublishPress Future is enabled for all new posts." msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:199 +#: src/Modules/Settings/Controllers/Controller.php:191 msgid "Taxonomy (Hierarchical)" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:201 +#: src/Modules/Settings/Controllers/Controller.php:193 msgid "Select the hierarchical taxonomy and terms to be used for taxonomy based expiration." msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:205 +#: src/Modules/Settings/Controllers/Controller.php:197 #: src/Views/menu-general.php:189 msgid "Who to Notify" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:206 +#: src/Modules/Settings/Controllers/Controller.php:198 msgid "Enter a comma separate list of emails that you would like to be notified when the action runs." msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:210 +#: src/Modules/Settings/Controllers/Controller.php:202 #: src/Views/menu-general.php:101 msgid "Default Date/Time Offset" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:213 +#: src/Modules/Settings/Controllers/Controller.php:205 msgid "" "Set the offset to use for the default action date and time. For information on formatting, see %1$s\n" " . 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. Please, use only terms in English." msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:218 +#: src/Modules/Settings/Controllers/Controller.php:210 #: src/Views/menu-general.php:115 msgid "PHP strtotime function" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:229 +#: src/Modules/Settings/Controllers/Controller.php:221 msgid "Default terms:" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:230 +#: src/Modules/Settings/Controllers/Controller.php:222 msgid "Save changes" msgstr "" -#: src/Modules/Settings/Controllers/Controller.php:303 +#: src/Modules/Settings/Controllers/Controller.php:295 msgid "Form Validation Failure: Sorry, your nonce did not verify." msgstr "" @@ -568,18 +580,10 @@ msgstr "" msgid "More than 1 hierarchical taxonomy detected. You must assign a default taxonomy on the settings screen." msgstr "" -#: src/Views/expire-column.php:31 -msgid "Cron event scheduled." -msgstr "" - #: src/Views/expire-column.php:37 msgid "%1$s%2$s%3$s on %5$s%4$s%6$s" msgstr "" -#: src/Views/expire-column.php:63 -msgid "This action will can not run correctly." -msgstr "" - #: src/Views/expire-column.php:64 msgid "Action could not be scheduled due to a configuration issue. Please attempt to schedule it again." msgstr "" diff --git a/legacy/debug.php b/legacy/debug.php index c4643c00e..58b1866c9 100644 --- a/legacy/debug.php +++ b/legacy/debug.php @@ -1,7 +1,6 @@ '__root__', 'pretty_version' => 'dev-3.1-branch', 'version' => 'dev-3.1-branch', - 'reference' => 'e0927a700fcbd0667b80acb1d961e1e2d05736b4', + 'reference' => '1d89b01c0fe442c028c463468a78c94bdc82b308', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-3.1-branch', 'version' => 'dev-3.1-branch', - 'reference' => 'e0927a700fcbd0667b80acb1d961e1e2d05736b4', + 'reference' => '1d89b01c0fe442c028c463468a78c94bdc82b308', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -56,27 +56,27 @@ 'dev_requirement' => false, ), 'publishpress/wordpress-reviews' => array( - 'pretty_version' => 'v1.1.19', - 'version' => '1.1.19.0', - 'reference' => '028e573eb7c5da2455a7a823cabbbe5e3f89ca9c', + 'pretty_version' => 'v1.1.20', + 'version' => '1.1.20.0', + 'reference' => '6d0b687a66439721b0432ef1320fd818cd56309f', 'type' => 'library', 'install_path' => __DIR__ . '/../publishpress/wordpress-reviews', 'aliases' => array(), 'dev_requirement' => false, ), 'publishpress/wordpress-version-notices' => array( - 'pretty_version' => '2.1.2', - 'version' => '2.1.2.0', - 'reference' => 'b0efcf04ab9d37304e38673bee471116e44cdb0e', + 'pretty_version' => '2.1.3', + 'version' => '2.1.3.0', + 'reference' => '8e54558d2427a0f93174ccbc1d02c1ba7e2abc8d', 'type' => 'library', 'install_path' => __DIR__ . '/../publishpress/wordpress-version-notices', 'aliases' => array(), 'dev_requirement' => false, ), 'woocommerce/action-scheduler' => array( - 'pretty_version' => '3.6.2', - 'version' => '3.6.2.0', - 'reference' => '4eb2fa9737a53e4d284dafcf3e0bf428b5f941bc', + 'pretty_version' => '3.6.3', + 'version' => '3.6.3.0', + 'reference' => 'c33dd732e37c90f37c3f9662f7eed888c11dc60d', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../woocommerce/action-scheduler', 'aliases' => array(), diff --git a/lib/vendor/publishpress/wordpress-reviews/ReviewsController.php b/lib/vendor/publishpress/wordpress-reviews/ReviewsController.php index 1d4445a37..fcff08f8d 100644 --- a/lib/vendor/publishpress/wordpress-reviews/ReviewsController.php +++ b/lib/vendor/publishpress/wordpress-reviews/ReviewsController.php @@ -39,6 +39,10 @@ use Exception; +if (class_exists('PublishPress\\WordPressReviews\\ReviewsController')) { + return; +} + /** * Class ReviewsController * diff --git a/lib/vendor/publishpress/wordpress-version-notices/src/Module/MenuLink/Module.php b/lib/vendor/publishpress/wordpress-version-notices/src/Module/MenuLink/Module.php index a4a3d8727..b1e969bb6 100644 --- a/lib/vendor/publishpress/wordpress-version-notices/src/Module/MenuLink/Module.php +++ b/lib/vendor/publishpress/wordpress-version-notices/src/Module/MenuLink/Module.php @@ -63,7 +63,7 @@ public function __construct(TemplateLoaderInterface $templateLoader) public function init() { add_action('admin_head', [$this, 'adminHeadAddStyle']); - add_action('init', [$this, 'collectTheSettings'], 5); + add_action('init', [$this, 'collectTheSettings'], 50); add_action('admin_menu', [$this, 'addMenuLink'], 20); add_action('admin_print_scripts', [$this, 'setUpgradeMenuLink'], 9999); } diff --git a/lib/vendor/publishpress/wordpress-version-notices/src/Module/TopNotice/Module.php b/lib/vendor/publishpress/wordpress-version-notices/src/Module/TopNotice/Module.php index d103be86c..e8106752a 100644 --- a/lib/vendor/publishpress/wordpress-version-notices/src/Module/TopNotice/Module.php +++ b/lib/vendor/publishpress/wordpress-version-notices/src/Module/TopNotice/Module.php @@ -64,7 +64,7 @@ public function init() { add_action(self::DISPLAY_ACTION, [$this, 'display'], 10, 2); add_action('in_admin_header', [$this, 'displayTopNotice']); - add_action('admin_init', [$this, 'collectTheSettings'], 5); + add_action('admin_init', [$this, 'collectTheSettings'], 50); add_action('admin_head', [$this, 'adminHeadAddStyle']); } diff --git a/lib/vendor/publishpress/wordpress-version-notices/src/autoload.php b/lib/vendor/publishpress/wordpress-version-notices/src/autoload.php index a0d2e1d5e..2d1a2ef8e 100644 --- a/lib/vendor/publishpress/wordpress-version-notices/src/autoload.php +++ b/lib/vendor/publishpress/wordpress-version-notices/src/autoload.php @@ -10,7 +10,7 @@ add_action('plugins_loaded', function () { if (! defined('PP_VERSION_NOTICES_LOADED')) { - define('PP_VERSION_NOTICES_VERSION', '2.1.1'); + define('PP_VERSION_NOTICES_VERSION', '2.1.3'); define('PP_VERSION_NOTICES_BASE_PATH', __DIR__ . '/../'); define('PP_VERSION_NOTICES_SRC_PATH', __DIR__); diff --git a/lib/vendor/publishpress/wordpress-version-notices/src/include.php b/lib/vendor/publishpress/wordpress-version-notices/src/include.php index 21234f713..0ab7e0725 100644 --- a/lib/vendor/publishpress/wordpress-version-notices/src/include.php +++ b/lib/vendor/publishpress/wordpress-version-notices/src/include.php @@ -16,7 +16,7 @@ return; } -if (! function_exists(__NAMESPACE__ . '\register2Dot1Dot2')) { +if (! function_exists(__NAMESPACE__ . '\register2Dot1Dot3')) { if (! defined('PUBLISHPRESS_WORDPRESS_VERSION_NOTICES_INCLUDED')) { define('PUBLISHPRESS_WORDPRESS_VERSION_NOTICES_INCLUDED', __DIR__); } @@ -27,24 +27,24 @@ add_action('plugins_loaded', [Versions::class, 'initializeLatestVersion'], -150, 0); } - add_action('plugins_loaded', __NAMESPACE__ . '\register2Dot1Dot2', -190, 0); + add_action('plugins_loaded', __NAMESPACE__ . '\register2Dot1Dot3', -190, 0); - function register2Dot1Dot2() + function register2Dot1Dot3() { if (! class_exists('PublishPress\WordpressVersionNotices\ServicesProvider')) { $versions = Versions::getInstance(); - $versions->register('2.1.2', __NAMESPACE__ . '\initialize2Dot1Dot2'); + $versions->register('2.1.3', __NAMESPACE__ . '\initialize2Dot1Dot3'); } } - function initialize2Dot1Dot2() + function initialize2Dot1Dot3() { require_once __DIR__ . '/autoload.php'; if (! defined('PUBLISHPRESS_WORDPRESS_VERSION_NOTICES_VERSION')) { - define('PUBLISHPRESS_WORDPRESS_VERSION_NOTICES_VERSION', '2.1.2'); + define('PUBLISHPRESS_WORDPRESS_VERSION_NOTICES_VERSION', '2.1.3'); } - do_action('publishpress_wordpress_version_notices_2Dot1Dot2_initialized'); + do_action('publishpress_wordpress_version_notices_2Dot1Dot3_initialized'); } } diff --git a/lib/vendor/woocommerce/action-scheduler/action-scheduler.php b/lib/vendor/woocommerce/action-scheduler/action-scheduler.php index 960e439b7..42d54e71b 100644 --- a/lib/vendor/woocommerce/action-scheduler/action-scheduler.php +++ b/lib/vendor/woocommerce/action-scheduler/action-scheduler.php @@ -5,7 +5,7 @@ * Description: A robust scheduling library for use in WordPress plugins. * Author: Automattic * Author URI: https://automattic.com/ - * Version: 3.6.2 + * Version: 3.6.3 * License: GPLv3 * Tested up to: 6.3 * Requires at least: 5.2 @@ -29,27 +29,27 @@ * @package ActionScheduler */ -if ( ! function_exists( 'action_scheduler_register_3_dot_6_dot_2' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION. +if ( ! function_exists( 'action_scheduler_register_3_dot_6_dot_3' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION. if ( ! class_exists( 'ActionScheduler_Versions', false ) ) { require_once __DIR__ . '/classes/ActionScheduler_Versions.php'; add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 ); } - add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_6_dot_2', 0, 0 ); // WRCS: DEFINED_VERSION. + add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_6_dot_3', 0, 0 ); // WRCS: DEFINED_VERSION. /** * Registers this version of Action Scheduler. */ - function action_scheduler_register_3_dot_6_dot_2() { // WRCS: DEFINED_VERSION. + function action_scheduler_register_3_dot_6_dot_3() { // WRCS: DEFINED_VERSION. $versions = ActionScheduler_Versions::instance(); - $versions->register( '3.6.2', 'action_scheduler_initialize_3_dot_6_dot_2' ); // WRCS: DEFINED_VERSION. + $versions->register( '3.6.3', 'action_scheduler_initialize_3_dot_6_dot_3' ); // WRCS: DEFINED_VERSION. } /** * Initializes this version of Action Scheduler. */ - function action_scheduler_initialize_3_dot_6_dot_2() { // WRCS: DEFINED_VERSION. + function action_scheduler_initialize_3_dot_6_dot_3() { // WRCS: DEFINED_VERSION. // A final safety check is required even here, because historic versions of Action Scheduler // followed a different pattern (in some unusual cases, we could reach this point and the // ActionScheduler class is already defined—so we need to guard against that). @@ -61,7 +61,7 @@ function action_scheduler_initialize_3_dot_6_dot_2() { // WRCS: DEFINED_VERSION. // Support usage in themes - load this version if no plugin has loaded a version yet. if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) { - action_scheduler_initialize_3_dot_6_dot_2(); // WRCS: DEFINED_VERSION. + action_scheduler_initialize_3_dot_6_dot_3(); // WRCS: DEFINED_VERSION. do_action( 'action_scheduler_pre_theme_init' ); ActionScheduler_Versions::initialize_latest_version(); } diff --git a/lib/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php b/lib/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php index 8a0109eeb..0163f7072 100644 --- a/lib/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php +++ b/lib/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php @@ -226,7 +226,7 @@ public static function is_initialized( $function_name = null ) { __( '%s() was called before the Action Scheduler data store was initialized', 'action-scheduler' ), esc_attr( $function_name ) ); - error_log( $message ); + _doing_it_wrong( $function_name, $message, '3.1.6' ); } return self::$data_store_initialized; diff --git a/lib/vendor/woocommerce/action-scheduler/readme.txt b/lib/vendor/woocommerce/action-scheduler/readme.txt index 5c707019c..e3b87c2c8 100644 --- a/lib/vendor/woocommerce/action-scheduler/readme.txt +++ b/lib/vendor/woocommerce/action-scheduler/readme.txt @@ -1,7 +1,7 @@ === Action Scheduler === Contributors: Automattic, wpmuguru, claudiosanches, peterfabian1000, vedjain, jamosova, obliviousharmony, konamiman, sadowski, royho, barryhughes-1 Tags: scheduler, cron -Stable tag: 3.6.2 +Stable tag: 3.6.3 License: GPLv3 Tested up to: 6.3 @@ -45,6 +45,9 @@ Collaboration is cool. We'd love to work with you to improve Action Scheduler. [ == Changelog == += 3.6.3 - 2023-09-13 = +* Use `_doing_it_wrong` in initialization check. + = 3.6.2 - 2023-08-09 = * Add guidance about passing arguments. * Atomic option locking. diff --git a/post-expirator.php b/post-expirator.php index 5ffc0f6bc..c9e5bc044 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.1.0 + * Version: 3.1.1 * Author URI: http://publishpress.com * Text Domain: post-expirator * Domain Path: /languages @@ -12,11 +12,14 @@ * Requires PHP: 7.2.5 */ +namespace PublishPress\Future; + +use Exception; use PublishPress\Future\Core\Autoloader; use PublishPress\Future\Core\DI\Container; use PublishPress\Future\Core\DI\ServicesAbstract; - -use function PublishPress\Future\logCatchException; +use PublishPress\Future\Core\Plugin; +use PublishPress\Future\Framework\WordPress\Facade\HooksFacade; defined('ABSPATH') or die('Direct access not allowed.'); @@ -47,13 +50,13 @@ } if (! defined('PUBLISHPRESS_FUTURE_VERSION')) { - define('PUBLISHPRESS_FUTURE_VERSION', '3.1.0'); + define('PUBLISHPRESS_FUTURE_VERSION', '3.1.1'); } if (! defined('PUBLISHPRESS_FUTURE_LIB_VENDOR_PATH')) { $vendorPath = __DIR__ . '/lib/vendor'; if (defined('PUBLISHPRESS_FUTURE_LOADED_BY_PRO') && PUBLISHPRESS_FUTURE_LOADED_BY_PRO) { - $vendorPath = PublishPress\FuturePro\VENDOR_DIR; + $vendorPath = \PUBLISHPRESS_FUTURE_PRO_VENDOR_DIR; } define('PUBLISHPRESS_FUTURE_LIB_VENDOR_PATH', $vendorPath); @@ -76,29 +79,55 @@ require_once PUBLISHPRESS_FUTURE_LIB_VENDOR_PATH . '/woocommerce/action-scheduler/action-scheduler.php'; - add_action('plugins_loaded', function () { - try { - if (! class_exists('PublishPress\Future\Core\Autoloader')) { - require_once __DIR__ . '/src/Core/Autoloader.php'; - } - Autoloader::register(); + if (! class_exists('PublishPress\Future\Core\Autoloader')) { + require_once __DIR__ . '/src/Core/Autoloader.php'; + } + Autoloader::register(); - $pluginFile = __FILE__; + function loadDependencies() + { + if (defined('PUBLISHPRESS_FUTURE_LOADED_DEPENDENCIES')) { + return; + } + + $pluginFile = __FILE__; - $services = require __DIR__ . '/services.php'; - $container = new Container($services); + $services = require __DIR__ . '/services.php'; + $container = new Container($services); - require_once __DIR__ . '/legacy/defines.php'; - require_once __DIR__ . '/legacy/deprecated.php'; - require_once __DIR__ . '/legacy/functions.php'; - require_once __DIR__ . '/legacy/autoload.php'; + require_once __DIR__ . '/legacy/defines.php'; + require_once __DIR__ . '/legacy/deprecated.php'; + require_once __DIR__ . '/legacy/functions.php'; + require_once __DIR__ . '/legacy/autoload.php'; + + define('PUBLISHPRESS_FUTURE_LOADED_DEPENDENCIES', true); + } + HooksFacade::registerActivationHook( + __FILE__, + function () { + Plugin::onActivate(); + } + ); + + HooksFacade::registerDeactivationHook( + __FILE__, + function () { + loadDependencies(); + Plugin::onDeactivate(); + } + ); + + add_action('init', function () { + try { + loadDependencies(); + + $container = Container::getInstance(); $container->get(ServicesAbstract::PLUGIN)->initialize(); } catch (Exception $e) { logCatchException($e); } - }, 5, 0); - + }, 10, 0); } catch (Exception $e) { logCatchException($e); } diff --git a/readme.txt b/readme.txt index 38695e6de..1af2b9b11 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Tags: expire posts, update posts, schedule changes, automatic changes, Requires at least: 5.5 Requires PHP: 7.2.5 Tested up to: 6.3 -Stable tag: 3.1.0 +Stable tag: 3.1.1 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,18 @@ Yes, the PublishPress Future plugin allows you to schedule automatic changes to == Changelog == += [3.1.1] - 11 Oct, 2023 = + +* ADDED: Add new bulk action for posts to update future action scheduler based on post's metadata, #538; +* DEPRECATED: Deprecate class PublishPress\Future\Core\DI\ContainerNotInitializedException; +* DEPRECATED: Deprecate class PublishPress\Future\Core\DI\ServiceProvider; +* DEPRECATED: Deprecate interface PublishPress\Future\Core\DI\ServiceProviderInterface; +* FIXED: Fix compatibility with 3rd party plugins that import posts, #538; +* FIXED: Fix JS error when admin user has no permissions, #533 (Thanks to @raphaelheying); +* FIXED: Fix missed post link on the email notification, or actions log, when the post is deleted, #507; +* FIXED: Fix plugin activation hook not running on plugin activation, #539; +* REMOVED: Remove tooltip from the "Expires" column in the posts list, #511; + = [3.1.0] - 06 Sep, 2023 = * FIXED: Fix compatibility with Composer-based installations, using prefixed libraries, #522; diff --git a/services.php b/services.php index 4b7b5b34d..3867d9772 100644 --- a/services.php +++ b/services.php @@ -2,7 +2,6 @@ defined('ABSPATH') or die('Direct access not allowed.'); -use PublishPress\Future\Core\DI\ContainerInterface; use PublishPress\Future\Core\DI\ServicesAbstract; use PublishPress\Future\Core\HooksAbstract; use PublishPress\Future\Core\Paths; @@ -15,6 +14,7 @@ use PublishPress\Future\Framework\WordPress\Facade\EmailFacade; use PublishPress\Future\Framework\WordPress\Facade\ErrorFacade; use PublishPress\Future\Framework\WordPress\Facade\HooksFacade; +use PublishPress\Future\Framework\WordPress\Facade\NoticeFacade; use PublishPress\Future\Framework\WordPress\Facade\OptionsFacade; use PublishPress\Future\Framework\WordPress\Facade\RequestFacade; use PublishPress\Future\Framework\WordPress\Facade\SanitizationFacade; @@ -55,6 +55,7 @@ use PublishPress\Future\Modules\Settings\SettingsFacade; use PublishPress\Future\Modules\VersionNotices\Module as ModuleVersionNotices; use PublishPress\Future\Modules\WooCommerce\Module as ModuleWooCommerce; +use PublishPress\Psr\Container\ContainerInterface; use PublishPressFuture\Modules\Expirator\Migrations\V30000ActionArgsSchema; return [ @@ -121,7 +122,8 @@ $container->get(ServicesAbstract::LEGACY_PLUGIN), $container->get(ServicesAbstract::HOOKS), $container->get(ServicesAbstract::PLUGIN_SLUG), - $container->get(ServicesAbstract::BASE_PATH) + $container->get(ServicesAbstract::BASE_PATH), + $container->get(ServicesAbstract::NOTICES) ); }, @@ -213,6 +215,15 @@ return new UsersFacade(); }, + /** + * @return \PublishPress\Future\Framework\WordPress\Facade\NoticeFacade + */ + ServicesAbstract::NOTICES => static function (ContainerInterface $container) { + return new NoticeFacade( + $container->get(ServicesAbstract::HOOKS) + ); + }, + /** * @return EmailFacade */ @@ -325,7 +336,8 @@ $container->get(ServicesAbstract::REQUEST), $container->get(ServicesAbstract::ACTION_ARGS_MODEL_FACTORY), $container->get(ServicesAbstract::SCHEDULED_ACTIONS_TABLE_FACTORY), - $container->get(ServicesAbstract::POST_TYPE_SETTINGS_MODEL_FACTORY) + $container->get(ServicesAbstract::POST_TYPE_SETTINGS_MODEL_FACTORY), + $container->get(ServicesAbstract::NOTICES) ); }, diff --git a/src/Core/DI/Container.php b/src/Core/DI/Container.php index 32474efdf..efdbb3254 100644 --- a/src/Core/DI/Container.php +++ b/src/Core/DI/Container.php @@ -27,10 +27,12 @@ class Container implements ContainerInterface * @var ContainerInterface */ private static $instance; + /** * @var array */ private $resolvedEntries = []; + /** * @var array */ @@ -38,7 +40,7 @@ class Container implements ContainerInterface public function __construct($services = []) { - if (! empty($services)) { + if ( ! empty($services)) { $this->registerServices($services); } @@ -55,8 +57,6 @@ public function registerServices($services) /** * @return ContainerInterface - * - * @throws ContainerNotInitializedException */ public static function getInstance() { @@ -74,9 +74,9 @@ public static function getInstance() * * @return mixed Entry. */ - public function get($id) + public function get(string $id) { - if (! $this->has($id)) { + if ( ! $this->has($id)) { throw new ServiceNotFoundException($id); } @@ -106,9 +106,9 @@ public function get($id) * * @return bool */ - public function has($id) + public function has(string $id): bool { return array_key_exists($id, $this->services) - || array_key_exists($id, $this->resolvedEntries); + || array_key_exists($id, $this->resolvedEntries); } } diff --git a/src/Core/DI/ContainerInterface.php b/src/Core/DI/ContainerInterface.php index 8acb5cc6b..d784f84c7 100644 --- a/src/Core/DI/ContainerInterface.php +++ b/src/Core/DI/ContainerInterface.php @@ -7,30 +7,7 @@ /** * Describes the interface of a container that exposes methods to read its entries. */ -interface ContainerInterface +interface ContainerInterface extends \PublishPress\Psr\Container\ContainerInterface { - // @TODO: After end of support of PHP 5.6, change this to extend PublishPress/Psr/Container/ContainerInterface. - /** - * Finds an entry of the container by its identifier and returns it. - * - * @param string $id Identifier of the entry to look for. - * - * @return mixed Entry. - */ - public function get($id); - - /** - * Returns true if the container can return an entry for the given identifier. - * Returns false otherwise. - * - * `has($id)` returning true does not mean that `get($id)` will not throw an exception. - * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. - * - * @param string $id Identifier of the entry to look for. - * - * @return bool - */ - public function has($id); - public function registerServices($services); } diff --git a/src/Core/DI/ContainerNotInitializedException.php b/src/Core/DI/ContainerNotInitializedException.php index 1b7804ff0..718deeee6 100644 --- a/src/Core/DI/ContainerNotInitializedException.php +++ b/src/Core/DI/ContainerNotInitializedException.php @@ -10,6 +10,9 @@ defined('ABSPATH') or die('Direct access not allowed.'); +/** + * @deprecated 3.1.1 + */ class ContainerNotInitializedException extends BaseException { diff --git a/src/Core/DI/ServiceNotFoundException.php b/src/Core/DI/ServiceNotFoundException.php index b4e0a91f0..d9edf88fe 100644 --- a/src/Core/DI/ServiceNotFoundException.php +++ b/src/Core/DI/ServiceNotFoundException.php @@ -6,10 +6,11 @@ namespace PublishPress\Future\Core\DI; use InvalidArgumentException; +use PublishPress\Psr\Container\NotFoundExceptionInterface; defined('ABSPATH') or die('Direct access not allowed.'); -class ServiceNotFoundException extends InvalidArgumentException +class ServiceNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface { public function __construct($message = "", $code = 0, $previous = null) { diff --git a/src/Core/DI/ServiceProvider.php b/src/Core/DI/ServiceProvider.php index c5f10031c..c5ea1dbee 100644 --- a/src/Core/DI/ServiceProvider.php +++ b/src/Core/DI/ServiceProvider.php @@ -7,6 +7,9 @@ defined('ABSPATH') or die('Direct access not allowed.'); +/** + * @deprecated 3.1.1 + */ class ServiceProvider implements ServiceProviderInterface { /** diff --git a/src/Core/DI/ServiceProviderInterface.php b/src/Core/DI/ServiceProviderInterface.php index de7fb3e5d..fe883ca7b 100644 --- a/src/Core/DI/ServiceProviderInterface.php +++ b/src/Core/DI/ServiceProviderInterface.php @@ -7,10 +7,15 @@ defined('ABSPATH') or die('Direct access not allowed.'); +/** + * @deprecated 3.1.1 + */ interface ServiceProviderInterface { /** * @return Closure[] A map of service names and theirs factory method. + * + * @deprecated 3.1.1 */ public function getFactories(); } diff --git a/src/Core/DI/ServicesAbstract.php b/src/Core/DI/ServicesAbstract.php index e7788fd80..d1e58ac07 100644 --- a/src/Core/DI/ServicesAbstract.php +++ b/src/Core/DI/ServicesAbstract.php @@ -66,4 +66,5 @@ abstract class ServicesAbstract const ACTION_SCHEDULER_LOGGER = 'future.free/action-scheduler/logger'; const ACTION_SCHEDULER_RUNNER = 'future.free/action-scheduler/runner'; const MIGRATIONS_FACTORY = 'future.free/migrations'; + const NOTICES = 'future.free/notices-facade'; } diff --git a/src/Core/HookableInterface.php b/src/Core/HookableInterface.php index 4a572a7dc..be509dcdb 100644 --- a/src/Core/HookableInterface.php +++ b/src/Core/HookableInterface.php @@ -53,9 +53,11 @@ public function addAction($actionName, $callback, $priority = 10, $acceptedArgs */ public function doAction($actionName, ...$args); + public static function registerActivationHook($pluginFile, $callback); + /** * @param string $pluginFile * @param callable $callback */ - public function registerDeactivationHook($pluginFile, $callback); + public static function registerDeactivationHook($pluginFile, $callback); } diff --git a/src/Core/Plugin.php b/src/Core/Plugin.php index 16e5f93b5..28a879d15 100644 --- a/src/Core/Plugin.php +++ b/src/Core/Plugin.php @@ -5,8 +5,13 @@ namespace PublishPress\Future\Core; +use PublishPress\Future\Core\DI\Container; +use PublishPress\Future\Core\DI\ServicesAbstract; use PublishPress\Future\Framework\InitializableInterface; use PublishPress\Future\Framework\ModuleInterface as ModuleInterface; +use PublishPress\Future\Framework\WordPress\Facade\NoticeFacade; + +use PublishPress\Future\Modules\Settings\SettingsFacade; defined('ABSPATH') or die('Direct access not allowed.'); @@ -42,25 +47,33 @@ class Plugin implements InitializableInterface */ private $pluginSlug; + /** + * @var NoticeFacade + */ + private $notices; + /** * @param ModuleInterface[] $modules * @param object $legacyPlugin * @param HookableInterface $hooksFacade * @param string $pluginSlug * @param string $basePath + * @param NoticeFacade $notices */ public function __construct( $modules, $legacyPlugin, HookableInterface $hooksFacade, $pluginSlug, - $basePath + $basePath, + NoticeFacade $notices ) { $this->modules = $modules; $this->legacyPlugin = $legacyPlugin; $this->hooks = $hooksFacade; $this->basePath = $basePath; $this->pluginSlug = $pluginSlug; + $this->notices = $notices; } public function initialize() @@ -83,9 +96,7 @@ public function initialize() $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'; - $this->hooks->registerActivationHook($pluginFile, [$this, 'activatePlugin']); - $this->hooks->registerDeactivationHook($pluginFile, [$this, 'deactivatePlugin']); + $this->notices->init(); $this->initializeModules(); } @@ -99,12 +110,23 @@ private function initializeModules() } } - public function activatePlugin() { - $this->hooks->doAction(HooksAbstract::ACTION_ACTIVATE_PLUGIN); + /** + * This method is static because it is called before the plugin is initialized. + * @return void + */ + public static function onActivate() + { + /** + * Callbacks hooked to this action can't be defined in callbacks of other actions like + * `plugins_loaded` or `init` because this hook will be executed before those actions. + */ + do_action(HooksAbstract::ACTION_ACTIVATE_PLUGIN); + + SettingsFacade::setDefaultSettings(); } - public function deactivatePlugin() + public static function onDeactivate() { - $this->hooks->doAction(HooksAbstract::ACTION_DEACTIVATE_PLUGIN); + do_action(HooksAbstract::ACTION_DEACTIVATE_PLUGIN); } } diff --git a/src/Framework/WordPress/Facade/HooksFacade.php b/src/Framework/WordPress/Facade/HooksFacade.php index b50415336..511f966fa 100644 --- a/src/Framework/WordPress/Facade/HooksFacade.php +++ b/src/Framework/WordPress/Facade/HooksFacade.php @@ -79,7 +79,7 @@ public function doAction($actionName, ...$args) return call_user_func_array('do_action', $params); } - public function registerActivationHook($pluginFile, $callback) + public static function registerActivationHook($pluginFile, $callback) { \register_activation_hook($pluginFile, $callback); } @@ -88,7 +88,7 @@ public function registerActivationHook($pluginFile, $callback) * @param string $pluginFile * @param callable $callback */ - public function registerDeactivationHook($pluginFile, $callback) + public static function registerDeactivationHook($pluginFile, $callback) { \register_deactivation_hook($pluginFile, $callback); } diff --git a/src/Framework/WordPress/Facade/NoticeFacade.php b/src/Framework/WordPress/Facade/NoticeFacade.php new file mode 100644 index 000000000..d59a5ce30 --- /dev/null +++ b/src/Framework/WordPress/Facade/NoticeFacade.php @@ -0,0 +1,83 @@ +hooks = $hooksFacade; + } + + public function init() + { + if ($this->initialized) { + return; + } + + $this->hooks->addAction('admin_notices', [$this, 'renderNotices']); + + $this->initialized = true; + } + + private function registerNotice($name, $message, $type = 'info', $dismiss = true) + { + $this->notices[$name] = [ + 'message' => $message, + 'type' => $type, + 'dismiss' => $dismiss, + ]; + } + + public function registerErrorNotice($name, $message) + { + $this->registerNotice($name, $message, 'error'); + } + + public function registerSuccessNotice($name, $message) + { + $this->registerNotice($name, $message, 'success'); + } + + public function redirectShowingNotice($name) + { + wp_safe_redirect( + add_query_arg( + [ + 'notice' => $name, + ], + remove_query_arg( + ['action', 'action2', 'notice'] + ) + ) + ); + exit; + } + + public function renderNotices() + { + // phpcs:ignore WordPress.Security.NonceVerification.Recommended + if (! isset($_GET['notice'])) { + return; + } + + // phpcs:ignore WordPress.Security.NonceVerification.Recommended + if (isset($this->notices[$_GET['notice']])) { + // phpcs:ignore WordPress.Security.NonceVerification.Recommended + $notice = $this->notices[sanitize_key($_GET['notice'])]; + + ?> +
+

+ +

+
+ getPostId()); } - public function getPostId() + public function getPostId(): int { - return $this->postId; + return (int)$this->postId; } public function getTerms($taxonomy = 'post_tag', $args = []) diff --git a/src/Modules/Debug/Controllers/Controller.php b/src/Modules/Debug/Controllers/Controller.php index 225c0df2d..f448623a1 100644 --- a/src/Modules/Debug/Controllers/Controller.php +++ b/src/Modules/Debug/Controllers/Controller.php @@ -33,20 +33,20 @@ public function __construct(HooksFacade $hooks, LoggerInterface $logger) public function initialize() { - $this->hooks->addAction(HooksAbstract::ACTION_DEBUG_LOG, [$this, 'onActionDebugLog']); + $this->hooks->addAction(HooksAbstract::ACTION_DEBUG_LOG, [$this, 'onDebugLog']); $this->hooks->addAction( CoreAbstractHooks::ACTION_DEACTIVATE_PLUGIN, - [$this, 'onActionDeactivatePlugin'] + [$this, 'onDeactivatePlugin'] ); } - public function onActionDebugLog($message) + public function onDebugLog($message) { $this->logger->debug($message); } - public function onActionDeactivatePlugin() + public function onDeactivatePlugin() { $preserveData = (bool)get_option('expirationdatePreserveData', 1); diff --git a/src/Modules/Expirator/Controllers/BulkActionController.php b/src/Modules/Expirator/Controllers/BulkActionController.php new file mode 100644 index 000000000..76edc3a90 --- /dev/null +++ b/src/Modules/Expirator/Controllers/BulkActionController.php @@ -0,0 +1,153 @@ +hooks = $hooksFacade; + $this->expirablePostModelFactory = $expirablePostModelFactory; + $this->sanitization = $sanitization; + $this->currentUserModelFactory = $currentUserModelFactory; + $this->request = $request; + $this->notices = $notices; + } + + public function initialize() + { + $this->addHooks(); + $this->registerNotices(); + } + + private function addHooks() + { + $this->hooks->addAction( + HooksAbstract::ACTION_SYNC_SCHEDULER_WITH_POST_META, + [$this, 'syncSchedulerWithPostMeta'] + ); + + $container = \PublishPress\Future\Core\DI\Container::getInstance(); + $postTypes = new PostTypes($container); + $activatedPostTypes = $postTypes->getActivatedPostTypes(); + + foreach ($activatedPostTypes as $postType) { + $this->hooks->addAction( + 'bulk_actions-edit-' . $postType, + [$this, 'filterBulkActions'] + ); + } + } + + private function registerNotices() + { + $this->notices->registerErrorNotice( + self::NOTICE_NO_POSTS_SELECTED, + __('No posts selected. Unable to sync Future Actions.', 'post-expirator') + ); + + $this->notices->registerSuccessNotice( + self::NOTICE_SUCCESS, + __('Future Actions successfully synced with Post Metadata.', 'post-expirator') + ); + } + + public function filterBulkActions($actions) + { + $actions[self::BULK_ACTION_SYNC] = __('Update Future Actions from Post Metadata', 'post-expirator'); + + return $actions; + } + + private function getSelectedPostsFromRequest(): array + { + return array_filter( + $_REQUEST['post'] ?? [], // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + 'intval' + ); + } + + public function syncSchedulerWithPostMeta() + { + // phpcs:ignore WordPress.Security.NonceVerification.Recommended + if ( ! isset($_REQUEST['action']) || $_REQUEST['action'] !== self::BULK_ACTION_SYNC) { + return; + } + + $postIds = $this->getSelectedPostsFromRequest(); + + if (empty($postIds)) { + $this->notices->redirectShowingNotice(self::NOTICE_NO_POSTS_SELECTED); + } + + $expirablePostModelFactory = $this->expirablePostModelFactory; + foreach ($postIds as $postId) { + $postModel = $expirablePostModelFactory($postId); + + $postModel->syncScheduleWithPostMeta(); + } + + $this->notices->redirectShowingNotice(self::NOTICE_SUCCESS); + } +} diff --git a/src/Modules/Expirator/HooksAbstract.php b/src/Modules/Expirator/HooksAbstract.php index e4011c99b..a1081dab1 100644 --- a/src/Modules/Expirator/HooksAbstract.php +++ b/src/Modules/Expirator/HooksAbstract.php @@ -12,6 +12,7 @@ abstract class HooksAbstract const ACTION_INIT = 'init'; const ACTION_ADMIN_INIT = 'admin_init'; const ACTION_ADMIN_MENU = 'admin_menu'; + const ACTION_ADMIN_NOTICES = 'admin_notices'; const ACTION_REST_API_INIT = 'rest_api_init'; const ACTION_LEGACY_SCHEDULE = 'postexpirator_schedule'; const ACTION_LEGACY_UNSCHEDULE = 'postexpirator_unschedule'; @@ -43,7 +44,8 @@ abstract class HooksAbstract const FILTER_EXPIRATION_ACTIONS = 'publishpressfuture_expiration_actions'; const FILTER_EXPIRATION_ACTION_FACTORY = 'publishpressfuture_expiration_action_factory'; const FILTER_ACTION_SCHEDULER_LIST_COLUMN_HOOK = 'publishpressfuture_action_scheduler_column_hook'; - + const ACTION_SYNC_SCHEDULER_WITH_POST_META = 'admin_action_sync_scheduler_with_post_meta'; + const FILTER_BULK_ACTIONS_POST_EDIT = 'bulk_actions-edit-%s'; public static function getActionLegacyMultisiteDelete($blogId) { diff --git a/src/Modules/Expirator/Models/ExpirablePostModel.php b/src/Modules/Expirator/Models/ExpirablePostModel.php index a6ff52619..e9cb645c8 100644 --- a/src/Modules/Expirator/Models/ExpirablePostModel.php +++ b/src/Modules/Expirator/Models/ExpirablePostModel.php @@ -323,7 +323,7 @@ public function isExpirationEnabled() } catch (NonexistentPostException $e) { } - $this->expirationIsEnabled = $this->scheduler->postIsScheduled($this->postId); + $this->expirationIsEnabled = $this->scheduler->postIsScheduled($this->getPostId()); } return (bool)$this->expirationIsEnabled; @@ -404,6 +404,7 @@ public function expire($force = false) $args = $this->actionArgsModel->getArgs(); $args['post_title'] = $this->getTitle(); $args['post_type'] = $this->getPostType(); + $args['post_link'] = $this->getPermalink(); $this->actionArgsModel->setArgs($args); $this->actionArgsModel->save(); @@ -538,6 +539,21 @@ public function getTitle() return $title; } + public function getPermalink() + { + $permalink = parent::getPermalink(); + + if (empty($permalink)) { + $args = $this->actionArgsModel->getArgs(); + + if (! empty($args['post_link'])) { + $permalink = $args['post_link']; + } + } + + return $permalink; + } + /** * @param \PublishPress\Future\Modules\Expirator\Interfaces\ExpirationActionInterface $expirationAction @@ -747,4 +763,39 @@ public function deleteExpirationPostMeta() $this->deleteMeta(PostMetaAbstract::EXPIRATION_TIMESTAMP); $this->deleteMeta(PostMetaAbstract::EXPIRATION_DATE_OPTIONS); } + + /** + * This method will schedule/unschedule future actions for the post based + * on the future action data found in the post meta. If no post meta is + * found, the post will be unscheduled. + * + * But it will represent a limitation when we support multiple future actions + * scheduled for the same post. + * + * @return void + */ + public function syncScheduleWithPostMeta() + { + $timestampInPostMeta = $this->getMeta(PostMetaAbstract::EXPIRATION_TIMESTAMP, true); + $scheduledInPostMeta = ! empty($timestampInPostMeta) + && $this->getMeta(PostMetaAbstract::EXPIRATION_STATUS, true) === 'saved'; + $scheduled = $this->isExpirationEnabled(); + + if (! $scheduledInPostMeta && $scheduled) { + $this->scheduler->unschedule($this->getPostId()); + + return; + } + + if ($scheduledInPostMeta) { + $opts = [ + 'expireType' => $this->getMeta(PostMetaAbstract::EXPIRATION_TYPE, true), + 'id' => $this->getPostId(), + 'category' => $this->getMeta(PostMetaAbstract::EXPIRATION_TERMS, true), + 'categoryTaxonomy' => $this->getMeta(PostMetaAbstract::EXPIRATION_TAXONOMY, true) + ]; + + $this->scheduler->schedule($this->getPostId(), $timestampInPostMeta, $opts); + } + } } diff --git a/src/Modules/Expirator/Models/PostTypes.php b/src/Modules/Expirator/Models/PostTypes.php new file mode 100644 index 000000000..ac42a1942 --- /dev/null +++ b/src/Modules/Expirator/Models/PostTypes.php @@ -0,0 +1,37 @@ +settingsModelFactory = $container->get(ServicesAbstract::POST_TYPE_SETTINGS_MODEL_FACTORY); + } + + public function getActivatedPostTypes(): array + { + $settingsModelFactory = $this->settingsModelFactory; + $settingsModel = $settingsModelFactory(); + $settings = $settingsModel->getPostTypesSettings(); + + $activePostTypes = array_filter($settings, function ($postTypeSettings) { + return $postTypeSettings['active']; + }); + + return array_keys($activePostTypes); + } +} diff --git a/src/Modules/Expirator/Module.php b/src/Modules/Expirator/Module.php index 0382ee68d..a392462e8 100644 --- a/src/Modules/Expirator/Module.php +++ b/src/Modules/Expirator/Module.php @@ -9,8 +9,10 @@ use PublishPress\Future\Framework\InitializableInterface; use PublishPress\Future\Framework\ModuleInterface; use PublishPress\Future\Framework\WordPress\Facade\HooksFacade; +use PublishPress\Future\Framework\WordPress\Facade\NoticeFacade; use PublishPress\Future\Framework\WordPress\Facade\SanitizationFacade; use PublishPress\Future\Framework\WordPress\Facade\SiteFacade; +use PublishPress\Future\Modules\Expirator\Controllers\BulkActionController; use PublishPress\Future\Modules\Expirator\Controllers\BulkEditController; use PublishPress\Future\Modules\Expirator\Controllers\ExpirationController; use PublishPress\Future\Modules\Expirator\Controllers\ScheduledActionsController; @@ -81,6 +83,11 @@ class Module implements ModuleInterface */ private $settingsModelFactory; + /** + * @var \PublishPress\Future\Framework\WordPress\Facade\NoticeFacade + */ + private $noticesFacade; + public function __construct( $hooks, $site, @@ -92,7 +99,8 @@ public function __construct( $request, \Closure $actionArgsModelFactory, \Closure $scheduledActionsTableFactory, - \Closure $settingsModelFactory + \Closure $settingsModelFactory, + NoticeFacade $noticesFacade ) { $this->hooks = $hooks; $this->site = $site; @@ -105,10 +113,12 @@ public function __construct( $this->actionArgsModelFactory = $actionArgsModelFactory; $this->scheduledActionsTableFactory = $scheduledActionsTableFactory; $this->settingsModelFactory = $settingsModelFactory; + $this->noticesFacade = $noticesFacade; $this->controllers['expiration'] = $this->factoryExpirationController(); $this->controllers['bulk_edit'] = $this->factoryBulkEditController(); $this->controllers['scheduled_actions'] = $this->factoryScheduledActionsController(); + $this->controllers['bulk_action'] = $this->factoryBulkActionController(); } @@ -156,6 +166,18 @@ private function factoryScheduledActionsController() ); } + private function factoryBulkActionController() + { + return new BulkActionController( + $this->hooks, + $this->expirablePostModelFactory, + $this->sanitization, + $this->currentUserModelFactory, + $this->request, + $this->noticesFacade + ); + } + public function enqueueScripts() { $currentScreen = get_current_screen(); @@ -171,6 +193,12 @@ public function enqueueScripts() return; } + $currentUserModelFactory = $this->currentUserModelFactory; + $currentUserModel = $currentUserModelFactory(); + + if (! $currentUserModel->userCanExpirePosts()) { + return; + } wp_enqueue_script( 'publishpress-future-expirator', diff --git a/src/Modules/Settings/Controllers/Controller.php b/src/Modules/Settings/Controllers/Controller.php index f40b3922b..0674b8cff 100644 --- a/src/Modules/Settings/Controllers/Controller.php +++ b/src/Modules/Settings/Controllers/Controller.php @@ -78,14 +78,6 @@ public function __construct( public function initialize() { - $this->hooks->addAction( - CoreAbstractHooks::ACTION_ACTIVATE_PLUGIN, - [$this, 'onActionActivatePlugin'] - ); - $this->hooks->addAction( - CoreAbstractHooks::ACTION_DEACTIVATE_PLUGIN, - [$this, 'onActionDeactivatePlugin'] - ); $this->hooks->addFilter( SettingsHooksAbstract::FILTER_DEBUG_ENABLED, [$this, 'onFilterDebugEnabled'] @@ -101,7 +93,8 @@ public function initialize() ); $this->hooks->addAction( CoreAbstractHooks::ACTION_INIT, - [$this, 'initMigrations'] + [$this, 'initMigrations'], + 20 ); } diff --git a/src/Modules/Settings/SettingsFacade.php b/src/Modules/Settings/SettingsFacade.php index 9d36e8d32..7df195068 100644 --- a/src/Modules/Settings/SettingsFacade.php +++ b/src/Modules/Settings/SettingsFacade.php @@ -5,6 +5,7 @@ namespace PublishPress\Future\Modules\Settings; +use PublishPress\Future\Core\DI\Container; use PublishPress\Future\Core\DI\ServicesAbstract as Services; use PublishPress\Future\Core\HookableInterface; use PublishPress\Future\Framework\WordPress\Facade\OptionsFacade; @@ -69,22 +70,26 @@ public function deleteAllSettings() } } - public function setDefaultSettings() + // We can't use services from the container here because it is called before they are available, on plugin activation. + public static function setDefaultSettings() { $defaultValues = [ - 'expirationdateDefaultDateFormat' => $this->defaultData[Services::DEFAULT_DATE_FORMAT], - 'expirationdateDefaultTimeFormat' => $this->defaultData[Services::DEFAULT_TIME_FORMAT], - 'expirationdateFooterContents' => $this->defaultData[Services::DEFAULT_FOOTER_CONTENT], - 'expirationdateFooterStyle' => $this->defaultData[Services::DEFAULT_FOOTER_STYLE], - 'expirationdateDisplayFooter' => $this->defaultData[Services::DEFAULT_FOOTER_DISPLAY], - 'expirationdateDebug' => $this->defaultData[Services::DEFAULT_DEBUG], - 'expirationdateDefaultDate' => $this->defaultData[Services::DEFAULT_EXPIRATION_DATE], + 'expirationdateDefaultDateFormat' => __('l F jS, Y', 'post-expirator'), + 'expirationdateDefaultTimeFormat' => __('g:ia', 'post-expirator'), + 'expirationdateFooterContents' => __( + 'Post expires at EXPIRATIONTIME on ACTIONDATE', + 'post-expirator' + ), + 'expirationdateFooterStyle' => 'font-style: italic;', + 'expirationdateDisplayFooter' => '0', + 'expirationdateDebug' => '0', + 'expirationdateDefaultDate' => 'null', 'expirationdateGutenbergSupport' => 1, ]; foreach ($defaultValues as $optionName => $defaultValue) { - if ($this->options->getOption($optionName) === false) { - $this->options->updateOption($optionName, $defaultValue); + if (get_option($optionName) === false) { + update_option($optionName, $defaultValue); } } } diff --git a/src/Views/expire-column.php b/src/Views/expire-column.php index e44ae3d3a..0e4d1e262 100644 --- a/src/Views/expire-column.php +++ b/src/Views/expire-column.php @@ -28,7 +28,7 @@ $action = $postModel->getExpirationAction(); if (is_object($action)) { - ?>