Version Description
- FIX: wrong css style for rankings yasr_top_5_reviewers and yasr_top_ten_active_users
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 2.5.8 |
Comparing to | |
See all releases |
Code changes from version 2.5.7 to 2.5.8
- admin/editor/yasr-editor-functions.php +95 -55
- admin/js/yasr-editor-screen.js +4 -1
- changelog.txt +10 -13
- includes/js/src/ranking.js +1 -1
- includes/js/yasr-front.js +1 -1
- includes/shortcodes/classes/YasrNoStarsRankings.php +23 -5
- includes/shortcodes/classes/YasrRankings.php +2 -2
- includes/shortcodes/classes/YasrVisitorMultiSet.php +1 -1
- readme.txt +5 -14
- yet-another-stars-rating.php +5 -3
admin/editor/yasr-editor-functions.php
CHANGED
@@ -212,7 +212,7 @@ function wp_ajax_yasr_create_shortcode_callback() {
|
|
212 |
<a href="https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen"
|
213 |
target="_blank"
|
214 |
id="yasr-tinypopup-link-doc">
|
215 |
-
<?php _e(
|
216 |
</a>
|
217 |
|
218 |
</h2>
|
@@ -223,81 +223,105 @@ function wp_ajax_yasr_create_shortcode_callback() {
|
|
223 |
|
224 |
<tr>
|
225 |
<th>
|
226 |
-
<label for="yasr-overall"
|
|
|
|
|
227 |
</th>
|
228 |
<td>
|
229 |
<input type="button" class="button-primary" id="yasr-overall" name="yasr-overall"
|
230 |
-
value="<?php _e(
|
231 |
-
<small
|
|
|
|
|
232 |
|
233 |
<div id="yasr-overall-choose-size">
|
234 |
-
<small
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
|
|
|
|
246 |
</div>
|
247 |
|
248 |
</td>
|
249 |
</tr>
|
250 |
|
251 |
<tr>
|
252 |
-
<th
|
|
|
|
|
|
|
|
|
253 |
<td>
|
254 |
<input type="button" class="button-primary" name="yasr-visitor-votes" id="yasr-visitor-votes"
|
255 |
value="<?php _e("Insert Visitor Votes", 'yet-another-stars-rating'); ?>"/><br/>
|
256 |
-
<small
|
|
|
|
|
257 |
|
258 |
<div id="yasr-visitor-choose-size">
|
259 |
-
<small
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
271 |
</div>
|
272 |
-
|
273 |
</td>
|
274 |
</tr>
|
275 |
|
276 |
<?php if ($n_multi_set > 1) { //If multiple Set are found ?>
|
277 |
-
|
278 |
<tr>
|
279 |
<th>
|
280 |
-
|
281 |
</th>
|
282 |
<td>
|
283 |
<?php foreach ($multi_set as $name) { ?>
|
284 |
-
<
|
285 |
-
|
|
|
|
|
|
|
286 |
<br/>
|
287 |
<?php } //End foreach ?>
|
288 |
-
<small
|
|
|
|
|
289 |
|
290 |
<p>
|
291 |
-
<
|
292 |
-
|
|
|
|
|
293 |
<br/>
|
294 |
</p>
|
295 |
|
296 |
-
<small
|
|
|
|
|
|
|
297 |
|
298 |
<p>
|
299 |
-
<
|
300 |
-
|
|
|
|
|
301 |
<br/>
|
302 |
</p>
|
303 |
|
@@ -312,22 +336,26 @@ function wp_ajax_yasr_create_shortcode_callback() {
|
|
312 |
|
313 |
<?php } //End if
|
314 |
|
315 |
-
elseif ($n_multi_set
|
316 |
<tr>
|
317 |
-
<th
|
|
|
318 |
</th>
|
319 |
<td>
|
320 |
<p>
|
321 |
-
<input type="checkbox"
|
322 |
-
|
323 |
<br/>
|
324 |
</p>
|
325 |
|
326 |
-
<small
|
|
|
|
|
|
|
327 |
|
328 |
<p>
|
329 |
-
<input type="checkbox"
|
330 |
-
|
331 |
<br/>
|
332 |
</p>
|
333 |
|
@@ -350,23 +378,35 @@ function wp_ajax_yasr_create_shortcode_callback() {
|
|
350 |
|
351 |
<table id="yasr-table-tiny-popup-charts" class="form-table">
|
352 |
<tr>
|
353 |
-
<th
|
|
|
|
|
|
|
354 |
</th>
|
355 |
-
<td
|
|
|
356 |
id="yasr-top-10-overall-rating"
|
357 |
value="<?php _e("Insert Ranking reviews", 'yet-another-stars-rating') ?>"/><br/>
|
358 |
-
<small
|
|
|
|
|
359 |
</td>
|
360 |
</tr>
|
361 |
|
362 |
<tr>
|
363 |
<th>
|
364 |
-
<label for="yasr-10-highest-most-rated"
|
|
|
|
|
365 |
</th>
|
366 |
-
<td
|
|
|
367 |
id="yasr-10-highest-most-rated"
|
368 |
-
value="<?php _e(
|
369 |
-
<
|
|
|
|
|
|
|
370 |
</td>
|
371 |
</tr>
|
372 |
|
212 |
<a href="https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen"
|
213 |
target="_blank"
|
214 |
id="yasr-tinypopup-link-doc">
|
215 |
+
<?php _e('Read the doc', 'yet-another-stars-rating'); ?>
|
216 |
</a>
|
217 |
|
218 |
</h2>
|
223 |
|
224 |
<tr>
|
225 |
<th>
|
226 |
+
<label for="yasr-overall">
|
227 |
+
<?php _e("Overall Rating / Review", 'yet-another-stars-rating'); ?>
|
228 |
+
</label>
|
229 |
</th>
|
230 |
<td>
|
231 |
<input type="button" class="button-primary" id="yasr-overall" name="yasr-overall"
|
232 |
+
value="<?php _e('Insert Overall Rating', 'yet-another-stars-rating'); ?>"/><br/>
|
233 |
+
<small>
|
234 |
+
<?php _e('Insert Overall Rating / Review for this post', 'yet-another-stars-rating'); ?>
|
235 |
+
</small>
|
236 |
|
237 |
<div id="yasr-overall-choose-size">
|
238 |
+
<small>
|
239 |
+
<?php _e('Choose Size', 'yet-another-stars-rating'); ?>
|
240 |
+
</small>
|
241 |
+
<div class="yasr-tinymce-button-size">
|
242 |
+
<input type="button" class="button-secondary" id="yasr-overall-insert-small"
|
243 |
+
name="yasr-overall-insert-small"
|
244 |
+
value="<?php _e("Small", 'yet-another-stars-rating'); ?>"/>
|
245 |
+
<input type="button" class="button-secondary" id="yasr-overall-insert-medium"
|
246 |
+
name="yasr-overall-insert-medium"
|
247 |
+
value="<?php _e("Medium", 'yet-another-stars-rating'); ?>"/>
|
248 |
+
<input type="button" class="button-secondary" id="yasr-overall-insert-large"
|
249 |
+
name="yasr-overall-insert-large"
|
250 |
+
value="<?php _e("Large", 'yet-another-stars-rating'); ?>"/>
|
251 |
+
</div>
|
252 |
</div>
|
253 |
|
254 |
</td>
|
255 |
</tr>
|
256 |
|
257 |
<tr>
|
258 |
+
<th>
|
259 |
+
<label for="yasr-id">
|
260 |
+
<?php _e("Visitor Votes", 'yet-another-stars-rating'); ?>
|
261 |
+
</label>
|
262 |
+
</th>
|
263 |
<td>
|
264 |
<input type="button" class="button-primary" name="yasr-visitor-votes" id="yasr-visitor-votes"
|
265 |
value="<?php _e("Insert Visitor Votes", 'yet-another-stars-rating'); ?>"/><br/>
|
266 |
+
<small>
|
267 |
+
<?php _e("Insert the ability for your visitor to vote", 'yet-another-stars-rating'); ?>
|
268 |
+
</small>
|
269 |
|
270 |
<div id="yasr-visitor-choose-size">
|
271 |
+
<small>
|
272 |
+
<?php _e("Choose Size", 'yet-another-stars-rating'); ?>
|
273 |
+
</small>
|
274 |
+
<div class="yasr-tinymce-button-size">
|
275 |
+
<input type="button" class="button-secondary" id="yasr-visitor-insert-small"
|
276 |
+
name="yasr-visitor-insert-small"
|
277 |
+
value="<?php _e("Small", 'yet-another-stars-rating'); ?>"/>
|
278 |
+
<input type="button" class="button-secondary" id="yasr-visitor-insert-medium"
|
279 |
+
name="yasr-visitor-insert-medium"
|
280 |
+
value="<?php _e("Medium", 'yet-another-stars-rating'); ?>"/>
|
281 |
+
<input type="button" class="button-secondary" id="yasr-visitor-insert-large"
|
282 |
+
name="yasr-visitor-insert-large"
|
283 |
+
value="<?php _e("Large", 'yet-another-stars-rating'); ?>"/>
|
284 |
+
</div>
|
285 |
</div>
|
|
|
286 |
</td>
|
287 |
</tr>
|
288 |
|
289 |
<?php if ($n_multi_set > 1) { //If multiple Set are found ?>
|
|
|
290 |
<tr>
|
291 |
<th>
|
292 |
+
<?php _e('If you want to insert a Multi Set, pick one:', 'yet-another-stars-rating'); ?>
|
293 |
</th>
|
294 |
<td>
|
295 |
<?php foreach ($multi_set as $name) { ?>
|
296 |
+
<label>
|
297 |
+
<input type="radio" value="<?php echo $name->set_id ?>" name="yasr_tinymce_pick_set"
|
298 |
+
class="yasr_tinymce_select_set">
|
299 |
+
<?php echo $name->set_name ?>
|
300 |
+
</label>
|
301 |
<br/>
|
302 |
<?php } //End foreach ?>
|
303 |
+
<small>
|
304 |
+
<?php _e('Choose wich set you want to insert.', 'yet-another-stars-rating'); ?>
|
305 |
+
</small>
|
306 |
|
307 |
<p>
|
308 |
+
<label for="yasr-allow-vote-multiset">
|
309 |
+
<input type="checkbox" id="yasr-allow-vote-multiset">
|
310 |
+
<?php _e("Readonly?", 'yet-another-stars-rating'); ?>
|
311 |
+
</label>
|
312 |
<br/>
|
313 |
</p>
|
314 |
|
315 |
+
<small>
|
316 |
+
<?php _e('If Readonly is checked, only you can insert the votes (in the box above the editor)',
|
317 |
+
'yet-another-stars-rating'); ?>
|
318 |
+
</small>
|
319 |
|
320 |
<p>
|
321 |
+
<label for="yasr-hide-average-multiset">
|
322 |
+
<input type="checkbox" id="yasr-hide-average-multiset">
|
323 |
+
<?php _e("Hide Average?", 'yet-another-stars-rating'); ?>
|
324 |
+
</label>
|
325 |
<br/>
|
326 |
</p>
|
327 |
|
336 |
|
337 |
<?php } //End if
|
338 |
|
339 |
+
elseif ($n_multi_set === 1) { ?>
|
340 |
<tr>
|
341 |
+
<th>
|
342 |
+
<?php _e("Insert Multiset:", 'yet-another-stars-rating'); ?>
|
343 |
</th>
|
344 |
<td>
|
345 |
<p>
|
346 |
+
<input type="checkbox" id="yasr-allow-vote-multiset">
|
347 |
+
<?php _e("Readonly?", 'yet-another-stars-rating'); ?>
|
348 |
<br/>
|
349 |
</p>
|
350 |
|
351 |
+
<small>
|
352 |
+
<?php _e('If Readonly is checked, only you can insert the votes (in the box above the editor)',
|
353 |
+
'yet-another-stars-rating'); ?>
|
354 |
+
</small>
|
355 |
|
356 |
<p>
|
357 |
+
<input type="checkbox" id="yasr-hide-average-multiset">
|
358 |
+
<?php _e('Hide Average?', 'yet-another-stars-rating'); ?>
|
359 |
<br/>
|
360 |
</p>
|
361 |
|
378 |
|
379 |
<table id="yasr-table-tiny-popup-charts" class="form-table">
|
380 |
<tr>
|
381 |
+
<th>
|
382 |
+
<label for="yasr-10-overall">
|
383 |
+
<?php _e("Ranking reviews", 'yet-another-stars-rating'); ?>
|
384 |
+
</label>
|
385 |
</th>
|
386 |
+
<td>
|
387 |
+
<input type="button" class="button-primary" name="yasr-top-10-overall-rating"
|
388 |
id="yasr-top-10-overall-rating"
|
389 |
value="<?php _e("Insert Ranking reviews", 'yet-another-stars-rating') ?>"/><br/>
|
390 |
+
<small>
|
391 |
+
<?php _e("Insert Top 10 ranking for [yasr_overall_rating] shortcode", 'yet-another-stars-rating'); ?>
|
392 |
+
</small>
|
393 |
</td>
|
394 |
</tr>
|
395 |
|
396 |
<tr>
|
397 |
<th>
|
398 |
+
<label for="yasr-10-highest-most-rated">
|
399 |
+
<?php _e("Users' ranking", 'yet-another-stars-rating'); ?>
|
400 |
+
</label>
|
401 |
</th>
|
402 |
+
<td>
|
403 |
+
<input type="button" class="button-primary" name="yasr-10-highest-most-rated"
|
404 |
id="yasr-10-highest-most-rated"
|
405 |
+
value="<?php _e('Insert Users ranking', 'yet-another-stars-rating') ?>"/>
|
406 |
+
<br/>
|
407 |
+
<small>
|
408 |
+
<?php _e('Insert Top 10 ranking for [yasr_visitor_votes] shortcode', 'yet-another-stars-rating'); ?>
|
409 |
+
</small>
|
410 |
</td>
|
411 |
</tr>
|
412 |
|
admin/js/yasr-editor-screen.js
CHANGED
@@ -362,16 +362,17 @@ function shortcodeCreator () {
|
|
362 |
// When click on chart hide tab-main and show tab-charts
|
363 |
|
364 |
function yasrShortcodeCreator(nMultiSet) {
|
|
|
365 |
|
366 |
// When click on main tab hide tab-main and show tab-charts
|
367 |
jQuery('#yasr-link-tab-main').on("click", function () {
|
368 |
-
|
369 |
jQuery('.yasr-nav-tab').removeClass('nav-tab-active');
|
370 |
jQuery('#yasr-link-tab-main').addClass('nav-tab-active');
|
371 |
|
372 |
jQuery('.yasr-content-tab-tinymce').hide();
|
373 |
jQuery('#yasr-content-tab-main').show();
|
374 |
|
|
|
375 |
});
|
376 |
|
377 |
jQuery('#yasr-link-tab-charts').on("click", function () {
|
@@ -382,6 +383,8 @@ function yasrShortcodeCreator(nMultiSet) {
|
|
382 |
jQuery('.yasr-content-tab-tinymce').hide();
|
383 |
jQuery('#yasr-content-tab-charts').show();
|
384 |
|
|
|
|
|
385 |
});
|
386 |
|
387 |
// Add shortcode for overall rating
|
362 |
// When click on chart hide tab-main and show tab-charts
|
363 |
|
364 |
function yasrShortcodeCreator(nMultiSet) {
|
365 |
+
const linkDoc = document.getElementById('yasr-tinypopup-link-doc');
|
366 |
|
367 |
// When click on main tab hide tab-main and show tab-charts
|
368 |
jQuery('#yasr-link-tab-main').on("click", function () {
|
|
|
369 |
jQuery('.yasr-nav-tab').removeClass('nav-tab-active');
|
370 |
jQuery('#yasr-link-tab-main').addClass('nav-tab-active');
|
371 |
|
372 |
jQuery('.yasr-content-tab-tinymce').hide();
|
373 |
jQuery('#yasr-content-tab-main').show();
|
374 |
|
375 |
+
linkDoc.setAttribute('href', 'https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen');
|
376 |
});
|
377 |
|
378 |
jQuery('#yasr-link-tab-charts').on("click", function () {
|
383 |
jQuery('.yasr-content-tab-tinymce').hide();
|
384 |
jQuery('#yasr-content-tab-charts').show();
|
385 |
|
386 |
+
linkDoc.setAttribute('href', 'https://yetanotherstarsrating.com/yasr-rankings/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen');
|
387 |
+
|
388 |
});
|
389 |
|
390 |
// Add shortcode for overall rating
|
changelog.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 2.4.3 =
|
2 |
* NEW FEATURE: is now possible to show ratings next to the title
|
3 |
* FIXED: guten blocks returns error if post_id parameter was set
|
@@ -8,10 +18,6 @@
|
|
8 |
|
9 |
= 2.4.1 =
|
10 |
* FIXED: minor fix if more yasr_visitor_votes with different differents post_id are used in the same page
|
11 |
-
[//]: # fs_premium_only_begin
|
12 |
-
* NEW FEATURE: is now possible to add fake ratings in yasr_visitor_votes shortcode
|
13 |
-
* PRO ONLY: FIXED: is now possible to translate or create the strings with a software like loco translate
|
14 |
-
[//]: # fs_premium_only_end
|
15 |
|
16 |
= 2.4.0 =
|
17 |
* NEW FEATURE: is now possible to customize the itemType Name: if empty, post title will be used instead.
|
@@ -25,9 +31,6 @@
|
|
25 |
* FIXED: yasr_visitor_votes readonly didn't show up if load results with ajax is enabled
|
26 |
* FIXED: missing fragment error if gutenber used
|
27 |
* FIXED: empty tooltip on yasr_visitor_votes
|
28 |
-
[//]: # fs_premium_only_begin
|
29 |
-
* PRO ONLY: FIXED: comment list now shows stars
|
30 |
-
[//]: # fs_premium_only_end
|
31 |
|
32 |
= 2.3.8 =
|
33 |
* TWEAKED: Using GET instead of POST when getting rest response
|
@@ -43,18 +46,12 @@
|
|
43 |
* IMPROVED: is now possible to select between "Organization" or "Person" in "Rich snippet options".
|
44 |
You may need to save again "Publisher name" and "Image Url"
|
45 |
* IMPROVED: code cleanup
|
46 |
-
[//]: # fs_premium_only_begin
|
47 |
-
* PRO ONLY: IMPROVED: custom rankings now support up to 99 rows
|
48 |
-
[//]: # fs_premium_only_end
|
49 |
|
50 |
= 2.3.4 =
|
51 |
* IMPROVED: added Software Application itemType
|
52 |
* IMPROVED: added Organization itemType
|
53 |
* IMPORVED: added reviewBody and description properties
|
54 |
* FIXED: "Your ratings" widget in admin dashboard
|
55 |
-
[//]: # fs_premium_only_begin
|
56 |
-
* PRO ONLY: FIXED: Switch in guteneberg panel to enable/disable reviews in comment
|
57 |
-
[//]: # fs_premium_only_end
|
58 |
|
59 |
= 2.3.1 =
|
60 |
* Code refactor, according to boilerplate standards
|
1 |
+
= 2.4.5 =
|
2 |
+
* FIXED: %overall_rating% pattern didn't work for custom text
|
3 |
+
* FIXED: fixed link in yasr_most_or_highest_rated_posts
|
4 |
+
* FIXED: warning in yasr-settings-functions-multiset.php
|
5 |
+
* TWEAKED: minor changes
|
6 |
+
|
7 |
+
= 2.4.4 =
|
8 |
+
* TWEAKED: added yasr_auto_insert_exclude_cpt hook
|
9 |
+
* TWEAKED: code cleanup
|
10 |
+
|
11 |
= 2.4.3 =
|
12 |
* NEW FEATURE: is now possible to show ratings next to the title
|
13 |
* FIXED: guten blocks returns error if post_id parameter was set
|
18 |
|
19 |
= 2.4.1 =
|
20 |
* FIXED: minor fix if more yasr_visitor_votes with different differents post_id are used in the same page
|
|
|
|
|
|
|
|
|
21 |
|
22 |
= 2.4.0 =
|
23 |
* NEW FEATURE: is now possible to customize the itemType Name: if empty, post title will be used instead.
|
31 |
* FIXED: yasr_visitor_votes readonly didn't show up if load results with ajax is enabled
|
32 |
* FIXED: missing fragment error if gutenber used
|
33 |
* FIXED: empty tooltip on yasr_visitor_votes
|
|
|
|
|
|
|
34 |
|
35 |
= 2.3.8 =
|
36 |
* TWEAKED: Using GET instead of POST when getting rest response
|
46 |
* IMPROVED: is now possible to select between "Organization" or "Person" in "Rich snippet options".
|
47 |
You may need to save again "Publisher name" and "Image Url"
|
48 |
* IMPROVED: code cleanup
|
|
|
|
|
|
|
49 |
|
50 |
= 2.3.4 =
|
51 |
* IMPROVED: added Software Application itemType
|
52 |
* IMPROVED: added Organization itemType
|
53 |
* IMPORVED: added reviewBody and description properties
|
54 |
* FIXED: "Your ratings" widget in admin dashboard
|
|
|
|
|
|
|
55 |
|
56 |
= 2.3.1 =
|
57 |
* Code refactor, according to boilerplate standards
|
includes/js/src/ranking.js
CHANGED
@@ -530,7 +530,7 @@ class YasrRanking extends React.Component {
|
|
530 |
export function yasrDrawRankings () {
|
531 |
|
532 |
//check if there is some shortcode with class yasr-table-chart
|
533 |
-
const yasrRankingsInDom = document.getElementsByClassName('yasr-rankings');
|
534 |
|
535 |
if (yasrRankingsInDom.length > 0) {
|
536 |
for (let i = 0; i < yasrRankingsInDom.length; i++) {
|
530 |
export function yasrDrawRankings () {
|
531 |
|
532 |
//check if there is some shortcode with class yasr-table-chart
|
533 |
+
const yasrRankingsInDom = document.getElementsByClassName('yasr-stars-rankings');
|
534 |
|
535 |
if (yasrRankingsInDom.length > 0) {
|
536 |
for (let i = 0; i < yasrRankingsInDom.length; i++) {
|
includes/js/yasr-front.js
CHANGED
@@ -27,4 +27,4 @@ object-assign
|
|
27 |
*
|
28 |
* This source code is licensed under the MIT license found in the
|
29 |
* LICENSE file in the root directory of this source tree.
|
30 |
-
*/var r,a,l,o;if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var u=Date,s=u.now();t.unstable_now=function(){return u.now()-s}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var c=null,f=null,d=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(e){throw setTimeout(d,0),e}};r=function(e){null!==c?setTimeout(r,0,e):(c=e,setTimeout(d,0))},a=function(e,t){f=setTimeout(e,t)},l=function(){clearTimeout(f)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var p=window.setTimeout,m=window.clearTimeout;if("undefined"!=typeof console){var h=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof h&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var y=!1,v=null,g=-1,b=5,w=0;t.unstable_shouldYield=function(){return t.unstable_now()>=w},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<e?Math.floor(1e3/e):5};var k=new MessageChannel,E=k.port2;k.port1.onmessage=function(){if(null!==v){var e=t.unstable_now();w=e+b;try{v(!0,e)?E.postMessage(null):(y=!1,v=null)}catch(e){throw E.postMessage(null),e}}else y=!1},r=function(e){v=e,y||(y=!0,E.postMessage(null))},a=function(e,n){g=p((function(){e(t.unstable_now())}),n)},l=function(){m(g),g=-1}}function S(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,a=e[r];if(!(void 0!==a&&0<C(a,t)))break e;e[r]=t,e[n]=a,n=r}}function _(e){return void 0===(e=e[0])?null:e}function x(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length;r<a;){var l=2*(r+1)-1,o=e[l],i=l+1,u=e[i];if(void 0!==o&&0>C(o,n))void 0!==u&&0>C(u,o)?(e[r]=u,e[i]=n,r=i):(e[r]=o,e[l]=n,r=l);else{if(!(void 0!==u&&0>C(u,n)))break e;e[r]=u,e[i]=n,r=i}}}return t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var P=[],T=[],N=1,L=null,z=3,O=!1,I=!1,M=!1;function R(e){for(var t=_(T);null!==t;){if(null===t.callback)x(T);else{if(!(t.startTime<=e))break;x(T),t.sortIndex=t.expirationTime,S(P,t)}t=_(T)}}function D(e){if(M=!1,R(e),!I)if(null!==_(P))I=!0,r(F);else{var t=_(T);null!==t&&a(D,t.startTime-e)}}function F(e,n){I=!1,M&&(M=!1,l()),O=!0;var r=z;try{for(R(n),L=_(P);null!==L&&(!(L.expirationTime>n)||e&&!t.unstable_shouldYield());){var o=L.callback;if("function"==typeof o){L.callback=null,z=L.priorityLevel;var i=o(L.expirationTime<=n);n=t.unstable_now(),"function"==typeof i?L.callback=i:L===_(P)&&x(P),R(n)}else x(P);L=_(P)}if(null!==L)var u=!0;else{var s=_(T);null!==s&&a(D,s.startTime-n),u=!1}return u}finally{L=null,z=r,O=!1}}var j=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){I||O||(I=!0,r(F))},t.unstable_getCurrentPriorityLevel=function(){return z},t.unstable_getFirstCallbackNode=function(){return _(P)},t.unstable_next=function(e){switch(z){case 1:case 2:case 3:var t=3;break;default:t=z}var n=z;z=t;try{return e()}finally{z=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=j,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=z;z=e;try{return t()}finally{z=n}},t.unstable_scheduleCallback=function(e,n,o){var i=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,e){case 1:var u=-1;break;case 2:u=250;break;case 5:u=1073741823;break;case 4:u=1e4;break;default:u=5e3}return e={id:N++,callback:n,priorityLevel:e,startTime:o,expirationTime:u=o+u,sortIndex:-1},o>i?(e.sortIndex=o,S(T,e),null===_(P)&&e===_(T)&&(M?l():M=!0,a(D,o-i))):(e.sortIndex=u,S(P,e),I||O||(I=!0,r(F))),e},t.unstable_wrapCallback=function(e){var t=z;return function(){var n=z;z=t;try{return e.apply(this,arguments)}finally{z=n}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"yasrSearchStarsDom",(function(){return O}));var r,a=n(0),l=n.n(a),o=n(2),i=n.n(o);var u="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),s=new Uint8Array(16);function c(){if(!u)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return u(s)}var f=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var d=function(e){return"string"==typeof e&&f.test(e)},p=[],m=0;m<256;++m)p.push((m+256).toString(16).substr(1));var h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(p[e[t+0]]+p[e[t+1]]+p[e[t+2]]+p[e[t+3]]+"-"+p[e[t+4]]+p[e[t+5]]+"-"+p[e[t+6]]+p[e[t+7]]+"-"+p[e[t+8]]+p[e[t+9]]+"-"+p[e[t+10]]+p[e[t+11]]+p[e[t+12]]+p[e[t+13]]+p[e[t+14]]+p[e[t+15]]).toLowerCase();if(!d(n))throw TypeError("Stringified UUID is invalid");return n};var y=function(e,t,n){var r=(e=e||{}).random||(e.rng||c)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return h(r)};function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=E(e);if(t){var a=E(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return k(this,n)}}function k(e,t){return!t||"object"!==v(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var S=wp.i18n.__;function _(e){var t="yasr-ranking-element-"+y(),n=window[e.tableId].size;return l.a.createElement("div",{id:t,ref:function(){return raterJs({starSize:n,step:.1,showToolTip:!1,rating:e.rating,readOnly:!0,element:document.getElementById(t)})}})}function x(e){if(void 0!==e.post.number_of_votes)return l.a.createElement("span",{className:"yasr-most-rated-text"},"[",S("Total:","yet-another-stars-rating")," ",e.post.number_of_votes," ",S("Average:","yet-another-stars-rating")," ",e.post.rating,"]");var t=window[e.tableId].custom_text;return l.a.createElement("span",{className:"yasr-highest-rated-text"},t," ",e.post.rating)}function C(e){return l.a.createElement("td",{className:e.colClass},l.a.createElement("a",{href:e.post.link},function(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===r&&(r=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),r.innerHTML=e;var t=r.textContent;return r.innerHTML="",t}(e.post.title)))}function P(e){return"before"===window[e.tableId].text_position?l.a.createElement("td",{className:e.colClass},l.a.createElement(x,{post:e.post,tableId:e.tableId}),l.a.createElement(_,{rating:e.post.rating,tableId:e.tableId})):l.a.createElement("td",{className:e.colClass},l.a.createElement(_,{rating:e.post.rating,tableId:e.tableId}),l.a.createElement(x,{post:e.post,tableId:e.tableId}))}function T(e){var t="",n="";return"overall_rating"===e.source?(t="yasr-top-10-overall-left",n="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",n="yasr-top-10-most-highest-right"),l.a.createElement("tr",{className:e.trClass},l.a.createElement(C,{colClass:t,post:e.post}),l.a.createElement(P,{colClass:n,post:e.post,tableId:e.tableId}))}function N(e){return l.a.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,n){var r="yasr-rankings-td-colored";return"overall_rating"===e.source&&(r="yasr-rankings-td-white"),n%2==0&&(r="yasr-rankings-td-white","overall_rating"===e.source&&(r="yasr-rankings-td-colored")),l.a.createElement(T,{key:t.post_id,source:e.source,tableId:e.tableId,post:t,trClass:r})})))}var L=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(o,e);var t,n,r,a=w(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=a.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,queryParams:window[e.tableId].params},t}return t=o,(n=[{key:"componentDidMount",value:function(){var e=this,t={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(S("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:window[this.state.tableId]});else if(!1!==this.state.source){var n=this.returnRestUrl();Promise.all(n.map((function(n){return fetch(n).then((function(e){return!0===e.ok?e.json():(console.info(S("Ajax Call Failed. Getting data from source")),"KO")})).then((function(n){"KO"===n?t=window[e.state.tableId]:("overall_rating"===n.source&&(t=n),"visitor_votes"===n.source&&(t[n.show]=n.data_vv))})).catch((function(n){t=window[e.state.tableId],console.info(S(n))}))}))).then((function(n){e.setState({isLoaded:!0,data:t})})).catch((function(n){console.info(S(n)),e.setState({isLoaded:!0,data:t})}))}else this.setState({error:S("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var e=""!==this.state.queryParams?this.state.queryParams:"",t=this.state.source,n=!1,r="yet-another-stars-rating/v1/yasr-rankings/";if(""!==e&&(e="&"+e),"overall_rating"===t&&(n=[yasrCommonData.restEndpoint+r+"?source="+t+e]),"visitor_votes"===t){var a="",l="";""!==window[this.state.tableId].required_votes&&(a="&required_votes="+window[this.state.tableId].required_votes.most,l="&required_votes="+window[this.state.tableId].required_votes.highest),n=[yasrCommonData.restEndpoint+r+"?show=most&source="+t+e+a,yasrCommonData.restEndpoint+r+"?show=highest&source="+t+e+l]}return n}},{key:"rankingTableHead",value:function(e){var t=this.state.tableId,n="link-most-rated-posts-"+t,r="link-highest-rated-posts-"+t;if("visitor_votes"===e){var a=window[this.state.tableId].view,o=l.a.createElement("span",null,l.a.createElement("span",{id:n},S("Most Rated","yet-another-stars-rating"))," | ",l.a.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},S("Highest Rated","yet-another-stars-rating")));return"highest"===a&&(o=l.a.createElement("span",null,l.a.createElement("span",{id:r},S("Highest Rated","yet-another-stars-rating"))," | ",l.a.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},S("Most Rated","yet-another-stars-rating")))),l.a.createElement("thead",null,l.a.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},l.a.createElement("th",null,"Post"),l.a.createElement("th",null,S("Order By","yet-another-stars-rating-pro"),": ",o)))}return l.a.createElement(l.a.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,n=this.state.tableId,r="link-most-rated-posts-"+n,a="link-highest-rated-posts-"+n,l="most-rated-posts-"+n,o="highest-rated-posts-"+n,i=document.getElementById(t),u=document.createElement("span");u.innerHTML=i.innerHTML,u.id=i.id,i.parentNode.replaceChild(u,i),t===r&&(document.getElementById(o).style.display="none",document.getElementById(l).style.display="",u=document.getElementById(a),i.innerHTML=u.innerHTML,i.id=u.id,u.parentNode.replaceChild(i,u)),t===a&&(document.getElementById(l).style.display="none",document.getElementById(o).style.display="",u=document.getElementById(r),i.innerHTML=u.innerHTML,i.id=u.id,u.parentNode.replaceChild(i,u))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,n=e.source;if("overall_rating"===n)return l.a.createElement(N,{data:t.data_overall,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,show:"table-row-group",source:n});if("visitor_votes"===n){var r=t.most,a=t.highest,o="table-row-group",i="none";return"highest"===window[this.state.tableId].view&&(o="none",i="table-row-group"),l.a.createElement(l.a.Fragment,null,this.rankingTableHead(n),l.a.createElement(N,{data:r,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,show:o,source:n}),l.a.createElement(N,{data:a,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,show:i,source:n}))}}},{key:"render",value:function(){var e=this.state,t=e.error,n=e.isLoaded;return t?l.a.createElement("tbody",null,l.a.createElement("tr",null,l.a.createElement("td",null,console.log(t),"Error"))):!1===n?l.a.createElement("tbody",null,l.a.createElement("tr",null,l.a.createElement("td",null,S("Loading Charts","yet-another-stars-rating")))):l.a.createElement(l.a.Fragment,null,this.rankingTableBody())}}])&&g(t.prototype,n),r&&g(t,r),o}(l.a.Component);var z=wp.i18n.__;function O(e){var t=document.getElementsByClassName(e);if(t.length>0){if("yasr-rater-stars"!==e&&"yasr-ranking-stars"!==e||function(e){for(var t=0;t<e.length;t++){var n=e.item(t).id;I(e.item(t).getAttribute("data-rater-starsize"),n)}}(t),"yasr-rater-stars-vv"===e&&(function(e){for(var t=0;t<e.length;t++)!function(t){var n=e.item(t).getAttribute("data-rating"),r=e.item(t).getAttribute("data-readonly-attribute"),a=e.item(t).getAttribute("data-rater-readonly");null===r&&(r=!1),r=R(r),a=R(a),!0===r&&(a=!0);var l=e.item(t).getAttribute("data-rater-postid"),o=e.item(t).id,i=o.replace("yasr-visitor-votes-rater-",""),u=parseInt(e.item(t).getAttribute("data-rater-starsize")),s=e.item(t).getAttribute("data-rater-nonce"),c=e.item(t).getAttribute("data-issingular"),f="yasr-vv-votes-number-container-"+i,d="yasr-vv-average-container-"+i,p="yasr-visitor-votes-container-after-stars-"+i,m=!1;if("yes"===yasrCommonData.ajaxEnabled){var h=e.item(t).getAttribute("data-cpt");""===h&&(h="posts");var y="wp/v2/"+h+"/"+l+"?_fields=yasr_visitor_votes&_wpnonce="+yasrCommonData.nonce;jQuery.get(yasrCommonData.restEndpoint+y).done((function(e){var t;(t=!0===r||e.yasr_visitor_votes.stars_attributes.read_only,n=(n=e.yasr_visitor_votes.number_of_votes>0?e.yasr_visitor_votes.sum_votes/e.yasr_visitor_votes.number_of_votes:0).toFixed(1),n=parseFloat(n),M(u,n,l,t,o,i,s,c,p),!0!==r)&&(document.getElementById(f).innerHTML=e.yasr_visitor_votes.number_of_votes,document.getElementById(d).innerHTML=n,!1!==e.yasr_visitor_votes.stars_attributes.span_bottom&&(m=e.yasr_visitor_votes.stars_attributes.span_bottom,document.getElementById(p).insertAdjacentHTML("beforeend",m)))})).fail((function(e,t,r,f){console.info(z("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),M(u,n,l,a,o,i,s,c,p)}))}else M(u,n,l,a,o,i,s,c,p)}(t)}(t),"yes"===yasrCommonData.visitorStatsEnabled)){var n=document.getElementsByClassName("yasr-dashicons-visitor-stats");n&&function(e){for(var t=!1,n=0;n<e.length;n++)!function(n){var r="#"+e.item(n).id,a={action:"yasr_stats_visitors_votes",post_id:e.item(n).getAttribute("data-postid")};tippy(r,{content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:"true",arrowType:"round",onShow:function(e){r!==t&&jQuery.post(yasrCommonData.ajaxurl,a,(function(t){t=JSON.parse(t),e.setContent(t)}))},onHidden:function(){t=r}})}(n)}(n)}"yasr-multiset-visitors-rater"===e&&function(e){for(var t="",n=[],r=0;r<e.length;r++)!function(r){var a=e.item(r).id,l=e.item(r).getAttribute("data-rater-readonly");l=R(l);var o=document.querySelector("#"+a);raterJs({starSize:16,step:1,showToolTip:!1,readOnly:l,element:o,rateCallback:function(e,r){var a=o.getAttribute("data-rater-postid"),l=o.getAttribute("data-rater-setid"),i=o.getAttribute("data-rater-set-field-id");e=e.toFixed(1);var u=parseInt(e);this.setRating(u),t={postid:a,setid:l,field:i,rating:u},n.push(t),r()}})}(r);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var e=this.getAttribute("data-postid"),t=this.getAttribute("data-setid"),r=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+e+"-"+t).hide(),jQuery("#yasr-loader-multiset-visitor-"+e+"-"+t).show();var a={action:"yasr_visitor_multiset_field_vote",nonce:r,post_id:e,rating:n,set_type:t};jQuery.post(yasrCommonData.ajaxurl,a,(function(n){jQuery("#yasr-loader-multiset-visitor-"+e+"-"+t).text(n)}))}))}(t)}}function I(e,t){e=parseInt(e),raterJs({starSize:e,step:.1,showToolTip:!1,readOnly:!0,element:document.getElementById(t)})}function M(e,t,n,r,a,l,o,i,u){t=parseFloat(t),r=R(r),raterJs({starSize:e,rating:t,step:1,showToolTip:!1,readOnly:r,element:document.getElementById(a),rateCallback:function(e,t){document.getElementById(u).innerHTML=yasrCommonData.loaderHtml;var r={action:"yasr_send_visitor_rating",rating:e,post_id:n,nonce_visitor:o,is_singular:i};this.setRating(e),this.disable(),jQuery.post(yasrCommonData.ajaxurl,r,(function(e){e=JSON.parse(e),document.getElementById(u).innerHTML=e})),t()}})}function R(e){return null!=e&&""!==e||(e=!0),"true"!==e&&"1"!==e||(e=!0),"false"!==e&&"0"!==e||(e=!1),e}document.addEventListener("DOMContentLoaded",(function(e){O("yasr-rater-stars"),O("yasr-rater-stars-vv"),O("yasr-multiset-visitors-rater"),function(){var e=document.getElementsByClassName("yasr-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var n=e.item(t).id,r=window[n].source,a=document.getElementById(n),o=!1;"overall_rating"!==r&&"visitor_votes"!==r||(o=r),i.a.render(l.a.createElement(L,{source:o,tableId:n}),a)}}()}))}]);
|
27 |
*
|
28 |
* This source code is licensed under the MIT license found in the
|
29 |
* LICENSE file in the root directory of this source tree.
|
30 |
+
*/var r,a,l,o;if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var u=Date,s=u.now();t.unstable_now=function(){return u.now()-s}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var c=null,f=null,d=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(e){throw setTimeout(d,0),e}};r=function(e){null!==c?setTimeout(r,0,e):(c=e,setTimeout(d,0))},a=function(e,t){f=setTimeout(e,t)},l=function(){clearTimeout(f)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var p=window.setTimeout,m=window.clearTimeout;if("undefined"!=typeof console){var h=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof h&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var y=!1,v=null,g=-1,b=5,w=0;t.unstable_shouldYield=function(){return t.unstable_now()>=w},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<e?Math.floor(1e3/e):5};var k=new MessageChannel,E=k.port2;k.port1.onmessage=function(){if(null!==v){var e=t.unstable_now();w=e+b;try{v(!0,e)?E.postMessage(null):(y=!1,v=null)}catch(e){throw E.postMessage(null),e}}else y=!1},r=function(e){v=e,y||(y=!0,E.postMessage(null))},a=function(e,n){g=p((function(){e(t.unstable_now())}),n)},l=function(){m(g),g=-1}}function S(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,a=e[r];if(!(void 0!==a&&0<C(a,t)))break e;e[r]=t,e[n]=a,n=r}}function _(e){return void 0===(e=e[0])?null:e}function x(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length;r<a;){var l=2*(r+1)-1,o=e[l],i=l+1,u=e[i];if(void 0!==o&&0>C(o,n))void 0!==u&&0>C(u,o)?(e[r]=u,e[i]=n,r=i):(e[r]=o,e[l]=n,r=l);else{if(!(void 0!==u&&0>C(u,n)))break e;e[r]=u,e[i]=n,r=i}}}return t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var P=[],T=[],N=1,L=null,z=3,O=!1,I=!1,M=!1;function R(e){for(var t=_(T);null!==t;){if(null===t.callback)x(T);else{if(!(t.startTime<=e))break;x(T),t.sortIndex=t.expirationTime,S(P,t)}t=_(T)}}function D(e){if(M=!1,R(e),!I)if(null!==_(P))I=!0,r(F);else{var t=_(T);null!==t&&a(D,t.startTime-e)}}function F(e,n){I=!1,M&&(M=!1,l()),O=!0;var r=z;try{for(R(n),L=_(P);null!==L&&(!(L.expirationTime>n)||e&&!t.unstable_shouldYield());){var o=L.callback;if("function"==typeof o){L.callback=null,z=L.priorityLevel;var i=o(L.expirationTime<=n);n=t.unstable_now(),"function"==typeof i?L.callback=i:L===_(P)&&x(P),R(n)}else x(P);L=_(P)}if(null!==L)var u=!0;else{var s=_(T);null!==s&&a(D,s.startTime-n),u=!1}return u}finally{L=null,z=r,O=!1}}var j=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){I||O||(I=!0,r(F))},t.unstable_getCurrentPriorityLevel=function(){return z},t.unstable_getFirstCallbackNode=function(){return _(P)},t.unstable_next=function(e){switch(z){case 1:case 2:case 3:var t=3;break;default:t=z}var n=z;z=t;try{return e()}finally{z=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=j,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=z;z=e;try{return t()}finally{z=n}},t.unstable_scheduleCallback=function(e,n,o){var i=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,e){case 1:var u=-1;break;case 2:u=250;break;case 5:u=1073741823;break;case 4:u=1e4;break;default:u=5e3}return e={id:N++,callback:n,priorityLevel:e,startTime:o,expirationTime:u=o+u,sortIndex:-1},o>i?(e.sortIndex=o,S(T,e),null===_(P)&&e===_(T)&&(M?l():M=!0,a(D,o-i))):(e.sortIndex=u,S(P,e),I||O||(I=!0,r(F))),e},t.unstable_wrapCallback=function(e){var t=z;return function(){var n=z;z=t;try{return e.apply(this,arguments)}finally{z=n}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"yasrSearchStarsDom",(function(){return O}));var r,a=n(0),l=n.n(a),o=n(2),i=n.n(o);var u="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),s=new Uint8Array(16);function c(){if(!u)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return u(s)}var f=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var d=function(e){return"string"==typeof e&&f.test(e)},p=[],m=0;m<256;++m)p.push((m+256).toString(16).substr(1));var h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(p[e[t+0]]+p[e[t+1]]+p[e[t+2]]+p[e[t+3]]+"-"+p[e[t+4]]+p[e[t+5]]+"-"+p[e[t+6]]+p[e[t+7]]+"-"+p[e[t+8]]+p[e[t+9]]+"-"+p[e[t+10]]+p[e[t+11]]+p[e[t+12]]+p[e[t+13]]+p[e[t+14]]+p[e[t+15]]).toLowerCase();if(!d(n))throw TypeError("Stringified UUID is invalid");return n};var y=function(e,t,n){var r=(e=e||{}).random||(e.rng||c)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return h(r)};function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=E(e);if(t){var a=E(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return k(this,n)}}function k(e,t){return!t||"object"!==v(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var S=wp.i18n.__;function _(e){var t="yasr-ranking-element-"+y(),n=window[e.tableId].size;return l.a.createElement("div",{id:t,ref:function(){return raterJs({starSize:n,step:.1,showToolTip:!1,rating:e.rating,readOnly:!0,element:document.getElementById(t)})}})}function x(e){if(void 0!==e.post.number_of_votes)return l.a.createElement("span",{className:"yasr-most-rated-text"},"[",S("Total:","yet-another-stars-rating")," ",e.post.number_of_votes," ",S("Average:","yet-another-stars-rating")," ",e.post.rating,"]");var t=window[e.tableId].custom_text;return l.a.createElement("span",{className:"yasr-highest-rated-text"},t," ",e.post.rating)}function C(e){return l.a.createElement("td",{className:e.colClass},l.a.createElement("a",{href:e.post.link},function(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===r&&(r=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),r.innerHTML=e;var t=r.textContent;return r.innerHTML="",t}(e.post.title)))}function P(e){return"before"===window[e.tableId].text_position?l.a.createElement("td",{className:e.colClass},l.a.createElement(x,{post:e.post,tableId:e.tableId}),l.a.createElement(_,{rating:e.post.rating,tableId:e.tableId})):l.a.createElement("td",{className:e.colClass},l.a.createElement(_,{rating:e.post.rating,tableId:e.tableId}),l.a.createElement(x,{post:e.post,tableId:e.tableId}))}function T(e){var t="",n="";return"overall_rating"===e.source?(t="yasr-top-10-overall-left",n="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",n="yasr-top-10-most-highest-right"),l.a.createElement("tr",{className:e.trClass},l.a.createElement(C,{colClass:t,post:e.post}),l.a.createElement(P,{colClass:n,post:e.post,tableId:e.tableId}))}function N(e){return l.a.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,n){var r="yasr-rankings-td-colored";return"overall_rating"===e.source&&(r="yasr-rankings-td-white"),n%2==0&&(r="yasr-rankings-td-white","overall_rating"===e.source&&(r="yasr-rankings-td-colored")),l.a.createElement(T,{key:t.post_id,source:e.source,tableId:e.tableId,post:t,trClass:r})})))}var L=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(o,e);var t,n,r,a=w(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=a.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,queryParams:window[e.tableId].params},t}return t=o,(n=[{key:"componentDidMount",value:function(){var e=this,t={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(S("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:window[this.state.tableId]});else if(!1!==this.state.source){var n=this.returnRestUrl();Promise.all(n.map((function(n){return fetch(n).then((function(e){return!0===e.ok?e.json():(console.info(S("Ajax Call Failed. Getting data from source")),"KO")})).then((function(n){"KO"===n?t=window[e.state.tableId]:("overall_rating"===n.source&&(t=n),"visitor_votes"===n.source&&(t[n.show]=n.data_vv))})).catch((function(n){t=window[e.state.tableId],console.info(S(n))}))}))).then((function(n){e.setState({isLoaded:!0,data:t})})).catch((function(n){console.info(S(n)),e.setState({isLoaded:!0,data:t})}))}else this.setState({error:S("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var e=""!==this.state.queryParams?this.state.queryParams:"",t=this.state.source,n=!1,r="yet-another-stars-rating/v1/yasr-rankings/";if(""!==e&&(e="&"+e),"overall_rating"===t&&(n=[yasrCommonData.restEndpoint+r+"?source="+t+e]),"visitor_votes"===t){var a="",l="";""!==window[this.state.tableId].required_votes&&(a="&required_votes="+window[this.state.tableId].required_votes.most,l="&required_votes="+window[this.state.tableId].required_votes.highest),n=[yasrCommonData.restEndpoint+r+"?show=most&source="+t+e+a,yasrCommonData.restEndpoint+r+"?show=highest&source="+t+e+l]}return n}},{key:"rankingTableHead",value:function(e){var t=this.state.tableId,n="link-most-rated-posts-"+t,r="link-highest-rated-posts-"+t;if("visitor_votes"===e){var a=window[this.state.tableId].view,o=l.a.createElement("span",null,l.a.createElement("span",{id:n},S("Most Rated","yet-another-stars-rating"))," | ",l.a.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},S("Highest Rated","yet-another-stars-rating")));return"highest"===a&&(o=l.a.createElement("span",null,l.a.createElement("span",{id:r},S("Highest Rated","yet-another-stars-rating"))," | ",l.a.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},S("Most Rated","yet-another-stars-rating")))),l.a.createElement("thead",null,l.a.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},l.a.createElement("th",null,"Post"),l.a.createElement("th",null,S("Order By","yet-another-stars-rating-pro"),": ",o)))}return l.a.createElement(l.a.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,n=this.state.tableId,r="link-most-rated-posts-"+n,a="link-highest-rated-posts-"+n,l="most-rated-posts-"+n,o="highest-rated-posts-"+n,i=document.getElementById(t),u=document.createElement("span");u.innerHTML=i.innerHTML,u.id=i.id,i.parentNode.replaceChild(u,i),t===r&&(document.getElementById(o).style.display="none",document.getElementById(l).style.display="",u=document.getElementById(a),i.innerHTML=u.innerHTML,i.id=u.id,u.parentNode.replaceChild(i,u)),t===a&&(document.getElementById(l).style.display="none",document.getElementById(o).style.display="",u=document.getElementById(r),i.innerHTML=u.innerHTML,i.id=u.id,u.parentNode.replaceChild(i,u))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,n=e.source;if("overall_rating"===n)return l.a.createElement(N,{data:t.data_overall,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,show:"table-row-group",source:n});if("visitor_votes"===n){var r=t.most,a=t.highest,o="table-row-group",i="none";return"highest"===window[this.state.tableId].view&&(o="none",i="table-row-group"),l.a.createElement(l.a.Fragment,null,this.rankingTableHead(n),l.a.createElement(N,{data:r,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,show:o,source:n}),l.a.createElement(N,{data:a,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,show:i,source:n}))}}},{key:"render",value:function(){var e=this.state,t=e.error,n=e.isLoaded;return t?l.a.createElement("tbody",null,l.a.createElement("tr",null,l.a.createElement("td",null,console.log(t),"Error"))):!1===n?l.a.createElement("tbody",null,l.a.createElement("tr",null,l.a.createElement("td",null,S("Loading Charts","yet-another-stars-rating")))):l.a.createElement(l.a.Fragment,null,this.rankingTableBody())}}])&&g(t.prototype,n),r&&g(t,r),o}(l.a.Component);var z=wp.i18n.__;function O(e){var t=document.getElementsByClassName(e);if(t.length>0){if("yasr-rater-stars"!==e&&"yasr-ranking-stars"!==e||function(e){for(var t=0;t<e.length;t++){var n=e.item(t).id;I(e.item(t).getAttribute("data-rater-starsize"),n)}}(t),"yasr-rater-stars-vv"===e&&(function(e){for(var t=0;t<e.length;t++)!function(t){var n=e.item(t).getAttribute("data-rating"),r=e.item(t).getAttribute("data-readonly-attribute"),a=e.item(t).getAttribute("data-rater-readonly");null===r&&(r=!1),r=R(r),a=R(a),!0===r&&(a=!0);var l=e.item(t).getAttribute("data-rater-postid"),o=e.item(t).id,i=o.replace("yasr-visitor-votes-rater-",""),u=parseInt(e.item(t).getAttribute("data-rater-starsize")),s=e.item(t).getAttribute("data-rater-nonce"),c=e.item(t).getAttribute("data-issingular"),f="yasr-vv-votes-number-container-"+i,d="yasr-vv-average-container-"+i,p="yasr-visitor-votes-container-after-stars-"+i,m=!1;if("yes"===yasrCommonData.ajaxEnabled){var h=e.item(t).getAttribute("data-cpt");""===h&&(h="posts");var y="wp/v2/"+h+"/"+l+"?_fields=yasr_visitor_votes&_wpnonce="+yasrCommonData.nonce;jQuery.get(yasrCommonData.restEndpoint+y).done((function(e){var t;(t=!0===r||e.yasr_visitor_votes.stars_attributes.read_only,n=(n=e.yasr_visitor_votes.number_of_votes>0?e.yasr_visitor_votes.sum_votes/e.yasr_visitor_votes.number_of_votes:0).toFixed(1),n=parseFloat(n),M(u,n,l,t,o,i,s,c,p),!0!==r)&&(document.getElementById(f).innerHTML=e.yasr_visitor_votes.number_of_votes,document.getElementById(d).innerHTML=n,!1!==e.yasr_visitor_votes.stars_attributes.span_bottom&&(m=e.yasr_visitor_votes.stars_attributes.span_bottom,document.getElementById(p).insertAdjacentHTML("beforeend",m)))})).fail((function(e,t,r,f){console.info(z("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),M(u,n,l,a,o,i,s,c,p)}))}else M(u,n,l,a,o,i,s,c,p)}(t)}(t),"yes"===yasrCommonData.visitorStatsEnabled)){var n=document.getElementsByClassName("yasr-dashicons-visitor-stats");n&&function(e){for(var t=!1,n=0;n<e.length;n++)!function(n){var r="#"+e.item(n).id,a={action:"yasr_stats_visitors_votes",post_id:e.item(n).getAttribute("data-postid")};tippy(r,{content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:"true",arrowType:"round",onShow:function(e){r!==t&&jQuery.post(yasrCommonData.ajaxurl,a,(function(t){t=JSON.parse(t),e.setContent(t)}))},onHidden:function(){t=r}})}(n)}(n)}"yasr-multiset-visitors-rater"===e&&function(e){for(var t="",n=[],r=0;r<e.length;r++)!function(r){var a=e.item(r).id,l=e.item(r).getAttribute("data-rater-readonly");l=R(l);var o=document.querySelector("#"+a);raterJs({starSize:16,step:1,showToolTip:!1,readOnly:l,element:o,rateCallback:function(e,r){var a=o.getAttribute("data-rater-postid"),l=o.getAttribute("data-rater-setid"),i=o.getAttribute("data-rater-set-field-id");e=e.toFixed(1);var u=parseInt(e);this.setRating(u),t={postid:a,setid:l,field:i,rating:u},n.push(t),r()}})}(r);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var e=this.getAttribute("data-postid"),t=this.getAttribute("data-setid"),r=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+e+"-"+t).hide(),jQuery("#yasr-loader-multiset-visitor-"+e+"-"+t).show();var a={action:"yasr_visitor_multiset_field_vote",nonce:r,post_id:e,rating:n,set_type:t};jQuery.post(yasrCommonData.ajaxurl,a,(function(n){jQuery("#yasr-loader-multiset-visitor-"+e+"-"+t).text(n)}))}))}(t)}}function I(e,t){e=parseInt(e),raterJs({starSize:e,step:.1,showToolTip:!1,readOnly:!0,element:document.getElementById(t)})}function M(e,t,n,r,a,l,o,i,u){t=parseFloat(t),r=R(r),raterJs({starSize:e,rating:t,step:1,showToolTip:!1,readOnly:r,element:document.getElementById(a),rateCallback:function(e,t){document.getElementById(u).innerHTML=yasrCommonData.loaderHtml;var r={action:"yasr_send_visitor_rating",rating:e,post_id:n,nonce_visitor:o,is_singular:i};this.setRating(e),this.disable(),jQuery.post(yasrCommonData.ajaxurl,r,(function(e){e=JSON.parse(e),document.getElementById(u).innerHTML=e})),t()}})}function R(e){return null!=e&&""!==e||(e=!0),"true"!==e&&"1"!==e||(e=!0),"false"!==e&&"0"!==e||(e=!1),e}document.addEventListener("DOMContentLoaded",(function(e){O("yasr-rater-stars"),O("yasr-rater-stars-vv"),O("yasr-multiset-visitors-rater"),function(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var n=e.item(t).id,r=window[n].source,a=document.getElementById(n),o=!1;"overall_rating"!==r&&"visitor_votes"!==r||(o=r),i.a.render(l.a.createElement(L,{source:o,tableId:n}),a)}}()}))}]);
|
includes/shortcodes/classes/YasrNoStarsRankings.php
CHANGED
@@ -47,11 +47,12 @@ class YasrNoStarsRankings extends YasrShortcode {
|
|
47 |
$this->shortcode_html = '<!-- Yasr Top 5 Reviewers Shortcode-->';
|
48 |
|
49 |
$this->shortcode_html .= '<table class="yasr-rankings">
|
50 |
-
<tr>
|
51 |
<th>' . __('Author', 'yet-another-stars-rating') .'</th>
|
52 |
<th>'. __('Reviews', 'yet-another-stars-rating') .'</th>
|
53 |
</tr>';
|
54 |
|
|
|
55 |
foreach ($query_result as $result) {
|
56 |
$user_data = get_userdata($result->reviewer);
|
57 |
|
@@ -63,10 +64,18 @@ class YasrNoStarsRankings extends YasrShortcode {
|
|
63 |
$user_data->user_login = 'Anonymous';
|
64 |
}
|
65 |
|
66 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
<td><a href='$user_profile'>$user_data->user_login</a></td>
|
68 |
<td>$result->total_count</td>
|
69 |
-
|
|
|
|
|
70 |
|
71 |
}
|
72 |
|
@@ -105,11 +114,12 @@ class YasrNoStarsRankings extends YasrShortcode {
|
|
105 |
$shortcode_html = '<!-- Yasr Top 10 Active Users Shortcode-->';
|
106 |
|
107 |
$shortcode_html .= '<table class="yasr-rankings">
|
108 |
-
<tr>
|
109 |
<th>' . __('UserName', 'yet-another-stars-rating') . '</th>
|
110 |
<th>' . __('Number of votes', 'yet-another-stars-rating') . '</th>
|
111 |
</tr>';
|
112 |
|
|
|
113 |
foreach ($query_result as $result) {
|
114 |
$user_data = get_userdata($result->user);
|
115 |
|
@@ -121,11 +131,19 @@ class YasrNoStarsRankings extends YasrShortcode {
|
|
121 |
$user_data->user_login = __('Anonymous', 'yet-another-stars-rating');
|
122 |
}
|
123 |
|
124 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
<td><a href='$user_profile'>$user_data->user_login</a></td>
|
126 |
<td>$result->total_count</td>
|
127 |
</tr>";
|
128 |
|
|
|
|
|
129 |
}
|
130 |
|
131 |
$shortcode_html .= '</table>';
|
47 |
$this->shortcode_html = '<!-- Yasr Top 5 Reviewers Shortcode-->';
|
48 |
|
49 |
$this->shortcode_html .= '<table class="yasr-rankings">
|
50 |
+
<tr class="yasr-rankings-td-colored">
|
51 |
<th>' . __('Author', 'yet-another-stars-rating') .'</th>
|
52 |
<th>'. __('Reviews', 'yet-another-stars-rating') .'</th>
|
53 |
</tr>';
|
54 |
|
55 |
+
$i = 0;
|
56 |
foreach ($query_result as $result) {
|
57 |
$user_data = get_userdata($result->reviewer);
|
58 |
|
64 |
$user_data->user_login = 'Anonymous';
|
65 |
}
|
66 |
|
67 |
+
if ($i % 2 === 0) {
|
68 |
+
$tr_class = 'yasr-rankings-td-white';
|
69 |
+
} else {
|
70 |
+
$tr_class = 'yasr-rankings-td-colored';
|
71 |
+
}
|
72 |
+
|
73 |
+
$this->shortcode_html .= "<tr class='$tr_class'>
|
74 |
<td><a href='$user_profile'>$user_data->user_login</a></td>
|
75 |
<td>$result->total_count</td>
|
76 |
+
</tr>";
|
77 |
+
|
78 |
+
$i++;
|
79 |
|
80 |
}
|
81 |
|
114 |
$shortcode_html = '<!-- Yasr Top 10 Active Users Shortcode-->';
|
115 |
|
116 |
$shortcode_html .= '<table class="yasr-rankings">
|
117 |
+
<tr class="yasr-rankings-td-colored">
|
118 |
<th>' . __('UserName', 'yet-another-stars-rating') . '</th>
|
119 |
<th>' . __('Number of votes', 'yet-another-stars-rating') . '</th>
|
120 |
</tr>';
|
121 |
|
122 |
+
$i = 0;
|
123 |
foreach ($query_result as $result) {
|
124 |
$user_data = get_userdata($result->user);
|
125 |
|
131 |
$user_data->user_login = __('Anonymous', 'yet-another-stars-rating');
|
132 |
}
|
133 |
|
134 |
+
if ($i % 2 === 0) {
|
135 |
+
$tr_class = 'yasr-rankings-td-white';
|
136 |
+
} else {
|
137 |
+
$tr_class = 'yasr-rankings-td-colored';
|
138 |
+
}
|
139 |
+
|
140 |
+
$shortcode_html .= "<tr class='$tr_class'>
|
141 |
<td><a href='$user_profile'>$user_data->user_login</a></td>
|
142 |
<td>$result->total_count</td>
|
143 |
</tr>";
|
144 |
|
145 |
+
$i++;
|
146 |
+
|
147 |
}
|
148 |
|
149 |
$shortcode_html .= '</table>';
|
includes/shortcodes/classes/YasrRankings.php
CHANGED
@@ -61,7 +61,7 @@ class YasrRankings extends YasrShortcode {
|
|
61 |
|
62 |
$table_id = 'yasr_overall_ranking_'.str_shuffle(uniqid());
|
63 |
|
64 |
-
$this->shortcode_html .= "<table class='yasr-rankings' id=$table_id>";
|
65 |
|
66 |
$array_with_title = self::rankingData($this->query_highest_rated_overall);
|
67 |
|
@@ -113,7 +113,7 @@ class YasrRankings extends YasrShortcode {
|
|
113 |
|
114 |
$table_id = 'yasr_vv_ranking_' . str_shuffle(uniqid());
|
115 |
|
116 |
-
$this->shortcode_html .= "<table class='yasr-rankings' id=$table_id>";
|
117 |
|
118 |
wp_localize_script(
|
119 |
'yasrfront',
|
61 |
|
62 |
$table_id = 'yasr_overall_ranking_'.str_shuffle(uniqid());
|
63 |
|
64 |
+
$this->shortcode_html .= "<table class='yasr-rankings yasr-stars-rankings' id=$table_id>";
|
65 |
|
66 |
$array_with_title = self::rankingData($this->query_highest_rated_overall);
|
67 |
|
113 |
|
114 |
$table_id = 'yasr_vv_ranking_' . str_shuffle(uniqid());
|
115 |
|
116 |
+
$this->shortcode_html .= "<table class='yasr-rankings yasr-stars-rankings' id=$table_id>";
|
117 |
|
118 |
wp_localize_script(
|
119 |
'yasrfront',
|
includes/shortcodes/classes/YasrVisitorMultiSet.php
CHANGED
@@ -154,7 +154,7 @@ class YasrVisitorMultiSet extends YasrMultiSet {
|
|
154 |
$this->star_readonly = 'false';
|
155 |
$this->span_message_content = "";
|
156 |
}
|
157 |
-
else if(
|
158 |
$this->button = "";
|
159 |
$this->star_readonly = 'true';
|
160 |
$this->span_message_content = __('Thank you for voting!', 'yet-another-stars-rating');
|
154 |
$this->star_readonly = 'false';
|
155 |
$this->span_message_content = "";
|
156 |
}
|
157 |
+
else if($set_enabled === 'false_already_voted') {
|
158 |
$this->button = "";
|
159 |
$this->star_readonly = 'true';
|
160 |
$this->span_message_content = __('Thank you for voting!', 'yet-another-stars-rating');
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Tags: rating, rate post, rate page, star rating, google rating, votes
|
|
4 |
Requires at least: 4.9.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.6
|
7 |
-
Requires PHP: 5.
|
8 |
-
Stable tag: 2.5.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
@@ -181,6 +181,9 @@ If doesn't, you should work on your seo reputation.
|
|
181 |
|
182 |
The full changelog can be found in the plugin's directory. Recent entries:
|
183 |
|
|
|
|
|
|
|
184 |
= 2.5.7 =
|
185 |
* TWEAK: Rankings have been rewritten: now are build in REACT, this will allow much more flexibility
|
186 |
|
@@ -245,17 +248,5 @@ be used to customize the shortcodes.
|
|
245 |
* TWEAKED: span 'yasr-custom-text-before-visitor-rating' removed
|
246 |
* TWEAKED: added hooks yasr_vv_cookie and yasr_mv_cookie to filter cookies name
|
247 |
|
248 |
-
= 2.4.5 =
|
249 |
-
* FIXED: %overall_rating% pattern didn't work for custom text
|
250 |
-
* FIXED: fixed link in yasr_most_or_highest_rated_posts
|
251 |
-
* FIXED: warning in yasr-settings-functions-multiset.php
|
252 |
-
* TWEAKED: minor changes
|
253 |
-
|
254 |
-
|
255 |
-
= 2.4.4 =
|
256 |
-
* TWEAKED: added yasr_auto_insert_exclude_cpt hook
|
257 |
-
* TWEAKED: code cleanup
|
258 |
-
|
259 |
-
|
260 |
= Additional Info =
|
261 |
See credits.txt file
|
4 |
Requires at least: 4.9.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.6
|
7 |
+
Requires PHP: 5.4
|
8 |
+
Stable tag: 2.5.8
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
181 |
|
182 |
The full changelog can be found in the plugin's directory. Recent entries:
|
183 |
|
184 |
+
= 2.5.8 =
|
185 |
+
* FIX: wrong css style for rankings yasr_top_5_reviewers and yasr_top_ten_active_users
|
186 |
+
|
187 |
= 2.5.7 =
|
188 |
* TWEAK: Rankings have been rewritten: now are build in REACT, this will allow much more flexibility
|
189 |
|
248 |
* TWEAKED: span 'yasr-custom-text-before-visitor-rating' removed
|
249 |
* TWEAKED: added hooks yasr_vv_cookie and yasr_mv_cookie to filter cookies name
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
= Additional Info =
|
252 |
See credits.txt file
|
yet-another-stars-rating.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
7 |
-
* Version: 2.5.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
-
define( 'YASR_VERSION_NUM', '2.5.
|
80 |
//Plugin absolute path
|
81 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
82 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|
@@ -113,7 +113,9 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
113 |
}
|
114 |
|
115 |
//role to save overall_rating and multi set
|
116 |
-
|
|
|
|
|
117 |
$yasr_version_installed = get_option( 'yasr-version' );
|
118 |
global $yasr_version_installed ;
|
119 |
$yasr_plugin_imported = get_option( 'yasr_plugin_imported' );
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
7 |
+
* Version: 2.5.8
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
+
define( 'YASR_VERSION_NUM', '2.5.8' );
|
80 |
//Plugin absolute path
|
81 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
82 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|
113 |
}
|
114 |
|
115 |
//role to save overall_rating and multi set
|
116 |
+
if ( !defined( 'YASR_USER_CAPABILITY_EDIT_POST' ) ) {
|
117 |
+
define( 'YASR_USER_CAPABILITY_EDIT_POST', 'edit_posts' );
|
118 |
+
}
|
119 |
$yasr_version_installed = get_option( 'yasr-version' );
|
120 |
global $yasr_version_installed ;
|
121 |
$yasr_plugin_imported = get_option( 'yasr_plugin_imported' );
|