Post Expirator - Version 2.7.3

Version Description

Download this release

Release Info

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

Code changes from version 2.7.2 to 2.7.3

classes/Display.class.php CHANGED
@@ -283,7 +283,7 @@ class PostExpirator_Display
283
  update_option('expirationdateEmailNotificationList', trim(sanitize_text_field($_POST['expired-email-notification-list'])));
284
  update_option(
285
  'expirationdateCategoryDefaults',
286
- isset($_POST['expirationdate_category']) ? sanitize_text_field($_POST['expirationdate_category']) : array()
287
  );
288
  update_option('expirationdateDefaultDate', sanitize_text_field($_POST['expired-default-expiration-date']));
289
  if (!empty($_POST['expired-custom-expiration-date'])) {
283
  update_option('expirationdateEmailNotificationList', trim(sanitize_text_field($_POST['expired-email-notification-list'])));
284
  update_option(
285
  'expirationdateCategoryDefaults',
286
+ isset($_POST['expirationdate_category']) ? PostExpirator_Util::sanitize_array_of_integers($_POST['expirationdate_category']) : []
287
  );
288
  update_option('expirationdateDefaultDate', sanitize_text_field($_POST['expired-default-expiration-date']));
289
  if (!empty($_POST['expired-custom-expiration-date'])) {
classes/Util.class.php CHANGED
@@ -78,4 +78,9 @@ class PostExpirator_Util
78
 
79
  return wp_date($format, $datetime->getTimestamp(), $timezone);
80
  }
 
 
 
 
 
81
  }
78
 
79
  return wp_date($format, $datetime->getTimestamp(), $timezone);
80
  }
81
+
82
+ public static function sanitize_array_of_integers($array)
83
+ {
84
+ return array_map('intval', (array)$array);
85
+ }
86
  }
composer.lock CHANGED
@@ -1045,16 +1045,16 @@
1045
  },
