Comments – wpDiscuz - Version 7.1.5

Version Description

Download this release

Release Info

Developer taron96
Plugin Icon 128x128 Comments – wpDiscuz
Version 7.1.5
Comparing to
See all releases

Code changes from version 7.1.4 to 7.1.5

class.WpdiscuzCore.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  * Plugin Name: wpDiscuz
4
  * Description: #1 WordPress Comment Plugin. Innovative, modern and feature-rich comment system to supercharge your website comment section.
5
- * Version: 7.1.4
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
  * Plugin URI: https://wpdiscuz.com/
2
  /*
3
  * Plugin Name: wpDiscuz
4
  * Description: #1 WordPress Comment Plugin. Innovative, modern and feature-rich comment system to supercharge your website comment section.
5
+ * Version: 7.1.5
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
  * Plugin URI: https://wpdiscuz.com/
includes/class.WpdiscuzDBManager.php CHANGED
@@ -1092,6 +1092,11 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
1092
  return $this->db->get_col($sql);
1093
  }
1094
 
 
 
 
 
 
1095
  /* === /Feedback Comments === */
1096
  /* === User Votes === */
1097
 
1092
  return $this->db->get_col($sql);
1093
  }
1094
 
1095
+ public function deleteFeedbackFormsForPost($post_id) {
1096
+ $sql = $this->db->prepare("DELETE FROM `{$this->feedbackForms}` WHERE `post_id` = %d", $post_id);
1097
+ $this->db->query($sql);
1098
+ }
1099
+
1100
  /* === /Feedback Comments === */
1101
  /* === User Votes === */
1102
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: gVectors Team
3
  Tags: comment, comments, ajax comments, comment form, comment fields
4
  Requires at least: 5.0
5
  Tested up to: 5.7
6
- Stable tag: 7.1.4
7
  Requires PHP: 5.4 and higher
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -179,6 +179,17 @@ Nothing will be lost! **Comments - wpDiscuz** will show all old comments.
179
 
180
  == Changelog ==
181
 
 
 
 
 
 
 
 
 
 
 
 
182
  = Comments - wpDiscuz v7.1.4 =
183
 
184
  * Added: WordPress 5.7 compatibility
@@ -189,11 +200,6 @@ Nothing will be lost! **Comments - wpDiscuz** will show all old comments.
189
  * Fixed Bug: wpDiscuz inline commenting and Block editor conflict
190
 
191
 
192
- **IMPORTANT!**
193
- 1. Please don't forget delete all caches and purge CDN after the update.
194
- 2. If you're updating from 5.x.x versions please read this topic: [https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/](https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/)
195
-
196
-
197
  = Comments - wpDiscuz v7.1.3 =
198
 
199
  * Updated: Better protection of AJAX requests
3
  Tags: comment, comments, ajax comments, comment form, comment fields
4
  Requires at least: 5.0
5
  Tested up to: 5.7
6
+ Stable tag: 7.1.5
7
  Requires PHP: 5.4 and higher
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
179
 
180
  == Changelog ==
181
 
182
+ = Comments - wpDiscuz v7.1.5 =
183
+
184
+ * Fixed Bug: Small issue with feedback forms
185
+ * Added: Removes post related feedback forms when post is deleted
186
+
187
+
188
+ **IMPORTANT!**
189
+ 1. Please don't forget delete all caches and purge CDN after the update.
190
+ 2. If you're updating from 5.x.x versions please read this topic: [https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/](https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/)
191
+
192
+
193
  = Comments - wpDiscuz v7.1.4 =
194
 
195
  * Added: WordPress 5.7 compatibility
200
  * Fixed Bug: wpDiscuz inline commenting and Block editor conflict
201
 
202
 
 
 
 
 
 
203
  = Comments - wpDiscuz v7.1.3 =
204
 
205
  * Updated: Better protection of AJAX requests
