Version Description
Download this release
Release Info
Developer | bhittani |
Plugin | kk Star Ratings |
Version | 4.1.6 |
Comparing to | |
See all releases |
Code changes from version 4.1.5 to 4.1.6
- index.php +1 -1
- languages/kk-star-ratings.pot +2 -2
- readme.txt +1 -1
- src/admin.php +2 -2
- src/ajax.php +4 -4
- src/metabox.php +1 -1
- views/active-stars.php +1 -1
- views/admin/content.php +1 -1
- views/admin/fields/checkbox.php +2 -2
- views/admin/fields/code.php +2 -2
- views/admin/fields/number.php +4 -4
- views/admin/fields/radio.php +2 -2
- views/admin/fields/select.php +3 -3
- views/admin/fields/text.php +1 -1
- views/admin/fields/textarea.php +2 -2
- views/admin/index.php +4 -4
- views/inactive-stars.php +1 -1
- views/legend.php +5 -5
- views/markup.php +1 -1
- views/metabox/content.php +4 -4
- views/star.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.1.
|
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: 4.1.6
|
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 4.1.
|
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: 2020-12-
|
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"
|
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.6\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: 2020-12-16T09:42:00+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"
|
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.5.3
|
8 |
-
Stable tag: 4.1.
|
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.5.3
|
8 |
+
Stable tag: 4.1.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
src/admin.php
CHANGED
@@ -22,8 +22,8 @@ function get_admin_tabs()
|
|
22 |
{
|
23 |
$tabs = apply_plugin_filters('admin_tabs', []);
|
24 |
$keys = array_keys($tabs);
|
25 |
-
$
|
26 |
-
$active = apply_plugin_filters('active_admin_tab', $
|
27 |
|
28 |
return [$tabs, $active];
|
29 |
}
|
22 |
{
|
23 |
$tabs = apply_plugin_filters('admin_tabs', []);
|
24 |
$keys = array_keys($tabs);
|
25 |
+
$tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : reset($keys);
|
26 |
+
$active = apply_plugin_filters('active_admin_tab', $tab);
|
27 |
|
28 |
return [$tabs, $active];
|
29 |
}
|
src/ajax.php
CHANGED
@@ -36,8 +36,8 @@ function ajax()
|
|
36 |
]));
|
37 |
}
|
38 |
|
39 |
-
$id = $_POST['id'];
|
40 |
-
$slug = $_POST['slug'];
|
41 |
|
42 |
if (! apply_plugin_filters('can_vote', true, $id, $slug)) {
|
43 |
header('Content-Type: application/json; charset=utf-8', true, 401);
|
@@ -55,9 +55,9 @@ function ajax()
|
|
55 |
]));
|
56 |
}
|
57 |
|
58 |
-
$best = $_POST['best']
|
59 |
$best = max((int) $best, 1);
|
60 |
-
$score = $_POST['score'];
|
61 |
$score = min(max((int) $score, 1), $best);
|
62 |
|
63 |
do_plugin_action('vote', $score, $best, $id, $slug);
|
36 |
]));
|
37 |
}
|
38 |
|
39 |
+
$id = sanitize_text_field($_POST['id']);
|
40 |
+
$slug = sanitize_text_field($_POST['slug']);
|
41 |
|
42 |
if (! apply_plugin_filters('can_vote', true, $id, $slug)) {
|
43 |
header('Content-Type: application/json; charset=utf-8', true, 401);
|
55 |
]));
|
56 |
}
|
57 |
|
58 |
+
$best = isset($_POST['best']) ? sanitize_text_field($_POST['best']): get_option(prefix('stars'));
|
59 |
$best = max((int) $best, 1);
|
60 |
+
$score = sanitize_text_field($_POST['score']);
|
61 |
$score = min(max((int) $score, 1), $best);
|
62 |
|
63 |
do_plugin_action('vote', $score, $best, $id, $slug);
|
src/metabox.php
CHANGED
@@ -91,7 +91,7 @@ add_plugin_action('save_metabox', __NAMESPACE__.'\save_default_metabox', 9);
|
|
91 |
function save_default_metabox($id)
|
92 |
{
|
93 |
if (isset($_POST[meta_prefix('status')])) {
|
94 |
-
update_post_meta($id, meta_prefix('status'), $_POST[meta_prefix('status')]);
|
95 |
}
|
96 |
|
97 |
if (isset($_POST[meta_prefix('reset')])
|
91 |
function save_default_metabox($id)
|
92 |
{
|
93 |
if (isset($_POST[meta_prefix('status')])) {
|
94 |
+
update_post_meta($id, meta_prefix('status'), sanitize_text_field($_POST[meta_prefix('status')]));
|
95 |
}
|
96 |
|
97 |
if (isset($_POST[meta_prefix('reset')])
|
views/active-stars.php
CHANGED
@@ -1,4 +1,4 @@
|
|
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') ?>
|
1 |
+
<div class="kksr-stars-active" style="width: <?= esc_attr($width) ?>px;">
|
2 |
<?php for ($i = 1; $i <= $best; $i++) : ?>
|
3 |
<div class="kksr-star">
|
4 |
<?= \Bhittani\StarRating\view('active-star') ?>
|
views/admin/content.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
-
<form method="POST" action="options.php?tab=<?= $active; ?>" style="margin: 2rem;">
|
9 |
<?php submit_button(); ?>
|
10 |
<?php settings_fields($slug); ?>
|
11 |
<?php do_settings_sections($slug); ?>
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
+
<form method="POST" action="options.php?tab=<?= esc_attr($active); ?>" style="margin: 2rem;">
|
9 |
<?php submit_button(); ?>
|
10 |
<?php settings_fields($slug); ?>
|
11 |
<?php do_settings_sections($slug); ?>
|
views/admin/fields/checkbox.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
?>
|
7 |
|
8 |
<label>
|
9 |
-
<input type="checkbox" name="<?= $name ?>" value="<?= $value ?>"
|
10 |
<?= $checked ? 'checked="checked"' : '' ?>>
|
11 |
-
<?= $label ?>
|
12 |
</label>
|
6 |
?>
|
7 |
|
8 |
<label>
|
9 |
+
<input type="checkbox" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"
|
10 |
<?= $checked ? 'checked="checked"' : '' ?>>
|
11 |
+
<?= esc_html($label) ?>
|
12 |
</label>
|
views/admin/fields/code.php
CHANGED
@@ -5,5 +5,5 @@
|
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
-
<textarea rows="15" cols="50" name="<?= $name ?>"
|
9 |
-
style="font-family: monospace; padding: .5rem;"><?= $value ?></textarea>
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
+
<textarea rows="15" cols="50" name="<?= esc_attr($name) ?>"
|
9 |
+
style="font-family: monospace; padding: .5rem;"><?= esc_textarea($value) ?></textarea>
|
views/admin/fields/number.php
CHANGED
@@ -5,8 +5,8 @@
|
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
-
<input type="number" name="<?= $name ?>" value="<?= $value ?>"
|
9 |
-
<?= isset($min) ?
|
10 |
-
<?= isset($max) ?
|
11 |
-
<?= isset($step) ?
|
12 |
style="width: 5rem;">
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
+
<input type="number" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"
|
9 |
+
<?= isset($min) ? ('min="'. esc_attr($min).'"') : '' ?>
|
10 |
+
<?= isset($max) ? ('max="'. esc_attr($max).'"') : '' ?>
|
11 |
+
<?= isset($step) ? ('step="'. esc_attr($step).'"') : '' ?>
|
12 |
style="width: 5rem;">
|
views/admin/fields/radio.php
CHANGED
@@ -6,8 +6,8 @@
|
|
6 |
?>
|
7 |
|
8 |
<label>
|
9 |
-
<input type="radio" name="<?= $name ?>" value="<?= $value ?>"
|
10 |
<?= $checked ? 'checked="checked"' : '' ?>>
|
11 |
|
12 |
-
<?= $label ?>
|
13 |
</label>
|
6 |
?>
|
7 |
|
8 |
<label>
|
9 |
+
<input type="radio" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"
|
10 |
<?= $checked ? 'checked="checked"' : '' ?>>
|
11 |
|
12 |
+
<?= esc_html($label) ?>
|
13 |
</label>
|
views/admin/fields/select.php
CHANGED
@@ -5,13 +5,13 @@
|
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
-
<select name="<?= $name ?><?= (isset($multiple) && $multiple) ? '[]' : '' ?>"
|
9 |
style="min-width: 15rem; padding: .5rem;"
|
10 |
<?= (isset($multiple) && $multiple) ? 'multiple="multiple"' : '' ?>>
|
11 |
<?php foreach ($options as $option) : ?>
|
12 |
-
<option value="<?= $option['value'] ?>"
|
13 |
<?= $option['selected'] ? 'selected="selected"' : '' ?>>
|
14 |
-
<?= $option['label'] ?>
|
15 |
</option>
|
16 |
<?php endforeach; ?>
|
17 |
</select>
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
+
<select name="<?= esc_attr($name) ?><?= (isset($multiple) && $multiple) ? '[]' : '' ?>"
|
9 |
style="min-width: 15rem; padding: .5rem;"
|
10 |
<?= (isset($multiple) && $multiple) ? 'multiple="multiple"' : '' ?>>
|
11 |
<?php foreach ($options as $option) : ?>
|
12 |
+
<option value="<?= esc_attr($option['value']) ?>"
|
13 |
<?= $option['selected'] ? 'selected="selected"' : '' ?>>
|
14 |
+
<?= esc_html($option['label']) ?>
|
15 |
</option>
|
16 |
<?php endforeach; ?>
|
17 |
</select>
|
views/admin/fields/text.php
CHANGED
@@ -5,5 +5,5 @@
|
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
-
<input name="<?= $name ?>" value="<?= $value ?>"
|
9 |
style="width: 15rem;">
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
+
<input name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"
|
9 |
style="width: 15rem;">
|
views/admin/fields/textarea.php
CHANGED
@@ -5,5 +5,5 @@
|
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
-
<textarea rows="15" cols="50" name="<?= $name ?>"
|
9 |
-
style="padding: .5rem;"><?= $value ?></textarea>
|
5 |
}
|
6 |
?>
|
7 |
|
8 |
+
<textarea rows="15" cols="50" name="<?= esc_attr($name) ?>"
|
9 |
+
style="padding: .5rem;"><?= esc_textarea($value) ?></textarea>
|
views/admin/index.php
CHANGED
@@ -9,22 +9,22 @@
|
|
9 |
<?php settings_errors(); ?>
|
10 |
|
11 |
<h1>
|
12 |
-
<?= $label; ?>
|
13 |
<small style="
|
14 |
color: gray;
|
15 |
font-size: 80%;
|
16 |
margin-left: .5rem;
|
17 |
letter-spacing: -2px;
|
18 |
font-family: monospace;">
|
19 |
-
<?= $version; ?>
|
20 |
</small>
|
21 |
</h1>
|
22 |
|
23 |
<h2 class="nav-tab-wrapper">
|
24 |
<?php foreach ($tabs as $tab => $label) : ?>
|
25 |
<a class="nav-tab <?= $tab === $active ? 'nav-tab-active' : ''; ?>"
|
26 |
-
href="<?= admin_url('admin.php?page='
|
27 |
-
<?= $label; ?>
|
28 |
</a>
|
29 |
<?php endforeach; ?>
|
30 |
<div style="float: left; margin-left: 10px;">
|
9 |
<?php settings_errors(); ?>
|
10 |
|
11 |
<h1>
|
12 |
+
<?= esc_html($label); ?>
|
13 |
<small style="
|
14 |
color: gray;
|
15 |
font-size: 80%;
|
16 |
margin-left: .5rem;
|
17 |
letter-spacing: -2px;
|
18 |
font-family: monospace;">
|
19 |
+
<?= esc_html($version); ?>
|
20 |
</small>
|
21 |
</h1>
|
22 |
|
23 |
<h2 class="nav-tab-wrapper">
|
24 |
<?php foreach ($tabs as $tab => $label) : ?>
|
25 |
<a class="nav-tab <?= $tab === $active ? 'nav-tab-active' : ''; ?>"
|
26 |
+
href="<?= admin_url('admin.php?page='.sanitize_text_field($_GET['page']).'&tab='. esc_attr($tab)); ?>">
|
27 |
+
<?= esc_html($label); ?>
|
28 |
</a>
|
29 |
<?php endforeach; ?>
|
30 |
<div style="float: left; margin-left: 10px;">
|
views/inactive-stars.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<div class="kksr-stars-inactive">
|
2 |
<?php for ($i = 1; $i <= $best; $i++) : ?>
|
3 |
-
<div class="kksr-star" data-star="<?= $i ?>">
|
4 |
<?= \Bhittani\StarRating\view('inactive-star') ?>
|
5 |
</div>
|
6 |
<?php endfor; ?>
|
1 |
<div class="kksr-stars-inactive">
|
2 |
<?php for ($i = 1; $i <= $best; $i++) : ?>
|
3 |
+
<div class="kksr-star" data-star="<?= esc_attr($i) ?>">
|
4 |
<?= \Bhittani\StarRating\view('inactive-star') ?>
|
5 |
</div>
|
6 |
<?php endfor; ?>
|
views/legend.php
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
<div class="kksr-legend">
|
2 |
<?php if ($count) : ?>
|
3 |
-
<strong class="kksr-score"><?= $score ?></strong>
|
4 |
<span class="kksr-muted">/</span>
|
5 |
-
<strong><?= $best ?></strong>
|
6 |
<span class="kksr-muted">(</span>
|
7 |
-
<strong class="kksr-count"><?= $count ?></strong>
|
8 |
<span class="kksr-muted">
|
9 |
-
<?= _n('vote', 'votes', $count, 'kk-star-ratings') ?>
|
10 |
</span>
|
11 |
<span class="kksr-muted">)</span>
|
12 |
<?php else : ?>
|
13 |
-
<span class="kksr-muted"><?= $greet ?></span>
|
14 |
<?php endif; ?>
|
15 |
</div>
|
1 |
<div class="kksr-legend">
|
2 |
<?php if ($count) : ?>
|
3 |
+
<strong class="kksr-score"><?= esc_html($score) ?></strong>
|
4 |
<span class="kksr-muted">/</span>
|
5 |
+
<strong><?= esc_html($best) ?></strong>
|
6 |
<span class="kksr-muted">(</span>
|
7 |
+
<strong class="kksr-count"><?= esc_html($count) ?></strong>
|
8 |
<span class="kksr-muted">
|
9 |
+
<?= _n('vote', 'votes', esc_html($count), 'kk-star-ratings') ?>
|
10 |
</span>
|
11 |
<span class="kksr-muted">)</span>
|
12 |
<?php else : ?>
|
13 |
+
<span class="kksr-muted"><?= esc_html($greet) ?></span>
|
14 |
<?php endif; ?>
|
15 |
</div>
|
views/markup.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div style="display: none;"
|
2 |
-
class="kk-star-ratings <?= $valign ? (
|
3 |
data-id="<?= esc_attr($id) ?>"
|
4 |
data-slug="<?= esc_attr($slug) ?>">
|
5 |
<?= \Bhittani\StarRating\view('stars') ?>
|
1 |
<div style="display: none;"
|
2 |
+
class="kk-star-ratings <?= $valign ? ('kksr-valign-'. esc_attr($valign)) : '' ?> <?= $align ? ('kksr-align-'. esc_attr($align)) : '' ?> <?= $disabled ? 'kksr-disabled' : '' ?>"
|
3 |
data-id="<?= esc_attr($id) ?>"
|
4 |
data-slug="<?= esc_attr($slug) ?>">
|
5 |
<?= \Bhittani\StarRating\view('stars') ?>
|
views/metabox/content.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<div class='components-base-control__field'>
|
9 |
<div style="margin-top: 1rem;">
|
10 |
<label class="components-base-control__label" style="margin-top: .75rem; margin-bottom: .25rem;">
|
11 |
-
<input type="checkbox" name="<?= $resetFieldName
|
12 |
<?php _e('Reset Ratings', 'kk-star-ratings'); ?>
|
13 |
</label>
|
14 |
</div>
|
@@ -21,15 +21,15 @@
|
|
21 |
|
22 |
<div style="margin-top: 1rem;">
|
23 |
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
24 |
-
<input type="radio" name="<?= $statusFieldName
|
25 |
<?php _e('Auto', 'kk-star-ratings'); ?>
|
26 |
</label>
|
27 |
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
28 |
-
<input type="radio" name="<?= $statusFieldName
|
29 |
<?php _e('Enable', 'kk-star-ratings'); ?>
|
30 |
</label>
|
31 |
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
32 |
-
<input type="radio" name="<?= $statusFieldName
|
33 |
<?php _e('Disable', 'kk-star-ratings'); ?>
|
34 |
</label>
|
35 |
</div>
|
8 |
<div class='components-base-control__field'>
|
9 |
<div style="margin-top: 1rem;">
|
10 |
<label class="components-base-control__label" style="margin-top: .75rem; margin-bottom: .25rem;">
|
11 |
+
<input type="checkbox" name="<?= esc_attr($resetFieldName) ?>" value="1">
|
12 |
<?php _e('Reset Ratings', 'kk-star-ratings'); ?>
|
13 |
</label>
|
14 |
</div>
|
21 |
|
22 |
<div style="margin-top: 1rem;">
|
23 |
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
24 |
+
<input type="radio" name="<?= esc_attr($statusFieldName) ?>" value="" <?php checked($status, ''); ?>>
|
25 |
<?php _e('Auto', 'kk-star-ratings'); ?>
|
26 |
</label>
|
27 |
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
28 |
+
<input type="radio" name="<?= esc_attr($statusFieldName) ?>" value="enable" <?php checked($status, 'enable'); ?>>
|
29 |
<?php _e('Enable', 'kk-star-ratings'); ?>
|
30 |
</label>
|
31 |
<label class="components-base-control__label" style="margin-top: .5rem; margin-bottom: .25rem;">
|
32 |
+
<input type="radio" name="<?= esc_attr($statusFieldName) ?>" value="disable" <?php checked($status, 'disable'); ?>>
|
33 |
<?php _e('Disable', 'kk-star-ratings'); ?>
|
34 |
</label>
|
35 |
</div>
|
views/star.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<div class="kksr-icon" style="width: <?= $size ?>px; height: <?= $size ?>px;"></div>
|
1 |
+
<div class="kksr-icon" style="width: <?= esc_attr($size) ?>px; height: <?= esc_attr($size) ?>px;"></div>
|