1046
  {
1047
  "name": "codeception/phpunit-wrapper",
1048
- "version": "9.0.6",
1049
  "source": {
1050
  "type": "git",
1051
  "url": "https://github.com/Codeception/phpunit-wrapper.git",
1052
- "reference": "b0c06abb3181eedca690170f7ed0fd26a70bfacc"
1053
  },
1054
  "dist": {
1055
  "type": "zip",
1056
- "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/b0c06abb3181eedca690170f7ed0fd26a70bfacc",
1057
- "reference": "b0c06abb3181eedca690170f7ed0fd26a70bfacc",
1058
  "shasum": ""
1059
  },
1060
  "require": {
@@ -1088,9 +1088,9 @@
1088
  "description": "PHPUnit classes used by Codeception",
1089
  "support": {
1090
  "issues": "https://github.com/Codeception/phpunit-wrapper/issues",
1091
- "source": "https://github.com/Codeception/phpunit-wrapper/tree/9.0.6"
1092
  },
1093
- "time": "2020-12-28T13:59:47+00:00"
1094
  },
1095
  {
1096
  "name": "codeception/stub",
@@ -9093,16 +9093,16 @@
9093
  },
9094
  {
9095
  "name": "theseer/fdomdocument",
9096
- "version": "1.6.6",
9097
  "source": {
9098
  "type": "git",
9099
  "url": "https://github.com/theseer/fDOMDocument.git",
9100
- "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca"
9101
  },
9102
  "dist": {
9103
  "type": "zip",
9104
- "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/6e8203e40a32a9c770bcb62fe37e68b948da6dca",
9105
- "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca",
9106
  "shasum": ""
9107
  },
9108
  "require": {
@@ -9110,6 +9110,9 @@
9110
  "lib-libxml": "*",
9111
  "php": ">=5.3.3"
9112
  },
 
 
 
9113
  "type": "library",
9114
  "autoload": {
9115
  "classmap": [
@@ -9131,9 +9134,9 @@
9131
  "homepage": "https://github.com/theseer/fDOMDocument",
9132
  "support": {
9133
  "issues": "https://github.com/theseer/fDOMDocument/issues",
9134
- "source": "https://github.com/theseer/fDOMDocument/tree/master"
9135
  },
9136
- "time": "2017-06-30T11:53:12+00:00"
9137
  },
9138
  {
9139
  "name": "theseer/tokenizer",
@@ -9698,21 +9701,21 @@
9698
  },
9699
  {
9700
  "name": "wp-cli/wp-cli",
9701
- "version": "v2.5.0",
9702
  "source": {
9703
  "type": "git",
9704
  "url": "https://github.com/wp-cli/wp-cli.git",
9705
- "reference": "0bcf0c54f4d35685211d435e25219cc7acbe6d48"
9706
  },
9707
  "dist": {
9708
  "type": "zip",
9709
- "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/0bcf0c54f4d35685211d435e25219cc7acbe6d48",
9710
- "reference": "0bcf0c54f4d35685211d435e25219cc7acbe6d48",
9711
  "shasum": ""
9712
  },
9713
  "require": {
9714
  "ext-curl": "*",
9715
- "mustache/mustache": "~2.13",
9716
  "php": "^5.6 || ^7.0 || ^8.0",
9717
  "rmccue/requests": "^1.8",
9718
  "symfony/finder": ">2.7",
@@ -9720,12 +9723,12 @@
9720
  "wp-cli/php-cli-tools": "~0.11.2"
9721
  },
9722
  "require-dev": {
9723
- "roave/security-advisories": "dev-master",
9724
  "wp-cli/db-command": "^1.3 || ^2",
9725
  "wp-cli/entity-command": "^1.2 || ^2",
9726
  "wp-cli/extension-command": "^1.1 || ^2",
9727
  "wp-cli/package-command": "^1 || ^2",
9728
- "wp-cli/wp-cli-tests": "^3.0.7"
9729
  },
9730
  "suggest": {
9731
  "ext-readline": "Include for a better --prompt implementation",
@@ -9738,7 +9741,7 @@
9738
  "type": "library",
9739
  "extra": {
9740
  "branch-alias": {
9741
- "dev-master": "2.5.x-dev"
9742
  }
9743
  },
9744
  "autoload": {
@@ -9765,7 +9768,7 @@
9765
  "issues": "https://github.com/wp-cli/wp-cli/issues",
9766
  "source": "https://github.com/wp-cli/wp-cli"
9767
  },
9768
- "time": "2021-05-14T13:44:51+00:00"
9769
  },
9770
  {
9771
  "name": "wp-coding-standards/wpcs",
1045
  },
1046
  {
1047
  "name": "codeception/phpunit-wrapper",
1048
+ "version": "9.0.7",
1049
  "source": {
1050
  "type": "git",
1051
  "url": "https://github.com/Codeception/phpunit-wrapper.git",
1052
+ "reference": "7d6b1a5ea4ed28d010e5d36b993db813eb49710b"
1053
  },
1054
  "dist": {
1055
  "type": "zip",
1056
+ "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/7d6b1a5ea4ed28d010e5d36b993db813eb49710b",
1057
+ "reference": "7d6b1a5ea4ed28d010e5d36b993db813eb49710b",
1058
  "shasum": ""
1059
  },
1060
  "require": {
1088
  "description": "PHPUnit classes used by Codeception",
1089
  "support": {
1090
  "issues": "https://github.com/Codeception/phpunit-wrapper/issues",
1091
+ "source": "https://github.com/Codeception/phpunit-wrapper/tree/9.0.7"
1092
  },
1093
+ "time": "2022-01-26T14:43:10+00:00"
1094
  },
1095
  {
1096
  "name": "codeception/stub",
9093
  },
9094
  {
9095
  "name": "theseer/fdomdocument",
9096
+ "version": "1.6.7",
9097
  "source": {
9098
  "type": "git",
9099
  "url": "https://github.com/theseer/fDOMDocument.git",
9100
+ "reference": "5cddd4f9076a9a2b85c5135935bba2dcb3ed7574"
9101
  },
9102
  "dist": {
9103
  "type": "zip",
9104
+ "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/5cddd4f9076a9a2b85c5135935bba2dcb3ed7574",
9105
+ "reference": "5cddd4f9076a9a2b85c5135935bba2dcb3ed7574",
9106
  "shasum": ""
9107
  },
9108
  "require": {
9110
  "lib-libxml": "*",
9111
  "php": ">=5.3.3"
9112
  },
9113
+ "require-dev": {
9114
+ "php": ">=7.3"
9115
+ },
9116
  "type": "library",
9117
  "autoload": {
9118
  "classmap": [
9134
  "homepage": "https://github.com/theseer/fDOMDocument",
9135
  "support": {
9136
  "issues": "https://github.com/theseer/fDOMDocument/issues",
9137
+ "source": "https://github.com/theseer/fDOMDocument/tree/1.6.7"
9138
  },
9139
+ "time": "2022-01-25T23:10:35+00:00"
9140
  },
9141
  {
9142
  "name": "theseer/tokenizer",
9701
  },
9702
  {
9703
  "name": "wp-cli/wp-cli",
9704
+ "version": "v2.6.0",
9705
  "source": {
9706
  "type": "git",
9707
  "url": "https://github.com/wp-cli/wp-cli.git",
9708
+ "reference": "dee13c2baf6bf972484a63f8b8dab48f7220f095"
9709
  },
9710
  "dist": {
9711
  "type": "zip",
9712
+ "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/dee13c2baf6bf972484a63f8b8dab48f7220f095",
9713
+ "reference": "dee13c2baf6bf972484a63f8b8dab48f7220f095",
9714
  "shasum": ""
9715
  },
9716
  "require": {
9717
  "ext-curl": "*",
9718
+ "mustache/mustache": "^2.14.1",
9719
  "php": "^5.6 || ^7.0 || ^8.0",
9720
  "rmccue/requests": "^1.8",
9721
  "symfony/finder": ">2.7",
9723
  "wp-cli/php-cli-tools": "~0.11.2"
9724
  },
9725
  "require-dev": {
9726
+ "roave/security-advisories": "dev-latest",
9727
  "wp-cli/db-command": "^1.3 || ^2",
9728
  "wp-cli/entity-command": "^1.2 || ^2",
9729
  "wp-cli/extension-command": "^1.1 || ^2",
9730
  "wp-cli/package-command": "^1 || ^2",
9731
+ "wp-cli/wp-cli-tests": "^3.1.3"
9732
  },
9733
  "suggest": {
9734
  "ext-readline": "Include for a better --prompt implementation",
9741
  "type": "library",
9742
  "extra": {
9743
  "branch-alias": {
9744
+ "dev-master": "2.6.x-dev"
9745
  }
9746
  },
9747
  "autoload": {
9768
  "issues": "https://github.com/wp-cli/wp-cli/issues",
9769
  "source": "https://github.com/wp-cli/wp-cli"
9770
  },
9771
+ "time": "2022-01-25T16:31:27+00:00"
9772
  },
9773
  {
9774
  "name": "wp-coding-standards/wpcs",
post-expirator.php CHANGED
@@ -4,14 +4,14 @@
4
  * Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
  * Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
6
  * Author: PublishPress
7
- * Version: 2.7.2
8
  * Author URI: http://publishpress.com
9
  * Text Domain: post-expirator
10
  * Domain Path: /languages
11
  */
12
 
13
  // Default Values
14
- define('POSTEXPIRATOR_VERSION', '2.7.2');
15
  define('POSTEXPIRATOR_DATEFORMAT', __('l F jS, Y', 'post-expirator'));
16
  define('POSTEXPIRATOR_TIMEFORMAT', __('g:ia', 'post-expirator'));
17
  define('POSTEXPIRATOR_FOOTERCONTENTS', __('Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator'));
@@ -582,7 +582,8 @@ function postexpirator_update_post_meta($id)
582
  $year = date('Y');
583
  }
584
  }
585
- $category = isset($_POST['expirationdate_category']) ? sanitize_text_field($_POST['expirationdate_category']) : 0;
 
586
 
587
  $ts = get_gmt_from_date("$year-$month-$day $hour:$minute:0", 'U');
588
 
@@ -595,7 +596,7 @@ function postexpirator_update_post_meta($id)
595
  'category-add',
596
  'category-remove'
597
  ), true)) {
598
- $opts['category'] = sanitize_text_field($_POST['expirationdate_category']);
599
  }
600
  }
601
  } else {
@@ -605,10 +606,8 @@ function postexpirator_update_post_meta($id)
605
 
606
  if ($opts['expireType'] === 'category' || $opts['expireType'] === 'category-add' || $opts['expireType'] === 'category-remove') {
607
  if (isset($category) && ! empty($category)) {
608
- if (! empty($category)) {
609
- $opts['category'] = $category;
610
- $opts['categoryTaxonomy'] = sanitize_text_field($_POST['taxonomy-heirarchical']);
611
- }
612
  }
613
  }
614
  }
@@ -655,7 +654,7 @@ function postexpirator_update_post_meta($id)
655
  }
656
 
657
  if (isset($payload['meta']['_expiration-date-categories'])) {
658
- $opts['category'] = array_map('intval', (array)$payload['meta']['_expiration-date-categories']);
659
  } else {
660
  $opts['category'] = (array)get_post_meta($id, '_expiration-date-categories', true);
661
  }
@@ -1050,7 +1049,7 @@ function postexpirator_expire_post($id)
1050
  $postWasExpired = true;
1051
  }