utils/class.WpdiscuzHelper.php CHANGED
@@ -835,27 +835,36 @@ class WpdiscuzHelper implements WpDiscuzConstants {
835
 
836
  public function checkFeedbackShortcodes($post_ID, $post_after, $post_before) {
837
  if (comments_open($post_ID) && ($form = $this->wpdiscuzForm->getForm($post_ID)) && $form->getFormID()) {
838
- preg_match_all(self::$inlineFormPattern, $post_before->post_content, $matchesBefore, PREG_SET_ORDER);
839
- preg_match_all(self::$inlineFormPattern, $post_after->post_content, $matchesAfter, PREG_SET_ORDER);
 
 
 
 
 
840
  if ($matchesAfter || $matchesBefore) {
841
  $inlineFormsBefore = [];
842
  $defaultAtts = ["id" => "", "question" => "", "opened" => 0, "content" => ""];
843
  foreach ($matchesBefore as $k => $matchBefore) {
844
- if (isset($matchBefore[3]) && preg_match_all(self::$inlineFormAttsPattern, $matchBefore[3], $attsBefore, PREG_SET_ORDER)) {
845
- $atts = [];
846
- foreach ($attsBefore as $k1 => $attrBefore) {
847
- $atts[$attrBefore[1]] = $attrBefore[2];
848
- }
849
- $atts = array_merge($defaultAtts, $atts);
850
- if (($atts["id"] = trim($atts["id"])) && ($atts["question"] = strip_tags($atts["question"]))) {
851
- $inlineFormsBefore[$atts["id"]] = ["question" => $atts["question"], "opened" => $atts["opened"], "content" => $matchBefore[5]];
852
- }
 
 
 
853
  }
854
  }
855
  foreach ($matchesAfter as $k => $matchAfter) {
856
  if (isset($matchAfter[3])) {
 
857
  if (function_exists("use_block_editor_for_post") && use_block_editor_for_post($post_ID)) {
858
- $matchAfter[3] = json_decode('"' . str_replace('\"', "'", addslashes($matchAfter[3])) . '"');
859
  }
860
  if (preg_match_all(self::$inlineFormAttsPattern, $matchAfter[3], $attsAfter, PREG_SET_ORDER)) {
861
  $atts = [];
835
 
836
  public function checkFeedbackShortcodes($post_ID, $post_after, $post_before) {
837
  if (comments_open($post_ID) && ($form = $this->wpdiscuzForm->getForm($post_ID)) && $form->getFormID()) {
838
+ preg_match_all(self::$inlineFormPattern, $post_before->post_content, $matchesBefore, PREG_SET_ORDER);
839
+ if ($post_after->post_content) {
840
+ preg_match_all(self::$inlineFormPattern, $post_after->post_content, $matchesAfter, PREG_SET_ORDER);
841
+ } else {
842
+ $matchesAfter = $matchesBefore;
843
+ $matchesBefore = [];
844
+ }
845
  if ($matchesAfter || $matchesBefore) {
846
  $inlineFormsBefore = [];
847
  $defaultAtts = ["id" => "", "question" => "", "opened" => 0, "content" => ""];
848
  foreach ($matchesBefore as $k => $matchBefore) {
849
+ if (isset($matchBefore[3])) {
850
+ $matchBefore[3] = str_replace('\"', "'", addslashes($matchBefore[3]));
851
+ if (preg_match_all(self::$inlineFormAttsPattern, $matchBefore[3], $attsBefore, PREG_SET_ORDER)) {
852
+ $atts = [];
853
+ foreach ($attsBefore as $k1 => $attrBefore) {
854
+ $atts[$attrBefore[1]] = $attrBefore[2];
855
+ }
856
+ $atts = array_merge($defaultAtts, $atts);
857
+ if (($atts["id"] = trim($atts["id"])) && ($atts["question"] = strip_tags($atts["question"]))) {
858
+ $inlineFormsBefore[$atts["id"]] = ["question" => $atts["question"], "opened" => $atts["opened"], "content" => $matchBefore[5]];
859
+ }
860
+ }
861
  }
862
  }
863
  foreach ($matchesAfter as $k => $matchAfter) {
864
  if (isset($matchAfter[3])) {
865
+ $matchAfter[3] = str_replace('\"', "'", addslashes($matchAfter[3]));
866
  if (function_exists("use_block_editor_for_post") && use_block_editor_for_post($post_ID)) {
867
+ $matchAfter[3] = json_decode('"' . $matchAfter[3] . '"');
868
  }
869
  if (preg_match_all(self::$inlineFormAttsPattern, $matchAfter[3], $attsAfter, PREG_SET_ORDER)) {
870
  $atts = [];
utils/class.WpdiscuzHelperOptimization.php CHANGED
@@ -20,7 +20,7 @@ class WpdiscuzHelperOptimization implements WpDiscuzConstants {
20
  add_action("admin_post_removeVoteData", [&$this, "removeVoteData"]);
21
  add_action("admin_post_resetPhrases", [&$this, "resetPhrases"]);
22
  add_action("transition_comment_status", [&$this, "statusEventHandler"], 10, 3);
23
- add_action("deleted_post", [&$this->dbManager, "removeRatings"], 10);
24
  add_action("wpdiscuz_clean_post_cache", [&$this, "cleanPostCache"]);
25
  add_action("wpdiscuz_clean_all_caches", [&$this, "cleanAllCaches"]);
26
  }
@@ -69,6 +69,11 @@ class WpdiscuzHelperOptimization implements WpDiscuzConstants {
69
  }
70
  }
71
 
 
 
 
 
 
72
  /**
73
  * get the current comment root comment
74
  *
20
  add_action("admin_post_removeVoteData", [&$this, "removeVoteData"]);
21
  add_action("admin_post_resetPhrases", [&$this, "resetPhrases"]);
22
  add_action("transition_comment_status", [&$this, "statusEventHandler"], 10, 3);
23
+ add_action("deleted_post", [&$this, "actionsOnDeletedPost"], 10);
24
  add_action("wpdiscuz_clean_post_cache", [&$this, "cleanPostCache"]);
25
  add_action("wpdiscuz_clean_all_caches", [&$this, "cleanAllCaches"]);
26
  }
69
  }
70
  }
71
 
72
+ public function actionsOnDeletedPost($post_id) {
73
+ $this->dbManager->removeRatings($post_id);
74
+ $this->dbManager->deleteFeedbackFormsForPost($post_id);
75
+ }
76
+
77
  /**
78
  * get the current comment root comment
79
  *