kk Star Ratings - Version 5.2.3

Version Description

Download this release

Release Info

Developer bhittani
Plugin Icon 128x128 kk Star Ratings
Version 5.2.3
Comparing to
See all releases

Code changes from version 5.2.2 to 5.2.3

CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
 
 
 
 
 
 
 
8
  ## [5.2.2] - 2021-11-07
9
 
10
  ### Fixed
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
 
8
+ ## [5.2.3] - 2021-11-14
9
+
10
+ ### Fixed
11
+ - Removed whitespaces in ajax responses when a vote is casted to fix refresh issues.
12
+ - Option value for a stack may be corrupted which is now ignored.
13
+
14
  ## [5.2.2] - 2021-11-07
15
 
16
  ### Fixed
index.php CHANGED
@@ -10,7 +10,7 @@
10
  * Author URI: http://bhittani.com
11
  * Text Domain: kk-star-ratings
12
  * Domain Path: /languages
13
- * Version: 5.2.2
14
  * License: GPLv2 or later
15
  */
16
 
10
  * Author URI: http://bhittani.com
11
  * Text Domain: kk-star-ratings
12
  * Domain Path: /languages
13
+ * Version: 5.2.3
14
  * License: GPLv2 or later
15
  */
16
 
languages/kk-star-ratings.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the kk Star Ratings plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: kk Star Ratings 5.2.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-11-07T14:52:24+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: kk-star-ratings\n"
2
  # This file is distributed under the same license as the kk Star Ratings plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: kk Star Ratings 5.2.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-11-14T09:55:26+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: kk-star-ratings\n"
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited
6
  Requires at least: 5.0
7
  Requires PHP: 7.2
8
  Tested up to: 5.8.1
9
- Stable tag: 5.2.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Requires at least: 5.0
7
  Requires PHP: 7.2
8
  Tested up to: 5.8.1
9
+ Stable tag: 5.2.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
src/classes/Stack.php CHANGED
@@ -11,6 +11,7 @@
11
 
12
  namespace Bhittani\StarRating\classes;
13
 
 
14
  use SplStack;
15
 
16
  class Stack extends SplStack
@@ -27,7 +28,11 @@ class Stack extends SplStack
27
  $this->storeKey = $storeKey;
28
 
29
  if ($serialized = $store($storeKey)) {
30
- $this->unserialize($serialized);
 
 
 
 
31
  }
32
  }
33
 
11
 
12
  namespace Bhittani\StarRating\classes;
13
 
14
+ use Exception;
15
  use SplStack;
16
 
17
  class Stack extends SplStack
28
  $this->storeKey = $storeKey;
29
 
30
  if ($serialized = $store($storeKey)) {
31
+ try {
32
+ $this->unserialize($serialized);
33
+ } catch (Exception $e) {
34
+ // Silently ignore.
35
+ }
36
  }
37
  }
38
 
src/core/public/js/kk-star-ratings.js CHANGED
@@ -79,7 +79,7 @@ jQuery(document).ready(function ($) {
79
  payload: $el.data("payload"),
80
  },
81
  function (response, status, xhr) {
82
- var $newEl = $(response);
83
  $newEl.addClass($el.attr("class"));
84
  $el.replaceWith($newEl);
85
  destroy();
79
  payload: $el.data("payload"),
80
  },
81
  function (response, status, xhr) {
82
+ var $newEl = $(response.trim());
83
  $newEl.addClass($el.attr("class"));
84
  $el.replaceWith($newEl);
85
  destroy();
src/core/public/js/kk-star-ratings.min.js CHANGED
@@ -2,4 +2,4 @@
2
  * kk Star Ratings
3
  * @see https://github.com/kamalkhan/kk-star-ratings
4
  */
5
- "use strict";jQuery(document).ready(function(s){function a(t,n){n=n||{isBusy:!1};function r(e){var i,o,c,u=s(this);i={rating:u.data("star"),payload:t.data("payload")},o=function(e,i,o){var c=s(e);c.addClass(t.attr("class")),t.replaceWith(c),s("[data-star]",t).each(function(){s(this).off("click",r)}),t.remove(),a(c,n)},c=function(s,a,t){s.responseJSON&&s.responseJSON.error&&console.error(s.responseJSON.error)},n.isBusy||t.hasClass("kksr-disabled")||(n.isBusy=!0,s.ajax({type:"POST",url:kk_star_ratings.endpoint,data:Object.assign({nonce:kk_star_ratings.nonce,action:kk_star_ratings.action},i),error:c,success:o,complete:function(){n.isBusy=!1}}))}s("[data-star]",t).each(function(){s(this).on("click",r)})}s(".kk-star-ratings").each(function(){a(s(this))})});
2
  * kk Star Ratings
3
  * @see https://github.com/kamalkhan/kk-star-ratings
4
  */
5
+ "use strict";jQuery(document).ready(function(s){function a(t,n){n=n||{isBusy:!1};function r(e){var i,o,c,u=s(this);i={rating:u.data("star"),payload:t.data("payload")},o=function(e,i,o){var c=s(e.trim());c.addClass(t.attr("class")),t.replaceWith(c),s("[data-star]",t).each(function(){s(this).off("click",r)}),t.remove(),a(c,n)},c=function(s,a,t){s.responseJSON&&s.responseJSON.error&&console.error(s.responseJSON.error)},n.isBusy||t.hasClass("kksr-disabled")||(n.isBusy=!0,s.ajax({type:"POST",url:kk_star_ratings.endpoint,data:Object.assign({nonce:kk_star_ratings.nonce,action:kk_star_ratings.action},i),error:c,success:o,complete:function(){n.isBusy=!1}}))}s("[data-star]",t).each(function(){s(this).on("click",r)})}s(".kk-star-ratings").each(function(){a(s(this))})});
src/core/wp/actions/wp_ajax_kk-star-ratings.php CHANGED
@@ -61,7 +61,7 @@ function wp_ajax_kk_star_ratings()
61
 
62
  unset($payload['count'], $payload['score']);
63
 
64
- $html = do_shortcode(to_shortcode(kksr('slug'), $payload));
65
 
66
  wp_die($html, 201);
67
  } catch (Exception $e) {
61
 
62
  unset($payload['count'], $payload['score']);
63
 
64
+ $html = trim(do_shortcode(to_shortcode(kksr('slug'), $payload)));
65
 
66
  wp_die($html, 201);
67
  } catch (Exception $e) {