1052
  } else {
1053
- $terms = array_map('intval', $expireCategory);
1054
  if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, false))) {
1055
  if (POSTEXPIRATOR_DEBUG) {
1056
  $debug->save(
@@ -1155,7 +1154,7 @@ function postexpirator_expire_post($id)
1155
  $postWasExpired = true;
1156
  }
1157
  } else {
1158
- $terms = array_map('intval', $expireCategory);
1159
  if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, true))) {
1160
  if (POSTEXPIRATOR_DEBUG) {
1161
  $debug->save(
@@ -1274,7 +1273,7 @@ function postexpirator_expire_post($id)
1274
  $mergedCategories[] = $term;
1275
  }
1276
  }
1277
- $terms = array_map('intval', $mergedCategories);
1278
  if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, false))) {
1279
  if (POSTEXPIRATOR_DEBUG) {
1280
  $debug->save(
@@ -2100,7 +2099,8 @@ function postexpirator_date_save_bulk_edit()
2100
  }
2101
 
2102
  // we need the post IDs
2103
- $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? array_map('intval', $_POST['post_ids']) : null;
 
2104
 
2105
  // if we have post IDs
2106
  if (! empty($post_ids) && is_array($post_ids)) {
@@ -2147,7 +2147,7 @@ function postexpirator_date_save_bulk_edit()
2147
  $opts['expireType'] = sanitize_key($_POST['expirationdate_expiretype']);
2148
 
2149
  if (in_array($opts['expireType'], array('category', 'category-add', 'category-remove'), true)) {
2150
- $opts['category'] = sanitize_text_field($_POST['expirationdate_category']);
2151
  }
2152
 
2153
  PostExpirator_Facade::set_expire_principles($post_id, $opts);
4
  * Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
  * Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
6
  * Author: PublishPress
7
+ * Version: 2.7.3
8
  * Author URI: http://publishpress.com
9
  * Text Domain: post-expirator
10
  * Domain Path: /languages
11
  */
12
 
13
  // Default Values
14
+ define('POSTEXPIRATOR_VERSION', '2.7.3');
15
  define('POSTEXPIRATOR_DATEFORMAT', __('l F jS, Y', 'post-expirator'));
16
  define('POSTEXPIRATOR_TIMEFORMAT', __('g:ia', 'post-expirator'));
17
  define('POSTEXPIRATOR_FOOTERCONTENTS', __('Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator'));
582
  $year = date('Y');
583
  }
584
  }
585
+ $category = isset($_POST['expirationdate_category'])
586
+ ? PostExpirator_Util::sanitize_array_of_integers($_POST['expirationdate_category']) : [];
587
 
588
  $ts = get_gmt_from_date("$year-$month-$day $hour:$minute:0", 'U');
589
 
596
  'category-add',
597
  'category-remove'
598
  ), true)) {
599
+ $opts['category'] = $category;
600
  }
