kk Star Ratings - Version 5.3.3

Version Description

Download this release

Release Info

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

Code changes from version 5.3.2 to 5.3.3

CHANGELOG.md CHANGED
@@ -5,157 +5,194 @@ 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.3.2] - 2022-08-10
9
 
10
  ### Added
11
- - Added ability to ignore shortcode using the `ignore` property.
 
12
 
13
  ### Updated
14
- - Bumped WordPress version (6.0.1).
 
15
 
16
  ## [5.3.1] - 2022-07-08
17
 
18
  ### Fixed
19
- - Backwards compatibility of `kksr_rate` and `kksr_vote` action hook.
20
- - Refactored the way fingerprint (IP Address) is calculated.
21
- - View templates now respect a view slug.
22
- - Shortcode now accepts a custom class attribute.
23
- - Touched CSS styles.
 
24
 
25
  ## [5.3.0] - 2022-05-26
26
 
27
  ### Added
28
- - Introduced the concept of addons.
 
29
 
30
  ### Updated
31
- - The plugin `init` action is now called as soon as the plugin is loaded instead of the `plugins_loaded` WordPress action.
32
- - Bumped WordPress version (6.0).
 
33
 
34
  ## [5.2.11] - 2022-05-21
35
 
36
  ### Fixed
37
- - Typo in `upgrader_process_complete` hook was fixed.
 
38
 
39
  ## [5.2.10] - 2022-05-07
40
 
41
  ### Fixed
42
- - The text domain files in the languages directory were not being loaded. (Fixes issue #120).
 
43
 
44
  ## [5.2.9] - 2022-02-24
45
 
46
  ### Updated
47
- - Bumped freemius SDK version to v2.4.3.
48
- - Tested upto v5.9.1.
 
49
 
50
  ### Fixed
51
- - Security fix.
 
52
 
53
  ## [5.2.8] - 2022-02-08
54
 
55
  ### Fixed
56
- - The priority for `the_content` filter has been set back to 10 to avoid issues with elementor.
 
57
 
58
  ## [5.2.7] - 2022-02-07
59
 
60
  ### Fixed
61
- - Checks for `get_the_ID()` before falling back to query vars.
 
62
 
63
  ## [5.2.6] - 2022-01-27
64
 
65
  ### Updated
66
- - jQuery is no more required.
 
67
 
68
  ## [5.2.5] - 2022-01-22
69
 
70
  ### Added
71
- - Support for custom rich snippets (ld_json) with binding.
72
- - Support for Gutenberg blocks using hooks.
73
- - Url and path utility functions.
 
74
 
75
  ### Fixed
76
- - The prefix function logic has been corrected.
 
77
 
78
  ## [5.2.4] - 2021-11-22
79
 
80
  ### Fixed
81
- - Removed unwanted html markup that caused errors.
 
82
 
83
  ## [5.2.3] - 2021-11-14
84
 
85
  ### Fixed
86
- - Removed whitespaces in ajax responses when a vote is casted to fix refresh issues.
87
- - Option value for a stack may be corrupted which is now ignored.
 
88
 
89
  ## [5.2.2] - 2021-11-07
90
 
91
  ### Fixed
92
- - Not enough arguments error that occured sometimes during `the_post` action hook has been fixed by marking the second argument as optional.
 
93
 
94
  ## [5.2.1] - 2021-11-06
95
 
96
  ### Fixed
97
- - Unique voting issue due to previous changes is now fixed.
 
98
 
99
  ## [5.2.0] - 2021-11-02
100
 
101
  ### Updated
102
- - Deprecated the use of migrations in favor of migrating posts when accessed.
 
103
 
104
  ## [5.1.4] - 2021-11-01
105
 
106
  ### Updated
107
- - Migrate 5 posts instead of 20 per batch.
 
108
 
109
  ### Fixed
110
- - Migrations for the same version were duplicated.
 
111
 
112
  ## [5.1.3] - 2021-11-01
113
 
114
  ### Updated
115
- - Migrate 20 posts instead of 50 per batch.
 
116
 
117
  ### Fixed
118
- - Migrations were not being processed continuously due to a javascript bug.
 
119
 
120
  ## [5.1.2] - 2021-11-01
121
 
122
  ### Fixed
123
- - Migrations now correctly run in the background when the frontend is open.
 
124
 
125
  ## [5.1.1] - 2021-11-01
126
 
127
  ### Updated
128
- - More detailed information is now displayed in `pending migrations` notice.
 
129
 
130
  ## [5.1.0] - 2021-10-31
131
 
132
  ### Added
133
- - Batched migrations. Posts are now migrated in batches in the background.
 
134
 
135
  ### Fixed
136
- - Bumped template code priority.
137
 
 
138
 
139
  ## [5.0.3] - 2021-10-11
140
 
141
  ### Updated
142
- - Freemius sdk upgraded to 2.4.2
 
143
 
144
  ### Fixed
145
- - Enforce casting of post id to int when calculating for meta box.
146
- - Disallowed check for regex expression when using find() in order to supress warning in PHP 8.
 
147
 
148
  ## [5.0.2] - 2021-10-11
149
 
150
  ### Fixed
151
- - Force legend to the default in order to override dangling v2 legend.
 
152
 
153
  ## [5.0.1] - 2021-10-10
154
 
155
  ### Fixed
156
- - Activation would not be executed when upgrading via wp org. Fixed by activating after plugin is loaded.
 
157
 
158
  ## [5.0.0] - 2021-10-09
159
 
160
  ### Release
161
- - Fresh codebase
 
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.3.3] - 2022-09-03
9
+
10
+ ### Fixed
11
+
12
+ - Shortcode was being auto-embedded in excerpts. Not the case anymore.
13
+
14
  ## [5.3.2] - 2022-08-10
