Version Description
Download this release
Release Info
Developer | bhittani |
Plugin | kk Star Ratings |
Version | 4.1.0 |
Comparing to | |
See all releases |
Code changes from version 4.0.0 to 4.1.0
- index.php +2 -1
- languages/kk-star-ratings.pot +87 -78
- public/css/kk-star-ratings.css +9 -6
- public/css/kk-star-ratings.css.php +29 -0
- public/svg/active.svg +3 -1
- public/svg/inactive.svg +3 -1
- public/svg/selected.svg +3 -1
- readme.txt +1 -1
- src/activate.php +2 -2
- src/admin/appearance.php +10 -0
- src/assets.php +8 -1
- src/post.php +3 -1
- src/response.php +3 -0
- views/active-stars.php +1 -1
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: 4.
|
14 |
* License: GPLv2 or later
|
15 |
*/
|
16 |
|
@@ -41,6 +41,7 @@ config([
|
|
41 |
'exclude_categories' => [],
|
42 |
'position' => 'top-left',
|
43 |
// Appearance
|
|
|
44 |
'stars' => 5,
|
45 |
'size' => 24,
|
46 |
'greet' => 'Rate this [type]',
|
10 |
* Author URI: http://bhittani.com
|
11 |
* Text Domain: kk-star-ratings
|
12 |
* Domain Path: /languages
|
13 |
+
* Version: 4.1.0
|
14 |
* License: GPLv2 or later
|
15 |
*/
|
16 |
|
41 |
'exclude_categories' => [],
|
42 |
'position' => 'top-left',
|
43 |
// Appearance
|
44 |
+
'gap' => 4,
|
45 |
'stars' => 5,
|
46 |
'size' => 24,
|
47 |
'greet' => 'Rate this [type]',
|
languages/kk-star-ratings.pot
CHANGED
@@ -2,16 +2,16 @@
|
|
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 4.
|
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: 2019-10-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
-
"X-Generator: WP-CLI 2.
|
15 |
"X-Domain: kk-star-ratings\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
@@ -34,85 +34,45 @@ msgstr ""
|
|
34 |
msgid "http://bhittani.com"
|
35 |
msgstr ""
|
36 |
|
37 |
-
#:
|
38 |
-
msgid "
|
39 |
-
msgid_plural "votes"
|
40 |
-
msgstr[0] ""
|
41 |
-
|
42 |
-
#: views/metabox/content.php:12
|
43 |
-
msgid "Reset Ratings"
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: views/metabox/content.php:19
|
47 |
-
#: src/admin/rich-snippets.php:30
|
48 |
-
#: src/admin/general.php:50
|
49 |
-
msgid "Status"
|
50 |
-
msgstr ""
|
51 |
-
|
52 |
-
#: views/metabox/content.php:25
|
53 |
-
msgid "Auto"
|
54 |
-
msgstr ""
|
55 |
-
|
56 |
-
#: views/metabox/content.php:29
|
57 |
-
#: src/admin/rich-snippets.php:31
|
58 |
-
msgid "Enable"
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#: views/metabox/content.php:33
|
62 |
-
msgid "Disable"
|
63 |
-
msgstr ""
|
64 |
-
|
65 |
-
#: src/ajax.php:27
|
66 |
-
msgid "This action is forbidden."
|
67 |
-
msgstr ""
|
68 |
-
|
69 |
-
#: src/ajax.php:35
|
70 |
-
msgid "An id is required to vote."
|
71 |
-
msgstr ""
|
72 |
-
|
73 |
-
#: src/ajax.php:46
|
74 |
-
msgid "You are not allowed to vote."
|
75 |
-
msgstr ""
|
76 |
-
|
77 |
-
#: src/ajax.php:54
|
78 |
-
msgid "A rating is required to vote."
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: src/admin/
|
82 |
-
msgid "
|
83 |
msgstr ""
|
84 |
|
85 |
-
#: src/admin/
|
86 |
-
|
|
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: src/admin/
|
90 |
-
msgid "
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: src/admin/
|
94 |
-
|
95 |
-
msgid "The following variables are available:"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: src/admin/
|
99 |
-
msgid "
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: src/admin/
|
103 |
-
msgid "
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: src/admin/
|
107 |
-
msgid "
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: src/admin/
|
111 |
-
msgid "
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: src/admin/
|
115 |
-
msgid "
|
116 |
msgstr ""
|
117 |
|
118 |
#: src/admin/general.php:27
|
@@ -123,6 +83,12 @@ msgstr ""
|
|
123 |
msgid "Pages"
|
124 |
msgstr ""
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
#: src/admin/general.php:51
|
127 |
msgid "Active"
|
128 |
msgstr ""
|
@@ -215,30 +181,73 @@ msgstr ""
|
|
215 |
msgid "Bottom Right"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: src/admin/
|
219 |
-
|
|
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: src/admin/
|
223 |
-
msgid "
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: src/admin/
|
227 |
-
msgid "
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: src/admin/
|
231 |
-
msgid "
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: src/admin/
|
235 |
-
msgid "
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: src/admin/
|
239 |
-
msgid "
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: src/admin/
|
243 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
msgstr ""
|
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 4.1.0\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: 2019-10-28T12:14:20+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
+
"X-Generator: WP-CLI 2.3.0\n"
|
15 |
"X-Domain: kk-star-ratings\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
34 |
msgid "http://bhittani.com"
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: src/admin/appearance.php:27
|
38 |
+
msgid "Greeting text"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
msgstr ""
|
40 |
|
41 |
+
#: src/admin/appearance.php:31
|
42 |
+
msgid "Text that will be displayed when no votes have been casted."
|
43 |
msgstr ""
|
44 |
|
45 |
+
#: src/admin/appearance.php:32
|
46 |
+
#: src/admin/rich-snippets.php:48
|
47 |
+
msgid "The following variables are available:"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: src/admin/appearance.php:33
|
51 |
+
msgid "%s Post type."
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: src/admin/appearance.php:39
|
55 |
+
msgid "Stars"
|
|
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: src/admin/appearance.php:43
|
59 |
+
msgid "Total number of stars."
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: src/admin/appearance.php:48
|
63 |
+
msgid "Gap"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: src/admin/appearance.php:52
|
67 |
+
msgid "Gap between the stars."
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: src/admin/appearance.php:57
|
71 |
+
msgid "Size"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: src/admin/appearance.php:61
|
75 |
+
msgid "Size of a single star."
|
76 |
msgstr ""
|
77 |
|
78 |
#: src/admin/general.php:27
|
83 |
msgid "Pages"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: src/admin/general.php:50
|
87 |
+
#: src/admin/rich-snippets.php:30
|
88 |
+
#: views/metabox/content.php:19
|
89 |
+
msgid "Status"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
#: src/admin/general.php:51
|
93 |
msgid "Active"
|
94 |
msgstr ""
|
181 |
msgid "Bottom Right"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: src/admin/rich-snippets.php:31
|
185 |
+
#: views/metabox/content.php:29
|
186 |
+
msgid "Enable"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: src/admin/rich-snippets.php:38
|
190 |
+
msgid "Enable/disable rich snippets."
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: src/admin/rich-snippets.php:43
|
194 |
+
msgid "Content"
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: src/admin/rich-snippets.php:47
|
198 |
+
msgid "Provide the %s structure."
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: src/admin/rich-snippets.php:49
|
202 |
+
msgid "%s Post title."
|
203 |
msgstr ""
|
204 |
|
205 |
+
#: src/admin/rich-snippets.php:50
|
206 |
+
msgid "%s Average post ratings."
|
207 |
msgstr ""
|
208 |
|
209 |
+
#: src/admin/rich-snippets.php:51
|
210 |
+
msgid "%s Number of votes casted."
|
211 |
+
msgstr ""
|
212 |
+
|
213 |
+
#: src/admin/rich-snippets.php:52
|
214 |
+
msgid "%s Total amount of stars."
|
215 |
+
msgstr ""
|
216 |
+
|
217 |
+
#: src/admin/rich-snippets.php:54
|
218 |
+
msgid "You may <a href=\"%s\" target=\"_blank\">test the snippet here</a>."
|
219 |
+
msgstr ""
|
220 |
+
|
221 |
+
#: src/ajax.php:27
|
222 |
+
msgid "This action is forbidden."
|
223 |
+
msgstr ""
|
224 |
+
|
225 |
+
#: src/ajax.php:35
|
226 |
+
msgid "An id is required to vote."
|
227 |
+
msgstr ""
|
228 |
+
|
229 |
+
#: src/ajax.php:46
|
230 |
+
msgid "You are not allowed to vote."
|
231 |
+
msgstr ""
|
232 |
+
|
233 |
+
#: src/ajax.php:54
|
234 |
+
msgid "A rating is required to vote."
|
235 |
+
msgstr ""
|
236 |
+
|
237 |
+
#: views/legend.php:9
|
238 |
+
msgid "vote"
|
239 |
+
msgid_plural "votes"
|
240 |
+
msgstr[0] ""
|
241 |
+
msgstr[1] ""
|
242 |
+
|
243 |
+
#: views/metabox/content.php:12
|
244 |
+
msgid "Reset Ratings"
|
245 |
+
msgstr ""
|
246 |
+
|
247 |
+
#: views/metabox/content.php:25
|
248 |
+
msgid "Auto"
|
249 |
+
msgstr ""
|
250 |
+
|
251 |
+
#: views/metabox/content.php:33
|
252 |
+
msgid "Disable"
|
253 |
msgstr ""
|
public/css/kk-star-ratings.css
CHANGED
@@ -71,6 +71,7 @@
|
|
71 |
.kk-star-ratings .kksr-stars .kksr-star {
|
72 |
/* display: inline-flex; */
|
73 |
cursor: pointer;
|
|
|
74 |
}
|
75 |
|
76 |
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-star {
|
@@ -91,19 +92,16 @@
|
|
91 |
|
92 |
.kk-star-ratings .kksr-stars .kksr-star .kksr-icon,
|
93 |
.kk-star-ratings:not(.kksr-disabled) .kksr-stars .kksr-star:hover ~ .kksr-star .kksr-icon {
|
94 |
-
|
95 |
-
background-image: url("/wp-content/plugins/kk-star-ratings/public/svg/inactive.svg");
|
96 |
}
|
97 |
|
98 |
.kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star .kksr-icon {
|
99 |
-
|
100 |
-
background-image: url("/wp-content/plugins/kk-star-ratings/public/svg/active.svg");
|
101 |
}
|
102 |
|
103 |
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-stars-active .kksr-star .kksr-icon,
|
104 |
.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-star .kksr-icon {
|
105 |
-
|
106 |
-
background-image: url("/wp-content/plugins/kk-star-ratings/public/svg/selected.svg");
|
107 |
}
|
108 |
|
109 |
.kk-star-ratings .kksr-legend {
|
@@ -120,3 +118,8 @@
|
|
120 |
left: auto;
|
121 |
right: 0;
|
122 |
}
|
|
|
|
|
|
|
|
|
|
71 |
.kk-star-ratings .kksr-stars .kksr-star {
|
72 |
/* display: inline-flex; */
|
73 |
cursor: pointer;
|
74 |
+
margin-right: 0px;
|
75 |
}
|
76 |
|
77 |
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-star {
|
92 |
|
93 |
.kk-star-ratings .kksr-stars .kksr-star .kksr-icon,
|
94 |
.kk-star-ratings:not(.kksr-disabled) .kksr-stars .kksr-star:hover ~ .kksr-star .kksr-icon {
|
95 |
+
background-image: url("../svg/inactive.svg");
|
|
|
96 |
}
|
97 |
|
98 |
.kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star .kksr-icon {
|
99 |
+
background-image: url("../svg/active.svg");
|
|
|
100 |
}
|
101 |
|
102 |
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-stars-active .kksr-star .kksr-icon,
|
103 |
.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-star .kksr-icon {
|
104 |
+
background-image: url("../svg/selected.svg");
|
|
|
105 |
}
|
106 |
|
107 |
.kk-star-ratings .kksr-legend {
|
118 |
left: auto;
|
119 |
right: 0;
|
120 |
}
|
121 |
+
|
122 |
+
[dir="rtl"] .kk-star-ratings .kksr-stars .kksr-star {
|
123 |
+
margin-left: 0px;
|
124 |
+
margin-right: 0;
|
125 |
+
}
|
public/css/kk-star-ratings.css.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ($gap !== false) : ?>
|
2 |
+
.kk-star-ratings .kksr-stars .kksr-star {
|
3 |
+
margin-right: <?= $gap ?>px;
|
4 |
+
}
|
5 |
+
[dir="rtl"] .kk-star-ratings .kksr-stars .kksr-star {
|
6 |
+
margin-left: <?= $gap ?>px;
|
7 |
+
margin-right: 0;
|
8 |
+
}
|
9 |
+
<?php endif; ?>
|
10 |
+
|
11 |
+
<?php if ($stars['inactive']) : ?>
|
12 |
+
.kk-star-ratings .kksr-stars .kksr-star .kksr-icon,
|
13 |
+
.kk-star-ratings:not(.kksr-disabled) .kksr-stars .kksr-star:hover ~ .kksr-star .kksr-icon {
|
14 |
+
background-image: url("<?= $stars['inactive'] ?>");
|
15 |
+
}
|
16 |
+
<?php endif; ?>
|
17 |
+
|
18 |
+
<?php if ($stars['active']) : ?>
|
19 |
+
.kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star .kksr-icon {
|
20 |
+
background-image: url("<?= $stars['active'] ?>");
|
21 |
+
}
|
22 |
+
<?php endif; ?>
|
23 |
+
|
24 |
+
<?php if ($stars['selected']) : ?>
|
25 |
+
.kk-star-ratings.kksr-disabled .kksr-stars .kksr-stars-active .kksr-star .kksr-icon,
|
26 |
+
.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-star .kksr-icon {
|
27 |
+
background-image: url("<?= $stars['selected'] ?>");
|
28 |
+
}
|
29 |
+
<?php endif; ?>
|
public/svg/active.svg
CHANGED
@@ -1 +1,3 @@
|
|
1 |
-
<svg
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
+
<path fill="#ff8c00" stroke="tomato" stroke-width=".5" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
+
</svg>
|
public/svg/inactive.svg
CHANGED
@@ -1 +1,3 @@
|
|
1 |
-
<svg
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
+
<path fill="#ebe8e8" stroke="#ddd" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
+
</svg>
|
public/svg/selected.svg
CHANGED
@@ -1 +1,3 @@
|
|
1 |
-
<svg
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2 |
+
<path fill="#ff0" stroke="#fa8072" stroke-width=".5" d="M12 .587l3.668 7.568L24 9.306l-6.064 5.828 1.48 8.279L12 19.446l-7.417 3.967 1.481-8.279L0 9.306l8.332-1.151z"/>
|
3 |
+
</svg>
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited
|
|
5 |
Requires at least: 4.5
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.2.4
|
8 |
-
Stable tag: 4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
5 |
Requires at least: 4.5
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.2.4
|
8 |
+
Stable tag: 4.1.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
src/activate.php
CHANGED
@@ -27,7 +27,7 @@ function activate()
|
|
27 |
add_plugin_action('activate', __NAMESPACE__.'\upgrade_options', 9, 2);
|
28 |
function upgrade_options($version, $previous)
|
29 |
{
|
30 |
-
if ($previous && version_compare($previous, '3.0.
|
31 |
return;
|
32 |
}
|
33 |
|
@@ -55,7 +55,7 @@ function upgrade_options($version, $previous)
|
|
55 |
add_plugin_action('activate', __NAMESPACE__.'\upgrade_post_ratings', 9, 2);
|
56 |
function upgrade_post_ratings($version, $previous)
|
57 |
{
|
58 |
-
if ($previous && version_compare($previous, '3.0.
|
59 |
return;
|
60 |
}
|
61 |
|
27 |
add_plugin_action('activate', __NAMESPACE__.'\upgrade_options', 9, 2);
|
28 |
function upgrade_options($version, $previous)
|
29 |
{
|
30 |
+
if ($previous && version_compare($previous, '3.0.0', '>')) {
|
31 |
return;
|
32 |
}
|
33 |
|
55 |
add_plugin_action('activate', __NAMESPACE__.'\upgrade_post_ratings', 9, 2);
|
56 |
function upgrade_post_ratings($version, $previous)
|
57 |
{
|
58 |
+
if ($previous && version_compare($previous, '3.0.0', '>')) {
|
59 |
return;
|
60 |
}
|
61 |
|
src/admin/appearance.php
CHANGED
@@ -16,6 +16,7 @@ if (! defined('ABSPATH')) {
|
|
16 |
die();
|
17 |
}
|
18 |
|
|
|
19 |
$size = [prefix('size'), get_option(prefix('size'))];
|
20 |
$stars = [prefix('stars'), get_option(prefix('stars'))];
|
21 |
$greet = [prefix('greet'), get_option(prefix('greet'))];
|
@@ -42,6 +43,15 @@ return [
|
|
42 |
'help' => __('Total number of stars.', 'kk-star-ratings'),
|
43 |
],
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
[
|
46 |
'type' => 'number',
|
47 |
'title' => __('Size', 'kk-star-ratings'),
|
16 |
die();
|
17 |
}
|
18 |
|
19 |
+
$gap = [prefix('gap'), get_option(prefix('gap'))];
|
20 |
$size = [prefix('size'), get_option(prefix('size'))];
|
21 |
$stars = [prefix('stars'), get_option(prefix('stars'))];
|
22 |
$greet = [prefix('greet'), get_option(prefix('greet'))];
|
43 |
'help' => __('Total number of stars.', 'kk-star-ratings'),
|
44 |
],
|
45 |
|
46 |
+
[
|
47 |
+
'type' => 'number',
|
48 |
+
'title' => __('Gap', 'kk-star-ratings'),
|
49 |
+
'name' => $gap[0],
|
50 |
+
'value' => $gap[1],
|
51 |
+
'min' => 0,
|
52 |
+
'help' => __('Gap between the stars.', 'kk-star-ratings'),
|
53 |
+
],
|
54 |
+
|
55 |
[
|
56 |
'type' => 'number',
|
57 |
'title' => __('Size', 'kk-star-ratings'),
|
src/assets.php
CHANGED
@@ -30,7 +30,14 @@ function styles($hook)
|
|
30 |
config('version')
|
31 |
);
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
add_action('wp_enqueue_scripts', __NAMESPACE__.'\scripts');
|
30 |
config('version')
|
31 |
);
|
32 |
|
33 |
+
wp_add_inline_style(config('slug'), trim(get_view(config('path').'public/css/kk-star-ratings.css.php', [
|
34 |
+
'stars' => [
|
35 |
+
'active' => get_option(prefix('active_star')),
|
36 |
+
'inactive' => get_option(prefix('inactive_star')),
|
37 |
+
'selected' => get_option(prefix('selected_star')),
|
38 |
+
],
|
39 |
+
'gap' => max((int) get_option(prefix('gap')), 0),
|
40 |
+
])));
|
41 |
}
|
42 |
|
43 |
add_action('wp_enqueue_scripts', __NAMESPACE__.'\scripts');
|
src/post.php
CHANGED
@@ -194,7 +194,9 @@ function structured_data()
|
|
194 |
return;
|
195 |
}
|
196 |
|
197 |
-
if (
|
|
|
|
|
198 |
$id = get_post_field('ID');
|
199 |
$title = get_post_field('post_title');
|
200 |
$best = max((int) get_option(prefix('stars')), 1);
|
194 |
return;
|
195 |
}
|
196 |
|
197 |
+
if (get_option(prefix('grs'))
|
198 |
+
&& (is_singular() || is_page())
|
199 |
+
) {
|
200 |
$id = get_post_field('ID');
|
201 |
$title = get_post_field('post_title');
|
202 |
$best = max((int) get_option(prefix('stars')), 1);
|
src/response.php
CHANGED
@@ -86,5 +86,8 @@ function response(array $payload = [], $validate = true)
|
|
86 |
$percentage = round($percentage, 2, PHP_ROUND_HALF_DOWN);
|
87 |
$payload['percentage'] = min(max($percentage, 0), 100);
|
88 |
|
|
|
|
|
|
|
89 |
return view('markup', $payload);
|
90 |
}
|
86 |
$percentage = round($percentage, 2, PHP_ROUND_HALF_DOWN);
|
87 |
$payload['percentage'] = min(max($percentage, 0), 100);
|
88 |
|
89 |
+
$payload['gap'] = max((int) get_option(prefix('gap')), 0);
|
90 |
+
$payload['width'] = $payload['score'] * $payload['size'] + $payload['gap'] * (int) $payload['score'];
|
91 |
+
|
92 |
return view('markup', $payload);
|
93 |
}
|
views/active-stars.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="kksr-stars-active" style="width: <?= $
|
2 |
<?php for ($i = 1; $i <= $best; $i++) : ?>
|
3 |
<div class="kksr-star">
|
4 |
<?= \Bhittani\StarRating\view('active-star') ?>
|
1 |
+
<div class="kksr-stars-active" style="width: <?= $width ?>px;">
|
2 |
<?php for ($i = 1; $i <= $best; $i++) : ?>
|
3 |
<div class="kksr-star">
|
4 |
<?= \Bhittani\StarRating\view('active-star') ?>
|