601
  }
602
  } else {
606
 
607
  if ($opts['expireType'] === 'category' || $opts['expireType'] === 'category-add' || $opts['expireType'] === 'category-remove') {
608
  if (isset($category) && ! empty($category)) {
609
+ $opts['category'] = $category;
610
+ $opts['categoryTaxonomy'] = sanitize_text_field($_POST['taxonomy-heirarchical']);
 
 
611
  }
612
  }
613
  }
654
  }
655
 
656
  if (isset($payload['meta']['_expiration-date-categories'])) {
657
+ $opts['category'] = PostExpirator_Util::sanitize_array_of_integers($payload['meta']['_expiration-date-categories']);
658
  } else {
659
  $opts['category'] = (array)get_post_meta($id, '_expiration-date-categories', true);
660
  }
1049
  $postWasExpired = true;
1050
  }
1051
  } else {
1052
+ $terms = PostExpirator_Util::sanitize_array_of_integers($expireCategory);
1053
  if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, false))) {
1054
  if (POSTEXPIRATOR_DEBUG) {
1055
  $debug->save(
1154
  $postWasExpired = true;
1155
  }
1156
  } else {
1157
+ $terms = PostExpirator_Util::sanitize_array_of_integers($expireCategory);
1158
  if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, true))) {
1159
  if (POSTEXPIRATOR_DEBUG) {
1160
  $debug->save(
1273
  $mergedCategories[] = $term;
1274
  }
1275
  }
1276
+ $terms = PostExpirator_Util::sanitize_array_of_integers($mergedCategories);
1277
  if (is_wp_error(wp_set_object_terms($id, $terms, $expireCategoryTaxonomy, false))) {
1278
  if (POSTEXPIRATOR_DEBUG) {
1279
  $debug->save(
2099
  }
2100
 
2101
  // we need the post IDs
2102
+ $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids']))
2103
+ ? PostExpirator_Util::sanitize_array_of_integers($_POST['post_ids']) : null;
2104
 
2105
  // if we have post IDs
2106
  if (! empty($post_ids) && is_array($post_ids)) {
2147
  $opts['expireType'] = sanitize_key($_POST['expirationdate_expiretype']);
2148
 
2149
  if (in_array($opts['expireType'], array('category', 'category-add', 'category-remove'), true)) {
2150
+ $opts['category'] = PostExpirator_Util::sanitize_array_of_integers($_POST['expirationdate_category']);
2151
  }
2152
 
2153
  PostExpirator_Facade::set_expire_principles($post_id, $opts);
readme.txt CHANGED
@@ -4,8 +4,8 @@ Author: publishpress
4
  Author URI: https://publishpress.com
5
  Tags: expire, posts, pages, schedule
6
  Requires at least: 5.3
7
- Tested up to: 5.9
8
- Stable tag: 2.7.2
9
 
10
  Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
11
 
@@ -81,6 +81,10 @@ This section describes how to install the plugin and get it working.
81
 
82
  == Changelog ==
83
 
 
 
 
 
84
  = [2.7.2] - 25 Jan 2022 =
85
 
86
  * Changed: Added more clear debug message if the cron event was not scheduled due to an error;
4
  Author URI: https://publishpress.com
5
  Tags: expire, posts, pages, schedule
6
  Requires at least: 5.3
7
+ Tested up to: 6.0
8
+ Stable tag: 2.7.3
9
 
10
  Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
11
 
81
 
82
  == Changelog ==
83
 
84
+ = [2.7.3] - 27 Jan 2022 =
85
+
86
+ * Fixed: Fix the selection of categories when setting a post to expire, #220;
87
+
88
  = [2.7.2] - 25 Jan 2022 =
89
 
90
  * Changed: Added more clear debug message if the cron event was not scheduled due to an error;
vendor/composer/installed.php CHANGED
@@ -5,7 +5,7 @@
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => '4ab57aa3db2408590485ab6e879694d6f460c13d',
9
  'name' => 'publishpress/post-expirator',
10
  'dev' => false,
11
  ),
@@ -16,7 +16,7 @@
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => '4ab57aa3db2408590485ab6e879694d6f460c13d',
20
  'dev_requirement' => false,
21
  ),
22
  'publishpress/wordpress-reviews' => array(
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '0749d5c92b13577798d9c1bcbc30cef8a8c03c86',
9
  'name' => 'publishpress/post-expirator',
10
  'dev' => false,
11
  ),
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => '0749d5c92b13577798d9c1bcbc30cef8a8c03c86',
20
  'dev_requirement' => false,
21
  ),
22
  'publishpress/wordpress-reviews' => array(