15
 
16
  ### Added
17
+
18
+ - Added ability to ignore shortcode using the `ignore` property.
19
 
20
  ### Updated
21
+
22
+ - Bumped WordPress version (6.0.1).
23
 
24
  ## [5.3.1] - 2022-07-08
25
 
26
  ### Fixed
27
+
28
+ - Backwards compatibility of `kksr_rate` and `kksr_vote` action hook.
29
+ - Refactored the way fingerprint (IP Address) is calculated.
30
+ - View templates now respect a view slug.
31
+ - Shortcode now accepts a custom class attribute.
32
+ - Touched CSS styles.
33
 
34
  ## [5.3.0] - 2022-05-26
35
 
36
  ### Added
37
+
38
+ - Introduced the concept of addons.
39
 
40
  ### Updated
41
+
42
+ - The plugin `init` action is now called as soon as the plugin is loaded instead of the `plugins_loaded` WordPress action.
43
+ - Bumped WordPress version (6.0).
44
 
45
  ## [5.2.11] - 2022-05-21
46
 
47
  ### Fixed
48
+
49
+ - Typo in `upgrader_process_complete` hook was fixed.
50
 
51
  ## [5.2.10] - 2022-05-07
52
 
53
  ### Fixed
54
+
55
+ - The text domain files in the languages directory were not being loaded. (Fixes issue #120).
56
 
57
  ## [5.2.9] - 2022-02-24
58
 
59
  ### Updated
60
+
61
+ - Bumped freemius SDK version to v2.4.3.
62
+ - Tested upto v5.9.1.
63
 
64
  ### Fixed
65
+
66
+ - Security fix.
67
 
68
  ## [5.2.8] - 2022-02-08
69
 
70
  ### Fixed
71
+
72
+ - The priority for `the_content` filter has been set back to 10 to avoid issues with elementor.
73
 
74
  ## [5.2.7] - 2022-02-07
75
 
76
  ### Fixed
77
+
78
+ - Checks for `get_the_ID()` before falling back to query vars.
79
 
80
  ## [5.2.6] - 2022-01-27
81
 
82
  ### Updated
83
+
84
+ - jQuery is no more required.
85
 
86
  ## [5.2.5] - 2022-01-22
87
 
88
  ### Added
89
+
90
+ - Support for custom rich snippets (ld_json) with binding.
91
+ - Support for Gutenberg blocks using hooks.
92
+ - Url and path utility functions.
93
 
94
  ### Fixed
95
+
96
+ - The prefix function logic has been corrected.
97
 
98
  ## [5.2.4] - 2021-11-22
99
 
100
  ### Fixed
101
+
102
+ - Removed unwanted html markup that caused errors.
103
 
104
  ## [5.2.3] - 2021-11-14
105
 
106
  ### Fixed
107
+
108
+ - Removed whitespaces in ajax responses when a vote is casted to fix refresh issues.
109
+ - Option value for a stack may be corrupted which is now ignored.
110
 
111
  ## [5.2.2] - 2021-11-07
112
 
113
  ### Fixed
114
+
115
+ - Not enough arguments error that occured sometimes during `the_post` action hook has been fixed by marking the second argument as optional.
116
 
117
  ## [5.2.1] - 2021-11-06
118
 
119
  ### Fixed
120
+
121
+ - Unique voting issue due to previous changes is now fixed.
122
 
123
  ## [5.2.0] - 2021-11-02
124
 
125
  ### Updated
126
+
127
+ - Deprecated the use of migrations in favor of migrating posts when accessed.
128
 
129
  ## [5.1.4] - 2021-11-01
130
 
131
  ### Updated
132
+
133
+ - Migrate 5 posts instead of 20 per batch.
134
 
135
  ### Fixed
136
+
137
+ - Migrations for the same version were duplicated.
138
 
139
  ## [5.1.3] - 2021-11-01
140
 
141
  ### Updated
142
+
143
+ - Migrate 20 posts instead of 50 per batch.
144
 
145
  ### Fixed
146
+
147
+ - Migrations were not being processed continuously due to a javascript bug.
148
 
149
  ## [5.1.2] - 2021-11-01
150
 
151
  ### Fixed
152
+
153
+ - Migrations now correctly run in the background when the frontend is open.
154
 
155
  ## [5.1.1] - 2021-11-01
156
 
157
  ### Updated
158
+
159
+ - More detailed information is now displayed in `pending migrations` notice.
160
 
161
  ## [5.1.0] - 2021-10-31
162
 
163
  ### Added
164
+
165
+ - Batched migrations. Posts are now migrated in batches in the background.
166
 
167
  ### Fixed
 
168
 
169
+ - Bumped template code priority.
170
 
171
  ## [5.0.3] - 2021-10-11
172
 
173
  ### Updated
174
+
175
+ - Freemius sdk upgraded to 2.4.2
176
 
177
  ### Fixed
178
+
179
+ - Enforce casting of post id to int when calculating for meta box.
180
+ - Disallowed check for regex expression when using find() in order to supress warning in PHP 8.
181
 
182
  ## [5.0.2] - 2021-10-11
183
 
184
  ### Fixed
185
+
186
+ - Force legend to the default in order to override dangling v2 legend.
187
 
188
  ## [5.0.1] - 2021-10-10
189
 
190
  ### Fixed
191
+
192
+ - Activation would not be executed when upgrading via wp org. Fixed by activating after plugin is loaded.
193
 
194
  ## [5.0.0] - 2021-10-09
195
 
196
  ### Release
197
+
198
+ - Fresh codebase
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.3.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.3.3
14
  * License: GPLv2 or later
15
  */
16
 
languages/kk-star-ratings.pot CHANGED
@@ -1,17 +1,17 @@
1
  # Copyright (C) 2022 Kamal Khan
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.3.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: 2022-08-10T10:44:16+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"
16
 
17
  #. Plugin Name of the plugin
1
  # Copyright (C) 2022 Kamal Khan
2
+ # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: kk Star Ratings 5.3.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: 2022-10-03T10:49:51+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: kk-star-ratings\n"
16
 
17
  #. Plugin Name of the plugin
readme.txt CHANGED
@@ -5,8 +5,8 @@ Donate link: https://github.com/kamalkhan/kk-star-ratings
5
  Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited stars, google rich snippets, structured data, SEO, SERP
6
  Requires at least: 5.0
7
  Requires PHP: 7.2
8
- Tested up to: 6.0.1
9
- Stable tag: 5.3.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -27,33 +27,33 @@ This plugin has been renewed from the ground up as of v5.
27
 
28
  kk Star Ratings is a widely used star rating plugin for wordpress. Here are some highlighted features:
29
 
30
- - User defined amount of star ratings (5 as default) in your **posts**, **pages** and publicly accesible **custom post types**.
31
 
32
- - Structured data supporting **google rich snippets** showing the star ratings in search results which has the potential to drive more traffic to your website.
33
 
34
- - Widespread coverage of custom hooks.
35
 
36
- - Full control via options page. You can,
37
 
38
- - Enable or disable globally.
39
-
40
- - Disable star ratings in posts that belong to certain categories.
41
 
42
- - Choose where to show the star ratings. It can be on the **homepage**, in **archives**, in **posts**, in **pages** and/or in **custom post types**.
43
 
44
- - Control the structured data schema and type.
45
 
46
- - Restrict votings per unique ip.
47
 
48
- - Allow voting in archives.
49
 
50
- - Allow guests to vote.
51
 
52
- - Customize position within the post content.
53
 
54
- - Adjust the amount of stars.
55
-
56
- - And much more...
 
 
57
 
58
 
59
  == Installation ==
@@ -64,6 +64,7 @@ kk Star Ratings is a widely used star rating plugin for wordpress. Here are some
64
 
65
 
66
 
 
67
  1. Extract the plugin zip file.
68
  1. Upload/move the folder `kk-star-ratings` to the `wp-content/plugins` directory.
69
  1. Activate the plugin via the wordpress plugins dashboard page.
5
  Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited stars, google rich snippets, structured data, SEO, SERP
6
  Requires at least: 5.0
7
  Requires PHP: 7.2
8
+ Tested up to: 6.0
9
+ Stable tag: 5.3.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
27
 
28
  kk Star Ratings is a widely used star rating plugin for wordpress. Here are some highlighted features:
29
 
30
+ - User defined amount of star ratings (5 as default) in your **posts**, **pages** and publicly accesible **custom post types**.
31
 
32
+ - Structured data supporting **google rich snippets** showing the star ratings in search results which has the potential to drive more traffic to your website.
33
 
34
+ - Widespread coverage of custom hooks.
35
 
36
+ - Full control via options page. You can,
37
 
38
+ - Enable or disable globally.
 
 
39
 
40
+ - Disable star ratings in posts that belong to certain categories.
41
 
42
+ - Choose where to show the star ratings. It can be on the **homepage**, in **archives**, in **posts**, in **pages** and/or in **custom post types**.
43
 
44
+ - Control the structured data schema and type.
45
 
46
+ - Restrict votings per unique ip.
47
 
48
+ - Allow voting in archives.
49
 
50
+ - Allow guests to vote.
51
 
52
+ - Customize position within the post content.
53
+
54
+ - Adjust the amount of stars.
55
+
56
+ - And much more...
57
 
58
 
59
  == Installation ==
64
 
65
 
66
 
67
+
68
  1. Extract the plugin zip file.
69
  1. Upload/move the folder `kk-star-ratings` to the `wp-content/plugins` directory.
70
  1. Activate the plugin via the wordpress plugins dashboard page.
src/core/filters/embed.php CHANGED
@@ -11,6 +11,8 @@
11
 
12
  namespace Bhittani\StarRating\core\filters;
13
 
 
 
14
  if (! defined('KK_STAR_RATINGS')) {
15
  http_response_code(404);
16
  exit();
@@ -23,6 +25,10 @@ function embed(?bool $bool, string $content): bool
23
  return $bool;
24
  }
25
 
 
 
 
 
26
  foreach ([
27
  kksr('slug'),
28
  // Legacy...
11
 
12
  namespace Bhittani\StarRating\core\filters;
13
 
14
+ use function Bhittani\StarRating\functions\applying_filter;
15
+
16
  if (! defined('KK_STAR_RATINGS')) {
17
  http_response_code(404);
18
  exit();
25
  return $bool;
26
  }
27
 
28
+ if (applying_filter('get_the_excerpt')) {
29
+ return false;
30
+ }
31
+
32
  foreach ([
33
  kksr('slug'),
34
  // Legacy...
src/core/index.php CHANGED
@@ -9,6 +9,8 @@
9
  * the LICENSE file that was distributed with this source code.
10
  */
11
 
 
 
12
  if (! defined('KK_STAR_RATINGS')) {
13
  http_response_code(404);
14
  exit();
@@ -32,8 +34,19 @@ The activation will be handled when the plugin is loaded.
32
  ============================================================== */
33
  // register_activation_hook(KK_STAR_RATINGS, kksr('core.wp.functions.activate'));
34
 
35
- /* ==================================================
36
- We need a higher priority for `the_content` filter
37
- so that we can check for shortcodes and blocks.
38
- ================================================== */
39
- // add_filter('the_content', kksr('core.wp.functions.the_content'), 8);
 
 
 
 
 
 
 
 
 
 
 
9
  * the LICENSE file that was distributed with this source code.
10
  */
11
 
12
+ use function Bhittani\StarRating\functions\applying_filter;
13
+
14
  if (! defined('KK_STAR_RATINGS')) {
15
  http_response_code(404);
16
  exit();
34
  ============================================================== */
35
  // register_activation_hook(KK_STAR_RATINGS, kksr('core.wp.functions.activate'));
36
 
37
+ /* ==============================================================
38
+ To be aware of the fact that 'the_content' filter
39
+ is being applied within the 'get_the_excerpt'
40
+ filter, we must ensure we set up a flag.
41
+ ============================================================== */
42
+ add_filter('get_the_excerpt', function ($excerpt) {
43
+ applying_filter(['get_the_excerpt' => true]);
44
+
45
+ return $excerpt;
46
+ }, PHP_INT_MIN);
47
+
48
+ add_filter('get_the_excerpt', function ($excerpt) {
49
+ applying_filter(['get_the_excerpt' => false]);
50
+
51
+ return $excerpt;
52
+ }, PHP_INT_MAX);
src/core/wp/functions/the_content.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of bhittani/kk-star-ratings.
5
- *
6
- * (c) Kamal Khan <shout@bhittani.com>
7
- *
8
- * For the full copyright and license information, please view
9
- * the LICENSE file that was distributed with this source code.
10
- */
11
-
12
- namespace Bhittani\StarRating\core\wp\functions;
13
-
14
- use function Bhittani\StarRating\core\functions\filter;
15
- use function Bhittani\StarRating\core\functions\option;
16
- use function Bhittani\StarRating\functions\to_shortcode;
17
-
18
- if (! defined('KK_STAR_RATINGS')) {
19
- http_response_code(404);
20
- exit();
21
- }
22
-
23
- function the_content(string $content): string
24
- {
25
- if (! filter('embed', null, $content)) {
26
- return $content;
27
- }
28
-
29
- $align = 'left';
30
- $reference = 'auto';
31
- $valign = 'top';
32
-
33
- $position = option('position');
34
-
35
- if (strpos($position, 'top-') === 0) {
36
- $align = substr($position, 4);
37
- $valign = 'top';
38
- }
39
-
40
- if (strpos($position, 'bottom-') === 0) {
41
- $align = substr($position, 7);
42
- $valign = 'bottom';
43
- }
44
-
45
- $starRatings = to_shortcode(kksr('slug'), compact('align', 'reference', 'valign'));
46
-
47
- if ($valign == 'top') {
48
- return $starRatings.$content;
49
- }
50
-
51
- return $content.$starRatings;
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/functions/applying_filter.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of bhittani/kk-star-ratings.
5
+ *
6
+ * (c) Kamal Khan <shout@bhittani.com>
7
+ *
8
+ * For the full copyright and license information, please view
9
+ * the LICENSE file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Bhittani\StarRating\functions;
13
+
14
+ if (! defined('KK_STAR_RATINGS')) {
15
+ http_response_code(404);
16
+ exit();
17
+ }
18
+
19
+ /**
20
+ * @param string|array<string,bool> $filter
21
+ *
22
+ * @return bool|null
23
+ */
24
+ function applying_filter($filter)
25
+ {
26
+ if (! is_array($filter)) {
27
+ return (bool) kksr("_.filters.{$filter}");
28
+ }
29
+
30
+ foreach ($filter as $tag => $bool) {
31
+ kksr(["_.filters.{$tag}" => (bool) $bool]);
32
+ }
33
+ }