Version Description
- TWEAKED: in the setting page, there is now a new form for creating multi set
- TWEAKED: minor changes and code cleanup
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 3.1.4 |
Comparing to | |
See all releases |
Code changes from version 3.1.3 to 3.1.4
- README.md +6 -2
- admin/classes/YasrEditCategory.php +1 -1
- admin/classes/YasrOnInstall.php +1 -1
- admin/css/yasr-admin.css +44 -12
- admin/editor/YasrEditorHooks.php +1 -1
- admin/editor/YasrMetaboxBelowEditor.php +18 -9
- admin/editor/YasrMetaboxSchemaFields.php +1 -1
- admin/editor/YasrOnSavePost.php +1 -1
- admin/editor/yasr-metabox-schema.php +1 -1
- admin/editor/yasr-metabox-top-right.php +1 -1
- admin/js/src/yasr-editor-screen.js +2 -263
- admin/js/src/yasr-settings-page.js +17 -8
- admin/js/src/yasrMultiCriteriaUtils.js +482 -0
- admin/js/yasr-editor-screen.js +1 -1
- admin/js/yasr-settings.js +1 -1
- admin/settings/aspect_style/yasr-settings-style-actions.php +1 -1
- admin/settings/aspect_style/yasr-settings-style-functions.php +1 -1
- admin/settings/classes/YasrImportRatingPlugins.php +1 -1
- admin/settings/classes/YasrSettings.php +4 -1
- admin/settings/classes/YasrSettingsMultiset.php +311 -0
- admin/settings/classes/YasrSettingsRankings.php +1 -1
- admin/settings/classes/YasrStats.php +1 -1
- admin/settings/migrations/yasr-settings-migration-functions.php +1 -1
- admin/settings/migrations/yasr-settings-migration-page.php +1 -1
- admin/settings/multiset/yasr-settings-functions-multiset-page.php +29 -64
- admin/settings/multiset/yasr-settings-functions-multiset.php +88 -195
- admin/settings/rankings/yasr-ranking-builder.php +1 -1
- admin/settings/yasr-pricing-page.php +1 -1
- admin/settings/yasr-settings-functions-misc.php +58 -1
- admin/settings/yasr-settings-page.php +1 -1
- admin/settings/yasr-stats-page.php +1 -1
- admin/yasr-admin-actions-ajax.php +1 -1
- admin/yasr-admin-filters.php +1 -1
- admin/yasr-admin-functions.php +1 -1
- admin/yasr-admin-init.php +1 -1
- includes/classes/YasrCustomPostTypes.php +1 -1
- includes/classes/YasrDatabaseRatings.php +1 -1
- includes/classes/YasrDefineOptions.php +1 -1
- includes/classes/YasrFindCachingPlugins.php +1 -1
- includes/classes/YasrLogDashboardWidget.php +1 -1
- includes/classes/YasrMultiSetData.php +1 -1
- includes/classes/YasrPhpFieldsHelper.php +1 -1
- includes/classes/YasrRankingData.php +1 -1
- includes/img/yasr-multi-set-insert-rate-small.jpg +0 -0
- includes/img/yasr-multi-set-insert-rate.jpg +0 -0
- includes/img/yasr-multi-set-insert-rating.png +0 -0
- includes/img/yasr-multi-set.png +0 -0
- includes/shortcodes/classes/YasrMultiSet.php +9 -3
- includes/shortcodes/classes/YasrNoStarsRankings.php +1 -1
- includes/shortcodes/classes/YasrOverallRating.php +1 -1
- includes/shortcodes/classes/YasrRankings.php +1 -1
- includes/shortcodes/classes/YasrShortcode.php +1 -1
- includes/shortcodes/classes/YasrShortcodesAjax.php +1 -1
- includes/shortcodes/classes/YasrVisitorMultiSet.php +1 -1
- includes/shortcodes/classes/YasrVisitorVotes.php +1 -1
- includes/shortcodes/yasr-shortcode-functions.php +1 -1
- includes/yasr-includes-db-functions.php +1 -1
- includes/yasr-includes-functions.php +1 -1
- includes/yasr-includes-init.php +1 -1
- includes/yasr-widgets.php +1 -1
- public/yasr-public-init.php +1 -1
- readme.txt +262 -0
- yet-another-stars-rating.php +3 -3
README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
# Yasr - Yet Another Stars Rating
|
2 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
|
@@ -5,7 +8,7 @@ Tags: rating, rate post, star rating, google rating, block
|
|
5 |
Requires at least: 4.7
|
6 |
Contributors: Dudo
|
7 |
Tested up to: 6.1
|
8 |
-
Stable tag: 3.1.
|
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
|
@@ -120,7 +123,7 @@ More info [here](https://wordpress.org/plugins/yet-another-stars-rating/faq/)
|
|
120 |
|
121 |
[youtube https://www.youtube.com/watch?v=M47xsJMQJ1E]
|
122 |
|
123 |
-
### New videos, talked in Italian but easily to understand (eng subs will
|
124 |
|
125 |
[Tutorial's playlist](https://www.youtube.com/playlist?list=PLFErQFOLUVMcx8Qb9--KKme3bQ_KGri71)
|
126 |
|
@@ -298,3 +301,4 @@ The full changelog can be found in the plugin's directory. Recent entries:
|
|
298 |
### Additional Info
|
299 |
|
300 |
See credits.txt file
|
|
1 |
+
Refer to [readme.txt](readme.txt)
|
2 |
+
|
3 |
+
<!--
|
4 |
# Yasr - Yet Another Stars Rating
|
5 |
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
|
8 |
Requires at least: 4.7
|
9 |
Contributors: Dudo
|
10 |
Tested up to: 6.1
|
11 |
+
Stable tag: 3.1.4
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
14 |
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
|
123 |
|
124 |
[youtube https://www.youtube.com/watch?v=M47xsJMQJ1E]
|
125 |
|
126 |
+
### New videos, talked in Italian but easily to understand (eng subs will come)
|
127 |
|
128 |
[Tutorial's playlist](https://www.youtube.com/playlist?list=PLFErQFOLUVMcx8Qb9--KKme3bQ_KGri71)
|
129 |
|
301 |
### Additional Info
|
302 |
|
303 |
See credits.txt file
|
304 |
+
-->
|
admin/classes/YasrEditCategory.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/classes/YasrOnInstall.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/css/yasr-admin.css
CHANGED
@@ -689,17 +689,10 @@
|
|
689 |
/*** Rules for Multi set page ***/
|
690 |
|
691 |
.yasr-multi-set-form-headers {
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
float: left;
|
697 |
-
width: 40%;
|
698 |
-
}
|
699 |
-
|
700 |
-
.yasr-multi-set-right {
|
701 |
-
float: right;
|
702 |
-
width: 55%;
|
703 |
}
|
704 |
|
705 |
.yasr-new-multi-set {
|
@@ -707,7 +700,46 @@
|
|
707 |
margin-top: 10px;
|
708 |
padding: 8px;
|
709 |
border: 1px solid #DDD;
|
710 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
}
|
712 |
|
713 |
.yasr-manage-multiset {
|
689 |
/*** Rules for Multi set page ***/
|
690 |
|
691 |
.yasr-multi-set-form-headers {
|
692 |
+
font-weight: 600;
|
693 |
+
color: #1d2327;
|
694 |
+
font-size: 1.3em;
|
695 |
+
margin-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
696 |
}
|
697 |
|
698 |
.yasr-new-multi-set {
|
700 |
margin-top: 10px;
|
701 |
padding: 8px;
|
702 |
border: 1px solid #DDD;
|
703 |
+
}
|
704 |
+
|
705 |
+
#new-multi-set-name {
|
706 |
+
width: 55%;
|
707 |
+
}
|
708 |
+
|
709 |
+
.criteria-row input[type=text] {
|
710 |
+
width: 70%;
|
711 |
+
border-radius: 0;
|
712 |
+
margin-bottom: 20px;
|
713 |
+
border-top: none;
|
714 |
+
border-right: none;
|
715 |
+
}
|
716 |
+
|
717 |
+
.yasr-new-multi-set input[type=text]:required {
|
718 |
+
border-left: 2px solid #FEB209;
|
719 |
+
}
|
720 |
+
|
721 |
+
.yasr-new-multi-set input[type=text]:required:focus {
|
722 |
+
border-left: 2px solid #FEB209;
|
723 |
+
}
|
724 |
+
|
725 |
+
.yasr-new-multi-set input[type=text]:focus {
|
726 |
+
box-shadow: none;
|
727 |
+
border-bottom: 1px solid #646970;
|
728 |
+
border-left: 1px solid #8c8f94;
|
729 |
+
}
|
730 |
+
|
731 |
+
.yasr-new-multi-set input[type=text]:focus::placeholder {
|
732 |
+
color:transparent;
|
733 |
+
}
|
734 |
+
|
735 |
+
.yasr-multiset-info-delete {
|
736 |
+
vertical-align: -moz-middle-with-baseline;
|
737 |
+
vertical-align: -webkit-baseline-middle;
|
738 |
+
}
|
739 |
+
|
740 |
+
.yasr-sort-criteria {
|
741 |
+
vertical-align: initial;
|
742 |
+
color: #8c8f94;
|
743 |
}
|
744 |
|
745 |
.yasr-manage-multiset {
|
admin/editor/YasrEditorHooks.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/editor/YasrMetaboxBelowEditor.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
@@ -44,7 +44,7 @@ class YasrMetaboxBelowEditor {
|
|
44 |
if($multi_set === false || $n_multi_set === false) {
|
45 |
global $wpdb;
|
46 |
|
47 |
-
$multi_set
|
48 |
$n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the count number of rows of the last query
|
49 |
}
|
50 |
|
@@ -130,7 +130,7 @@ class YasrMetaboxBelowEditor {
|
|
130 |
public function addMultisetTab() {
|
131 |
?>
|
132 |
<a href="#" id="yasr-metabox-below-editor-multiset-tab" class="nav-tab yasr-nav-tab">
|
133 |
-
<?php esc_html_e('Multi
|
134 |
</a>
|
135 |
<?php
|
136 |
}
|
@@ -140,8 +140,10 @@ class YasrMetaboxBelowEditor {
|
|
140 |
*
|
141 |
* @author Dario Curvino <@dudo>
|
142 |
* @since 3.0.6
|
|
|
143 |
* @param $post_id
|
144 |
* @param $multi_set
|
|
|
145 |
*/
|
146 |
public function metaboxMultiset($post_id, $multi_set, $n_multi_set) {
|
147 |
wp_nonce_field('yasr_nonce_save_multi_values_action', 'yasr_nonce_save_multi_values');
|
@@ -155,7 +157,7 @@ class YasrMetaboxBelowEditor {
|
|
155 |
<div id="yasr-metabox-below-editor-multiset" class="yasr-metabox-below-editor-content" style="display:none">
|
156 |
<?php
|
157 |
if ($n_multi_set > 1) {
|
158 |
-
|
159 |
} //End if ($n_multi_set>1)
|
160 |
|
161 |
$this->printMultisetDiv($n_multi_set, $set_id, $post_id);
|
@@ -171,12 +173,18 @@ class YasrMetaboxBelowEditor {
|
|
171 |
*
|
172 |
* @author Dario Curvino <@dudo>
|
173 |
* @since 3.0.6
|
|
|
174 |
* @param $multi_set
|
|
|
175 |
*/
|
176 |
-
|
|
|
|
|
|
|
|
|
177 |
?>
|
178 |
<div style="margin-bottom: 15px">
|
179 |
-
<?php
|
180 |
<br />
|
181 |
<label for="yasr_select_set">
|
182 |
<select id="yasr_select_set" autocomplete="off">
|
@@ -249,9 +257,10 @@ class YasrMetaboxBelowEditor {
|
|
249 |
'yet-another-stars-rating' );
|
250 |
?>
|
251 |
<span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
255 |
|
256 |
<br />
|
257 |
<?php esc_html_e('This is just a preview, you can\'t vote here.', 'yet-another-stars-rating');?>
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
44 |
if($multi_set === false || $n_multi_set === false) {
|
45 |
global $wpdb;
|
46 |
|
47 |
+
$multi_set = YasrMultiSetData::returnMultiSetNames();
|
48 |
$n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the count number of rows of the last query
|
49 |
}
|
50 |
|
130 |
public function addMultisetTab() {
|
131 |
?>
|
132 |
<a href="#" id="yasr-metabox-below-editor-multiset-tab" class="nav-tab yasr-nav-tab">
|
133 |
+
<?php esc_html_e('Multi Criteria', 'yet-another-stars-rating'); ?>
|
134 |
</a>
|
135 |
<?php
|
136 |
}
|
140 |
*
|
141 |
* @author Dario Curvino <@dudo>
|
142 |
* @since 3.0.6
|
143 |
+
*
|
144 |
* @param $post_id
|
145 |
* @param $multi_set
|
146 |
+
* @param $n_multi_set
|
147 |
*/
|
148 |
public function metaboxMultiset($post_id, $multi_set, $n_multi_set) {
|
149 |
wp_nonce_field('yasr_nonce_save_multi_values_action', 'yasr_nonce_save_multi_values');
|
157 |
<div id="yasr-metabox-below-editor-multiset" class="yasr-metabox-below-editor-content" style="display:none">
|
158 |
<?php
|
159 |
if ($n_multi_set > 1) {
|
160 |
+
self::printSelectMultiset($multi_set);
|
161 |
} //End if ($n_multi_set>1)
|
162 |
|
163 |
$this->printMultisetDiv($n_multi_set, $set_id, $post_id);
|
173 |
*
|
174 |
* @author Dario Curvino <@dudo>
|
175 |
* @since 3.0.6
|
176 |
+
*
|
177 |
* @param $multi_set
|
178 |
+
* @param bool|string $select_text
|
179 |
*/
|
180 |
+
public static function printSelectMultiset($multi_set, $select_text=false) {
|
181 |
+
|
182 |
+
if($select_text === false) {
|
183 |
+
$select_text = esc_html__('Choose which set you want to use', 'yet-another-stars-rating');
|
184 |
+
}
|
185 |
?>
|
186 |
<div style="margin-bottom: 15px">
|
187 |
+
<?php echo esc_html($select_text) ?>
|
188 |
<br />
|
189 |
<label for="yasr_select_set">
|
190 |
<select id="yasr_select_set" autocomplete="off">
|
257 |
'yet-another-stars-rating' );
|
258 |
?>
|
259 |
<span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
|
260 |
+
<code id="yasr-editor-copy-visitor-multiset"
|
261 |
+
class="yasr-copy-shortcode">[yasr_visitor_multiset setid=<span class="yasr-editor-multiset-id"></span>]
|
262 |
+
</code>
|
263 |
+
</span>
|
264 |
|
265 |
<br />
|
266 |
<?php esc_html_e('This is just a preview, you can\'t vote here.', 'yet-another-stars-rating');?>
|
admin/editor/YasrMetaboxSchemaFields.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/editor/YasrOnSavePost.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/editor/yasr-metabox-schema.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/editor/yasr-metabox-top-right.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/js/src/yasr-editor-screen.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import {copyToClipboard} from "./yasr-admin-functions";
|
2 |
-
import {v4 as uuidv4} from 'uuid';
|
3 |
|
|
|
4 |
|
5 |
// executes this when the DOM is ready
|
6 |
document.addEventListener('DOMContentLoaded', function(event) {
|
@@ -110,7 +110,7 @@ function yasrPrintMetaBoxBelowEditor () {
|
|
110 |
let selectedItemtype = document.getElementById('yasr-metabox-below-editor-select-schema').value;
|
111 |
|
112 |
if(document.getElementById('yasr-editor-multiset-container') !== null) {
|
113 |
-
|
114 |
}
|
115 |
|
116 |
yasrSwitchItemTypeDiv(selectedItemtype);
|
@@ -204,267 +204,6 @@ function yasrSwitchItemTypeDiv (itemType) {
|
|
204 |
}
|
205 |
}
|
206 |
|
207 |
-
/****** Yasr Metabox Multiple Rating ******/
|
208 |
-
|
209 |
-
function yasrAdminMultiSet() {
|
210 |
-
|
211 |
-
let divContainer = document.getElementById('yasr-editor-multiset-container');
|
212 |
-
let nMultiSet = parseInt(divContainer.getAttribute('data-nmultiset'));
|
213 |
-
let setId = parseInt(divContainer.getAttribute('data-setid'));
|
214 |
-
let postId = parseInt(divContainer.getAttribute('data-postid'));
|
215 |
-
//do not use parseInt here, or an empty value will be converted to 0
|
216 |
-
const yasrProReviewSetid = document.getElementById('yasr-pro-review-setid');
|
217 |
-
const copyRoMultiset = document.getElementById('yasr-editor-copy-readonly-multiset');
|
218 |
-
const copyVisitorMultiset = document.getElementById('yasr-editor-copy-visitor-multiset');
|
219 |
-
const copyAverageMultiSet = document.getElementById('yasr-editor-copy-average-multiset');
|
220 |
-
const copyAverageVVMultiSet = document.getElementById('yasr-editor-copy-average-vvmultiset');
|
221 |
-
const copyAverageCommentsMulti = document.getElementById('yasr-editor-copy-comments-multiset');
|
222 |
-
const reviewsEnabled = document.getElementById('yasr-pro-comments-enabled-yes');
|
223 |
-
const multiSetinReview = document.getElementById('yasr-pro-multiset-review-switcher');
|
224 |
-
|
225 |
-
yasrPrintAdminMultiSet(setId, postId, nMultiSet);
|
226 |
-
|
227 |
-
copyRoMultiset.onclick = function (event) {
|
228 |
-
let el = document.getElementById(event.target.id);
|
229 |
-
copyToClipboard(el.textContent.trim());
|
230 |
-
}
|
231 |
-
|
232 |
-
copyVisitorMultiset.onclick = function (event) {
|
233 |
-
let el = document.getElementById(event.target.id);
|
234 |
-
copyToClipboard(el.textContent.trim());
|
235 |
-
}
|
236 |
-
|
237 |
-
copyAverageMultiSet.onclick = function (event) {
|
238 |
-
let el = document.getElementById(event.target.id);
|
239 |
-
copyToClipboard(el.textContent.trim());
|
240 |
-
}
|
241 |
-
|
242 |
-
copyAverageVVMultiSet.onclick = function (event) {
|
243 |
-
let el = document.getElementById(event.target.id);
|
244 |
-
copyToClipboard(el.textContent.trim());
|
245 |
-
}
|
246 |
-
|
247 |
-
copyAverageCommentsMulti.onclick = function (event) {
|
248 |
-
let el = document.getElementById(event.target.id);
|
249 |
-
copyToClipboard(el.textContent.trim());
|
250 |
-
}
|
251 |
-
|
252 |
-
//add event listener to synchronize switchers
|
253 |
-
if(multiSetinReview !== null) {
|
254 |
-
|
255 |
-
//this only works in classic editor
|
256 |
-
if(reviewsEnabled !== null) {
|
257 |
-
//when reviews in comment are disabled, disable also multiset switcher
|
258 |
-
reviewsEnabled.addEventListener('change', (event) => {
|
259 |
-
if (!event.currentTarget.checked) {
|
260 |
-
multiSetinReview.checked = false;
|
261 |
-
}
|
262 |
-
})
|
263 |
-
}
|
264 |
-
|
265 |
-
//when multiset switcher is enabled, enable also reviews in comment switcher
|
266 |
-
multiSetinReview.addEventListener('change', (event) => {
|
267 |
-
if (event.currentTarget.checked === true) {
|
268 |
-
//if it is classic editor, check reviewsEnabled on true
|
269 |
-
if(reviewsEnabled !== null) {
|
270 |
-
reviewsEnabled.checked = true;
|
271 |
-
} else {
|
272 |
-
//if this is gutenberg, use document.getElementById on change to get the current state and check it
|
273 |
-
document.getElementById('yasr-comment-reviews-disabled-switch').checked = true;
|
274 |
-
}
|
275 |
-
|
276 |
-
//update the hidden field, if only one multiset is used
|
277 |
-
if(yasrProReviewSetid !== null) {
|
278 |
-
yasrProReviewSetid.value = setId;
|
279 |
-
}
|
280 |
-
}
|
281 |
-
else {
|
282 |
-
//update the hidden field, if only one multiset is used
|
283 |
-
if(yasrProReviewSetid !== null) {
|
284 |
-
yasrProReviewSetid.value = '';
|
285 |
-
}
|
286 |
-
}
|
287 |
-
});
|
288 |
-
|
289 |
-
}
|
290 |
-
|
291 |
-
if (nMultiSet > 1) {
|
292 |
-
jQuery('#yasr_select_set').on("change", function () {
|
293 |
-
|
294 |
-
//get the multi data
|
295 |
-
//overwrite setID
|
296 |
-
setId = jQuery('#yasr_select_set').val();
|
297 |
-
|
298 |
-
jQuery("#yasr-loader-select-multi-set").show();
|
299 |
-
|
300 |
-
yasrPrintAdminMultiSet(setId, postId, nMultiSet);
|
301 |
-
|
302 |
-
//update hidden field
|
303 |
-
document.getElementById('yasr-multiset-id').value = setId;
|
304 |
-
|
305 |
-
if(yasrProReviewSetid !== null && yasrProReviewSetid !== '') {
|
306 |
-
if(yasrProReviewSetid.value === setId) {
|
307 |
-
//update hidden field
|
308 |
-
multiSetinReview.checked = true;
|
309 |
-
} else {
|
310 |
-
multiSetinReview.checked = false;
|
311 |
-
}
|
312 |
-
}
|
313 |
-
|
314 |
-
return false; // prevent default click action from happening!
|
315 |
-
});
|
316 |
-
|
317 |
-
}
|
318 |
-
|
319 |
-
}
|
320 |
-
|
321 |
-
//print the table
|
322 |
-
function yasrPrintAdminMultiSet(setId, postid, nMultiSet) {
|
323 |
-
|
324 |
-
const data_id = {
|
325 |
-
action: 'yasr_send_id_nameset',
|
326 |
-
set_id: setId,
|
327 |
-
post_id: postid
|
328 |
-
};
|
329 |
-
|
330 |
-
jQuery.post(ajaxurl, data_id, function (response) {
|
331 |
-
//Hide the loader near the select only if more multiset are used
|
332 |
-
if (nMultiSet > 1) {
|
333 |
-
document.getElementById('yasr-loader-select-multi-set').style.display = 'none';
|
334 |
-
}
|
335 |
-
|
336 |
-
let yasrMultiSetValue = JSON.parse(response);
|
337 |
-
let tableAuthorMulti = document.getElementById('yasr-table-multi-set-admin');
|
338 |
-
let tableAuthorVisitor = document.getElementById('yasr-table-multi-set-admin-visitor');
|
339 |
-
|
340 |
-
yasrReturnTableMultiset(yasrMultiSetValue, tableAuthorMulti);
|
341 |
-
yasrReturnTableMultiset(yasrMultiSetValue, tableAuthorVisitor, false);
|
342 |
-
|
343 |
-
//Set rater for divs
|
344 |
-
yasrSetRaterAdminMulti();
|
345 |
-
yasrSetRaterAdminMulti(false);
|
346 |
-
|
347 |
-
let spanWithSetID = document.getElementsByClassName('yasr-editor-multiset-id');
|
348 |
-
|
349 |
-
for (let i = 0; i < spanWithSetID.length; i++) {
|
350 |
-
spanWithSetID[i].innerText = setId;
|
351 |
-
}
|
352 |
-
|
353 |
-
});
|
354 |
-
|
355 |
-
return false; // prevent default click action from happening!
|
356 |
-
|
357 |
-
}
|
358 |
-
|
359 |
-
/**
|
360 |
-
*
|
361 |
-
* @param yasrMultiSetValue
|
362 |
-
* @param table
|
363 |
-
* @param authorMultiset
|
364 |
-
*/
|
365 |
-
function yasrReturnTableMultiset (yasrMultiSetValue, table, authorMultiset=true) {
|
366 |
-
|
367 |
-
let content = '';
|
368 |
-
let divClass = 'yasr-multiset-admin'
|
369 |
-
|
370 |
-
for (let i = 0; i < yasrMultiSetValue.length; i++) {
|
371 |
-
let valueName = yasrMultiSetValue[i]['name'];
|
372 |
-
let valueRating = 0;
|
373 |
-
let readonly = true;
|
374 |
-
|
375 |
-
if(authorMultiset !== false) {
|
376 |
-
valueRating = yasrMultiSetValue[i]['average_rating'];
|
377 |
-
readonly = false;
|
378 |
-
divClass = 'yasr-multiset-admin-author'
|
379 |
-
}
|
380 |
-
|
381 |
-
let valueID = yasrMultiSetValue[i]['id'];
|
382 |
-
|
383 |
-
content += '<tr>';
|
384 |
-
content += '<td>' + valueName + '</td>';
|
385 |
-
content += '<td><div class='+divClass+' id="yasr-multiset-admin-' + uuidv4() + '" data-rating="'
|
386 |
-
+ valueRating + '" data-multi-idfield="' + valueID + '" data-readonly="'+ readonly +'"></div>';
|
387 |
-
content += '</td>';
|
388 |
-
content += '</tr>';
|
389 |
-
}
|
390 |
-
|
391 |
-
if(authorMultiset === false) {
|
392 |
-
let button = '<tr><td colspan="2"><input type="submit" class="button button-primary" value="Submit!" disabled></td></tr>';
|
393 |
-
content += button;
|
394 |
-
}
|
395 |
-
|
396 |
-
table.innerHTML = content;
|
397 |
-
|
398 |
-
}
|
399 |
-
|
400 |
-
/**
|
401 |
-
*
|
402 |
-
* @param authorMultiset
|
403 |
-
*/
|
404 |
-
function yasrSetRaterAdminMulti(authorMultiset=true) {
|
405 |
-
|
406 |
-
let divClass;
|
407 |
-
if(authorMultiset !== false) {
|
408 |
-
divClass = 'yasr-multiset-admin-author';
|
409 |
-
} else {
|
410 |
-
divClass = 'yasr-multiset-admin';
|
411 |
-
}
|
412 |
-
|
413 |
-
const yasrMultiSetAdmin = document.getElementsByClassName(divClass);
|
414 |
-
|
415 |
-
//an array with all the ratings objects
|
416 |
-
let ratingArray = [];
|
417 |
-
let ratingValue = false;
|
418 |
-
|
419 |
-
for (let i = 0; i < yasrMultiSetAdmin.length; i++) {
|
420 |
-
|
421 |
-
(function (i) {
|
422 |
-
|
423 |
-
let htmlId = yasrMultiSetAdmin.item(i).id;
|
424 |
-
let elem = document.getElementById(htmlId);
|
425 |
-
|
426 |
-
let setIdField = parseInt(elem.getAttribute('data-multi-idfield'));
|
427 |
-
let ratingOnLoad = parseInt(elem.getAttribute('data-rating'));
|
428 |
-
//convert into boolean https://stackoverflow.com/a/264037/3472877
|
429 |
-
let readOnly = (elem.getAttribute('data-readonly') === 'true');
|
430 |
-
|
431 |
-
let ratingObjectOnLoad = {
|
432 |
-
field: setIdField,
|
433 |
-
rating: ratingOnLoad
|
434 |
-
};
|
435 |
-
|
436 |
-
//creating rating array
|
437 |
-
ratingArray.push(ratingObjectOnLoad);
|
438 |
-
|
439 |
-
const rateCallback = function (rating, done) {
|
440 |
-
rating = rating.toFixed(1);
|
441 |
-
//Be sure is a number and not a string
|
442 |
-
rating = parseFloat(rating);
|
443 |
-
this.setRating(rating); //Set the rating
|
444 |
-
|
445 |
-
//loop the array with existing rates
|
446 |
-
for (let j = 0; j < ratingArray.length; j++) {
|
447 |
-
//if the field of the array is the same of the rated field, get the rating
|
448 |
-
if(ratingArray[j].field === setIdField) {
|
449 |
-
//the selected rating overwrite the existing one
|
450 |
-
ratingArray[j].rating = rating;
|
451 |
-
}
|
452 |
-
}
|
453 |
-
|
454 |
-
ratingValue = JSON.stringify(ratingArray);
|
455 |
-
|
456 |
-
//update hidden field
|
457 |
-
document.getElementById('yasr-multiset-author-votes').value = ratingValue;
|
458 |
-
|
459 |
-
done();
|
460 |
-
}
|
461 |
-
|
462 |
-
yasrSetRaterValue(32, htmlId, false, 0.5, readOnly, false, rateCallback);
|
463 |
-
|
464 |
-
})(i);
|
465 |
-
|
466 |
-
} //End for
|
467 |
-
}//End function
|
468 |
|
469 |
/****** End Yasr Metabox Multple Rating ******/
|
470 |
|
1 |
import {copyToClipboard} from "./yasr-admin-functions";
|
|
|
2 |
|
3 |
+
import {yasrMultiCriteriaEditPage} from "./yasrMultiCriteriaUtils";
|
4 |
|
5 |
// executes this when the DOM is ready
|
6 |
document.addEventListener('DOMContentLoaded', function(event) {
|
110 |
let selectedItemtype = document.getElementById('yasr-metabox-below-editor-select-schema').value;
|
111 |
|
112 |
if(document.getElementById('yasr-editor-multiset-container') !== null) {
|
113 |
+
yasrMultiCriteriaEditPage();
|
114 |
}
|
115 |
|
116 |
yasrSwitchItemTypeDiv(selectedItemtype);
|
204 |
}
|
205 |
}
|
206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
/****** End Yasr Metabox Multple Rating ******/
|
209 |
|
admin/js/src/yasr-settings-page.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
/****** Yasr Settings Page ******/
|
2 |
|
|
|
|
|
3 |
//get active Tab
|
4 |
let activeTab;
|
5 |
let tabClass = document.getElementsByClassName('nav-tab-active');
|
@@ -70,15 +72,19 @@ if (activeTab === 'style_options') {
|
|
70 |
|
71 |
//--------------Multi Sets Page ------------------
|
72 |
if (activeTab === 'manage_multi') {
|
73 |
-
let nMultiSet = parseInt(document.getElementById('n-multiset').value);
|
74 |
|
75 |
-
|
76 |
-
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
77 |
-
});
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
if (nMultiSet === 1) {
|
84 |
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
@@ -86,6 +92,7 @@ if (activeTab === 'manage_multi') {
|
|
86 |
counter++;
|
87 |
|
88 |
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
|
|
89 |
if (counter > 9) {
|
90 |
jQuery('#yasr-element-limit').show();
|
91 |
jQuery('#yasr-add-field-edit-multiset').hide();
|
@@ -103,7 +110,7 @@ if (activeTab === 'manage_multi') {
|
|
103 |
|
104 |
else if (nMultiSet > 1) {
|
105 |
|
106 |
-
//If more
|
107 |
jQuery('#yasr-button-select-set-edit-form').on("click", function () {
|
108 |
|
109 |
var data = {
|
@@ -125,6 +132,7 @@ if (activeTab === 'manage_multi') {
|
|
125 |
counter++;
|
126 |
|
127 |
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
|
|
128 |
if (counter > 9) {
|
129 |
jQuery('#yasr-element-limit').show();
|
130 |
jQuery('#yasr-add-field-edit-multiset').hide();
|
@@ -140,6 +148,7 @@ if (activeTab === 'manage_multi') {
|
|
140 |
|
141 |
} //End if ($n_multi_set > 1)
|
142 |
|
|
|
143 |
} //end if active_tab=='manage_multi'
|
144 |
|
145 |
if (activeTab === 'migration_tools') {
|
1 |
/****** Yasr Settings Page ******/
|
2 |
|
3 |
+
import {addMultisetCriteria, removeMultisetCriteria, selectMultiset} from "./yasrMultiCriteriaUtils";
|
4 |
+
|
5 |
//get active Tab
|
6 |
let activeTab;
|
7 |
let tabClass = document.getElementsByClassName('nav-tab-active');
|
72 |
|
73 |
//--------------Multi Sets Page ------------------
|
74 |
if (activeTab === 'manage_multi') {
|
|
|
75 |
|
76 |
+
let nMultiSet = parseInt(document.getElementById('n-multiset').value);
|
|
|
|
|
77 |
|
78 |
+
//Manage the "Add new Criteria" button
|
79 |
+
addMultisetCriteria ();
|
80 |
+
|
81 |
+
//Manage the delete Multi Criteria Button
|
82 |
+
removeMultisetCriteria ();
|
83 |
+
|
84 |
+
// executes this when the DOM is ready
|
85 |
+
/*document.addEventListener('DOMContentLoaded', function(event) {
|
86 |
+
selectMultiset(nMultiSet)
|
87 |
+
});*/
|
88 |
|
89 |
if (nMultiSet === 1) {
|
90 |
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
92 |
counter++;
|
93 |
|
94 |
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
95 |
+
//@todo increase number of element that can be stored
|
96 |
if (counter > 9) {
|
97 |
jQuery('#yasr-element-limit').show();
|
98 |
jQuery('#yasr-add-field-edit-multiset').hide();
|
110 |
|
111 |
else if (nMultiSet > 1) {
|
112 |
|
113 |
+
//If more than 1 set is used...
|
114 |
jQuery('#yasr-button-select-set-edit-form').on("click", function () {
|
115 |
|
116 |
var data = {
|
132 |
counter++;
|
133 |
|
134 |
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
135 |
+
//@todo increase number of element that can be stored
|
136 |
if (counter > 9) {
|
137 |
jQuery('#yasr-element-limit').show();
|
138 |
jQuery('#yasr-add-field-edit-multiset').hide();
|
148 |
|
149 |
} //End if ($n_multi_set > 1)
|
150 |
|
151 |
+
|
152 |
} //end if active_tab=='manage_multi'
|
153 |
|
154 |
if (activeTab === 'migration_tools') {
|
admin/js/src/yasrMultiCriteriaUtils.js
ADDED
@@ -0,0 +1,482 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import {copyToClipboard} from "./yasr-admin-functions";
|
2 |
+
import {v4 as uuidv4} from "uuid";
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Used in settings page, add a new criteria when creating a new set
|
6 |
+
*
|
7 |
+
* Handle the "Add new Criteria" button
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
export const addMultisetCriteria = () => {
|
11 |
+
|
12 |
+
//This is the container of all criteria input
|
13 |
+
const parentDiv = document.getElementById('new-set-criteria-container');
|
14 |
+
|
15 |
+
const newElementButton = document.getElementById('new-criteria-button');
|
16 |
+
|
17 |
+
newElementButton.onclick = (event) => {
|
18 |
+
event.preventDefault();
|
19 |
+
|
20 |
+
//array with all div values
|
21 |
+
let rows = returnArrayElementsValues('removable-criteria');
|
22 |
+
|
23 |
+
//find if there is a missing number in array
|
24 |
+
let missingNumber = returnArrayMissingNumber(rows);
|
25 |
+
|
26 |
+
let newRowNumber;
|
27 |
+
|
28 |
+
//the first element to insert must be a missingNumber, otherwise array.lenght+1
|
29 |
+
if(missingNumber !== false) {
|
30 |
+
newRowNumber = missingNumber;
|
31 |
+
} else {
|
32 |
+
newRowNumber = rows.length + 1;
|
33 |
+
}
|
34 |
+
|
35 |
+
//Row number must be >= 3 and < 9
|
36 |
+
if(newRowNumber < 3 || newRowNumber > 9 ) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
//Create the div
|
41 |
+
const newDiv = createNewCriteria(newRowNumber);
|
42 |
+
|
43 |
+
//insert (or append) the new div
|
44 |
+
insertNewCriteria(missingNumber, newRowNumber, parentDiv, newDiv);
|
45 |
+
|
46 |
+
//add new event onClick on new button delete
|
47 |
+
removeMultisetCriteria();
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Manage the click on buttonDelete
|
53 |
+
*
|
54 |
+
* @param startFor | 3 At page load, first button delete start on row 3
|
55 |
+
*/
|
56 |
+
export const removeMultisetCriteria = (startFor = 3) => {
|
57 |
+
//Number of existing rows
|
58 |
+
const nOfCriteria = returnArrayElementsValues('removable-criteria').length;
|
59 |
+
|
60 |
+
//add an onclick event for every delete button
|
61 |
+
for (let i = startFor; i <= nOfCriteria; i++) {
|
62 |
+
const buttonDelete = document.getElementById(`remove-criteria-${i}`);
|
63 |
+
|
64 |
+
if(buttonDelete !== null) {
|
65 |
+
buttonDelete.onclick = (event) => {
|
66 |
+
let idDivToRemove = buttonDelete.dataset.idCriteria;
|
67 |
+
document.getElementById(idDivToRemove).remove();
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
}//End for
|
72 |
+
|
73 |
+
//call this again or "Add new criteria will not work after "
|
74 |
+
addMultisetCriteria();
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Return an array of int with all the "value" attribute of an element.
|
79 |
+
*
|
80 |
+
* This function can't be used if the element doesn't have the "value" attribute!!
|
81 |
+
*
|
82 |
+
* @param className
|
83 |
+
* @returns {number[]}
|
84 |
+
*/
|
85 |
+
const returnArrayElementsValues = (className) => {
|
86 |
+
return [...document.getElementsByClassName(className)]
|
87 |
+
.map(el => parseInt(el.attributes.value.value));
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Return the first number missing in an array, and if none is found, just array.length +1
|
92 |
+
*
|
93 |
+
* @param array
|
94 |
+
* @returns {boolean}
|
95 |
+
*/
|
96 |
+
const returnArrayMissingNumber = (array) => {
|
97 |
+
let missingNumber = false
|
98 |
+
|
99 |
+
//be sure array is sorted
|
100 |
+
array.sort()
|
101 |
+
|
102 |
+
//find the first missing number in array
|
103 |
+
for (let i = 1; i <= array.length; i++) {
|
104 |
+
if (array.indexOf(i) === -1) {
|
105 |
+
missingNumber = i;
|
106 |
+
break; //break at first missing number
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
return missingNumber;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Return a row with new criteria
|
115 |
+
*
|
116 |
+
* @returns {*}
|
117 |
+
*/
|
118 |
+
const createNewCriteria = (newRowNumber) => {
|
119 |
+
//Create the div
|
120 |
+
const newCriteria = document.createElement('div');
|
121 |
+
|
122 |
+
newCriteria.id = `criteria-row-container-${newRowNumber}`;
|
123 |
+
newCriteria.className = `criteria-row removable-criteria`;
|
124 |
+
|
125 |
+
newCriteria.setAttribute("value", newRowNumber); //newCriteria.value doesnt' work here
|
126 |
+
|
127 |
+
newCriteria.innerHTML = `
|
128 |
+
<label for="multi-set-name-element-${newRowNumber}">
|
129 |
+
</label>
|
130 |
+
<input type="text"
|
131 |
+
name="multi-set-name-element-${newRowNumber}"
|
132 |
+
id="multi-set-name-element-${newRowNumber}"
|
133 |
+
class="input-text-multi-set"
|
134 |
+
placeholder="New Criteria"
|
135 |
+
/>
|
136 |
+
<span
|
137 |
+
class="dashicons dashicons-remove yasr-multiset-info-delete criteria-delete"
|
138 |
+
id="remove-criteria-${newRowNumber}"
|
139 |
+
data-id-criteria="${newCriteria.id}"
|
140 |
+
>
|
141 |
+
</span>`;
|
142 |
+
|
143 |
+
return newCriteria;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* insert (or append) the new div when creating the new set
|
148 |
+
*
|
149 |
+
* @param missingNumber
|
150 |
+
* @param newRowNumber
|
151 |
+
* @param parentDiv
|
152 |
+
* @param newDiv
|
153 |
+
*/
|
154 |
+
const insertNewCriteria = (missingNumber, newRowNumber, parentDiv, newDiv) => {
|
155 |
+
if(missingNumber !== false) {
|
156 |
+
//value to increase newRowNumber
|
157 |
+
let j = 1;
|
158 |
+
|
159 |
+
for(let i=3; i<9; i++) {
|
160 |
+
let nextId = newRowNumber + j;
|
161 |
+
let idNextNode = `criteria-row-container-${nextId}`;
|
162 |
+
|
163 |
+
//if idNextNode exists, insert the new div before
|
164 |
+
if(!!document.getElementById(idNextNode) === true) {
|
165 |
+
let nextDiv = document.getElementById(idNextNode);
|
166 |
+
parentDiv.insertBefore(newDiv, nextDiv);
|
167 |
+
|
168 |
+
//job done, break the loop
|
169 |
+
break;
|
170 |
+
}
|
171 |
+
|
172 |
+
//otherwise increase J
|
173 |
+
j++;
|
174 |
+
}
|
175 |
+
}
|
176 |
+
//just do appendChild if we're adding and no field was removed
|
177 |
+
else {
|
178 |
+
document.getElementById('new-set-criteria-container').appendChild(newDiv);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Used in edit page, print the new set in the box below the editor
|
185 |
+
*/
|
186 |
+
|
187 |
+
export const yasrMultiCriteriaEditPage = () => {
|
188 |
+
|
189 |
+
let divContainer = document.getElementById('yasr-editor-multiset-container');
|
190 |
+
let nMultiSet = parseInt(divContainer.getAttribute('data-nmultiset'));
|
191 |
+
let setId = parseInt(divContainer.getAttribute('data-setid'));
|
192 |
+
let postId = parseInt(divContainer.getAttribute('data-postid'));
|
193 |
+
//do not use parseInt here, or an empty value will be converted to 0
|
194 |
+
const yasrProReviewSetid = document.getElementById('yasr-pro-review-setid');
|
195 |
+
const copyRoMultiset = document.getElementById('yasr-editor-copy-readonly-multiset');
|
196 |
+
const copyVisitorMultiset = document.getElementById('yasr-editor-copy-visitor-multiset');
|
197 |
+
const copyAverageMultiSet = document.getElementById('yasr-editor-copy-average-multiset');
|
198 |
+
const copyAverageVVMultiSet = document.getElementById('yasr-editor-copy-average-vvmultiset');
|
199 |
+
const copyAverageCommentsMulti = document.getElementById('yasr-editor-copy-comments-multiset');
|
200 |
+
const reviewsEnabled = document.getElementById('yasr-pro-comments-enabled-yes');
|
201 |
+
const multiSetinReview = document.getElementById('yasr-pro-multiset-review-switcher');
|
202 |
+
|
203 |
+
yasrPrintMultiCriteriaEditPage(setId, postId, nMultiSet);
|
204 |
+
|
205 |
+
copyRoMultiset.onclick = function (event) {
|
206 |
+
let el = document.getElementById(event.target.id);
|
207 |
+
copyToClipboard(el.textContent.trim());
|
208 |
+
}
|
209 |
+
|
210 |
+
copyVisitorMultiset.onclick = function (event) {
|
211 |
+
let el = document.getElementById(event.target.id);
|
212 |
+
copyToClipboard(el.textContent.trim());
|
213 |
+
}
|
214 |
+
|
215 |
+
copyAverageMultiSet.onclick = function (event) {
|
216 |
+
let el = document.getElementById(event.target.id);
|
217 |
+
copyToClipboard(el.textContent.trim());
|
218 |
+
}
|
219 |
+
|
220 |
+
copyAverageVVMultiSet.onclick = function (event) {
|
221 |
+
let el = document.getElementById(event.target.id);
|
222 |
+
copyToClipboard(el.textContent.trim());
|
223 |
+
}
|
224 |
+
|
225 |
+
copyAverageCommentsMulti.onclick = function (event) {
|
226 |
+
let el = document.getElementById(event.target.id);
|
227 |
+
copyToClipboard(el.textContent.trim());
|
228 |
+
}
|
229 |
+
|
230 |
+
//add event listener to synchronize switchers
|
231 |
+
sincronizeEditorSwitchers (multiSetinReview, reviewsEnabled, yasrProReviewSetid, setId);
|
232 |
+
|
233 |
+
//show a select if more than 1 multiset is used
|
234 |
+
selectMultiset(nMultiSet, postId, yasrProReviewSetid, multiSetinReview)
|
235 |
+
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* when multiset multiSetinReview is enabled, enable also reviews in comment multiSetinReview
|
240 |
+
*
|
241 |
+
* @param multiSetinReview | Switcher for question Insert this Multi Set in the comment form?
|
242 |
+
* @param reviewsEnabled | Switcher to enable or disable reviews in comments
|
243 |
+
* @param yasrProReviewSetid | the set id to use into the comment form
|
244 |
+
* @param setId
|
245 |
+
*/
|
246 |
+
const sincronizeEditorSwitchers = (multiSetinReview, reviewsEnabled, yasrProReviewSetid, setId) => {
|
247 |
+
//add event listener to synchronize switchers
|
248 |
+
if(multiSetinReview !== null) {
|
249 |
+
|
250 |
+
//this only works in classic editor
|
251 |
+
if (reviewsEnabled !== null) {
|
252 |
+
//when reviews in comment are disabled, disable also multiset multiSetinReview
|
253 |
+
reviewsEnabled.addEventListener('change', (event) => {
|
254 |
+
if (!event.currentTarget.checked) {
|
255 |
+
multiSetinReview.checked = false;
|
256 |
+
}
|
257 |
+
})
|
258 |
+
}
|
259 |
+
|
260 |
+
multiSetinReview.addEventListener('change', (event) => {
|
261 |
+
if (event.currentTarget.checked === true) {
|
262 |
+
//if it is classic editor, check reviewsEnabled on true
|
263 |
+
if (reviewsEnabled !== null) {
|
264 |
+
reviewsEnabled.checked = true;
|
265 |
+
} else {
|
266 |
+
//if this is gutenberg, use document.getElementById on change to get the current state and check it
|
267 |
+
document.getElementById('yasr-comment-reviews-disabled-switch').checked = true;
|
268 |
+
}
|
269 |
+
|
270 |
+
//update the hidden field, if only one multiset is used
|
271 |
+
if (yasrProReviewSetid !== null) {
|
272 |
+
yasrProReviewSetid.value = setId;
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
//update the hidden field, if only one multiset is used
|
276 |
+
if (yasrProReviewSetid !== null) {
|
277 |
+
yasrProReviewSetid.value = '';
|
278 |
+
}
|
279 |
+
}
|
280 |
+
});
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Show the select if more than one multiset is used
|
286 |
+
*
|
287 |
+
* @param nMultiSet
|
288 |
+
* @param postId bool | int
|
289 |
+
* @param yasrProReviewSetid
|
290 |
+
* @param multiSetinReview
|
291 |
+
*/
|
292 |
+
export const selectMultiset = (nMultiSet, postId=false, yasrProReviewSetid = null, multiSetinReview = null) => {
|
293 |
+
if (nMultiSet > 1) {
|
294 |
+
jQuery('#yasr_select_set').on("change", function () {
|
295 |
+
|
296 |
+
//get the multi data
|
297 |
+
//overwrite setID
|
298 |
+
let setId = jQuery('#yasr_select_set').val();
|
299 |
+
|
300 |
+
jQuery("#yasr-loader-select-multi-set").show();
|
301 |
+
|
302 |
+
if (postId !== false) {
|
303 |
+
yasrPrintMultiCriteriaEditPage(setId, postId, nMultiSet);
|
304 |
+
}
|
305 |
+
|
306 |
+
//@todo { else to call a function when not in an edit context
|
307 |
+
|
308 |
+
|
309 |
+
//update hidden field
|
310 |
+
document.getElementById('yasr-multiset-id').value = setId;
|
311 |
+
|
312 |
+
if(yasrProReviewSetid !== null && yasrProReviewSetid !== '' && multiSetinReview !== null) {
|
313 |
+
if(yasrProReviewSetid.value === setId) {
|
314 |
+
//update hidden field
|
315 |
+
multiSetinReview.checked = true;
|
316 |
+
} else {
|
317 |
+
multiSetinReview.checked = false;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
return false; // prevent default click action from happening!
|
322 |
+
});
|
323 |
+
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* First do the ajax call, then print the multiset with rating for the post
|
329 |
+
*
|
330 |
+
* @param setId
|
331 |
+
* @param postid
|
332 |
+
* @param nMultiSet
|
333 |
+
* @returns {boolean}
|
334 |
+
*/
|
335 |
+
const yasrPrintMultiCriteriaEditPage = (setId, postid, nMultiSet) => {
|
336 |
+
|
337 |
+
const data_id = {
|
338 |
+
action: 'yasr_send_id_nameset',
|
339 |
+
set_id: setId,
|
340 |
+
post_id: postid
|
341 |
+
};
|
342 |
+
|
343 |
+
jQuery.post(ajaxurl, data_id, function (response) {
|
344 |
+
//Hide the loader near the select only if more multiset are used
|
345 |
+
if (nMultiSet > 1) {
|
346 |
+
document.getElementById('yasr-loader-select-multi-set').style.display = 'none';
|
347 |
+
}
|
348 |
+
|
349 |
+
let yasrMultiSetValue = JSON.parse(response);
|
350 |
+
let tableAuthorMulti = document.getElementById('yasr-table-multi-set-admin');
|
351 |
+
let tableAuthorVisitor = document.getElementById('yasr-table-multi-set-admin-visitor');
|
352 |
+
|
353 |
+
yasrReturnTableMultiset(yasrMultiSetValue, tableAuthorMulti);
|
354 |
+
yasrReturnTableMultiset(yasrMultiSetValue, tableAuthorVisitor, false);
|
355 |
+
|
356 |
+
//Set rater for divs
|
357 |
+
yasrSetRaterAdminMulti();
|
358 |
+
yasrSetRaterAdminMulti(false);
|
359 |
+
|
360 |
+
let spanWithSetID = document.getElementsByClassName('yasr-editor-multiset-id');
|
361 |
+
|
362 |
+
for (let i = 0; i < spanWithSetID.length; i++) {
|
363 |
+
spanWithSetID[i].innerText = setId;
|
364 |
+
}
|
365 |
+
|
366 |
+
});
|
367 |
+
|
368 |
+
return false; // prevent default click action from happening!
|
369 |
+
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
/**
|
374 |
+
*
|
375 |
+
* @param yasrMultiSetValue
|
376 |
+
* @param table
|
377 |
+
* @param authorMultiset
|
378 |
+
*/
|
379 |
+
const yasrReturnTableMultiset = (yasrMultiSetValue, table, authorMultiset=true) => {
|
380 |
+
|
381 |
+
let content = '';
|
382 |
+
let divClass = 'yasr-multiset-admin'
|
383 |
+
|
384 |
+
for (let i = 0; i < yasrMultiSetValue.length; i++) {
|
385 |
+
let valueName = yasrMultiSetValue[i]['name'];
|
386 |
+
let valueRating = 0;
|
387 |
+
let readonly = true;
|
388 |
+
|
389 |
+
if(authorMultiset !== false) {
|
390 |
+
valueRating = yasrMultiSetValue[i]['average_rating'];
|
391 |
+
readonly = false;
|
392 |
+
divClass = 'yasr-multiset-admin-author'
|
393 |
+
}
|
394 |
+
|
395 |
+
let valueID = yasrMultiSetValue[i]['id'];
|
396 |
+
|
397 |
+
content += '<tr>';
|
398 |
+
content += '<td>' + valueName + '</td>';
|
399 |
+
content += '<td><div class='+divClass+' id="yasr-multiset-admin-' + uuidv4() + '" data-rating="'
|
400 |
+
+ valueRating + '" data-multi-idfield="' + valueID + '" data-readonly="'+ readonly +'"></div>';
|
401 |
+
content += '</td>';
|
402 |
+
content += '</tr>';
|
403 |
+
}
|
404 |
+
|
405 |
+
if(authorMultiset === false) {
|
406 |
+
let button = '<tr><td colspan="2"><input type="submit" class="button button-primary" value="Submit!" disabled></td></tr>';
|
407 |
+
content += button;
|
408 |
+
}
|
409 |
+
|
410 |
+
table.innerHTML = content;
|
411 |
+
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
*
|
416 |
+
* @param authorMultiset
|
417 |
+
*/
|
418 |
+
const yasrSetRaterAdminMulti = (authorMultiset=true) => {
|
419 |
+
|
420 |
+
let divClass;
|
421 |
+
if(authorMultiset !== false) {
|
422 |
+
divClass = 'yasr-multiset-admin-author';
|
423 |
+
} else {
|
424 |
+
divClass = 'yasr-multiset-admin';
|
425 |
+
}
|
426 |
+
|
427 |
+
const yasrMultiSetAdmin = document.getElementsByClassName(divClass);
|
428 |
+
|
429 |
+
//an array with all the ratings objects
|
430 |
+
let ratingArray = [];
|
431 |
+
let ratingValue = false;
|
432 |
+
|
433 |
+
for (let i = 0; i < yasrMultiSetAdmin.length; i++) {
|
434 |
+
|
435 |
+
(function (i) {
|
436 |
+
|
437 |
+
let htmlId = yasrMultiSetAdmin.item(i).id;
|
438 |
+
let elem = document.getElementById(htmlId);
|
439 |
+
|
440 |
+
let setIdField = parseInt(elem.getAttribute('data-multi-idfield'));
|
441 |
+
let ratingOnLoad = parseInt(elem.getAttribute('data-rating'));
|
442 |
+
//convert into boolean https://stackoverflow.com/a/264037/3472877
|
443 |
+
let readOnly = (elem.getAttribute('data-readonly') === 'true');
|
444 |
+
|
445 |
+
let ratingObjectOnLoad = {
|
446 |
+
field: setIdField,
|
447 |
+
rating: ratingOnLoad
|
448 |
+
};
|
449 |
+
|
450 |
+
//creating rating array
|
451 |
+
ratingArray.push(ratingObjectOnLoad);
|
452 |
+
|
453 |
+
const rateCallback = function (rating, done) {
|
454 |
+
rating = rating.toFixed(1);
|
455 |
+
//Be sure is a number and not a string
|
456 |
+
rating = parseFloat(rating);
|
457 |
+
this.setRating(rating); //Set the rating
|
458 |
+
|
459 |
+
//loop the array with existing rates
|
460 |
+
for (let j = 0; j < ratingArray.length; j++) {
|
461 |
+
//if the field of the array is the same of the rated field, get the rating
|
462 |
+
if(ratingArray[j].field === setIdField) {
|
463 |
+
//the selected rating overwrite the existing one
|
464 |
+
ratingArray[j].rating = rating;
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
ratingValue = JSON.stringify(ratingArray);
|
469 |
+
|
470 |
+
//update hidden field
|
471 |
+
document.getElementById('yasr-multiset-author-votes').value = ratingValue;
|
472 |
+
|
473 |
+
done();
|
474 |
+
}
|
475 |
+
|
476 |
+
yasrSetRaterValue(32, htmlId, false, 0.5, readOnly, false, rateCallback);
|
477 |
+
|
478 |
+
})(i);
|
479 |
+
|
480 |
+
} //End for
|
481 |
+
|
482 |
+
}//End function
|
admin/js/yasr-editor-screen.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(()=>{"use strict";var e={607:(e,t,n)=>{n.d(t,{v:()=>o});const o=e=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)};tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"})}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e,t=n(607),o=new Uint8Array(16);function a(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}const i=/^(?:[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;const s=function(e){return"string"==typeof e&&i.test(e)};for(var r=[],l=0;l<256;++l)r.push((l+256).toString(16).substr(1));const d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]).toLowerCase();if(!s(n))throw TypeError("Stringified UUID is invalid");return n};const y=function(e,t,n){var o=(e=e||{}).random||(e.rng||a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return d(o)};function c(e){"Product"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"LocalBusiness"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Recipe"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"SoftwareApplication"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Book"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Movie"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none"):document.getElementById("yasr-metabox-info-snippet-container").style.display="none"}function m(e,t,n){const o={action:"yasr_send_id_nameset",set_id:e,post_id:t};return jQuery.post(ajaxurl,o,(function(t){n>1&&(document.getElementById("yasr-loader-select-multi-set").style.display="none");let o=JSON.parse(t),a=document.getElementById("yasr-table-multi-set-admin"),i=document.getElementById("yasr-table-multi-set-admin-visitor");u(o,a),u(o,i,!1),p(),p(!1);let s=document.getElementsByClassName("yasr-editor-multiset-id");for(let t=0;t<s.length;t++)s[t].innerText=e})),!1}function u(e,t,n=!0){let o="",a="yasr-multiset-admin";for(let t=0;t<e.length;t++){let i=e[t].name,s=0,r=!0;!1!==n&&(s=e[t].average_rating,r=!1,a="yasr-multiset-admin-author");let l=e[t].id;o+="<tr>",o+="<td>"+i+"</td>",o+="<td><div class="+a+' id="yasr-multiset-admin-'+y()+'" data-rating="'+s+'" data-multi-idfield="'+l+'" data-readonly="'+r+'"></div>',o+="</td>",o+="</tr>"}if(!1===n){o+='<tr><td colspan="2"><input type="submit" class="button button-primary" value="Submit!" disabled></td></tr>'}t.innerHTML=o}function p(e=!0){let t;t=!1!==e?"yasr-multiset-admin-author":"yasr-multiset-admin";const n=document.getElementsByClassName(t);let o=[],a=!1;for(let e=0;e<n.length;e++)!function(e){let t=n.item(e).id,i=document.getElementById(t),s=parseInt(i.getAttribute("data-multi-idfield")),r=parseInt(i.getAttribute("data-rating")),l="true"===i.getAttribute("data-readonly"),d={field:s,rating:r};o.push(d);yasrSetRaterValue(32,t,!1,.5,l,!1,(function(e,t){e=e.toFixed(1),e=parseFloat(e),this.setRating(e);for(let t=0;t<o.length;t++)o[t].field===s&&(o[t].rating=e);a=JSON.stringify(o),document.getElementById("yasr-multiset-author-votes").value=a,t()}))}(e)}document.addEventListener("DOMContentLoaded",(function(e){!0!==document.body.classList.contains("block-editor-page")&&(function(){let e=parseFloat(document.getElementById("yasr-overall-rating-value").value);const n=document.getElementById("yasr-editor-copy-overall");null!==n&&(n.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())});raterJs({starSize:32,step:.1,showToolTip:!1,rating:e,readOnly:!1,element:document.getElementById("yasr-rater-overall"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),document.getElementById("yasr-overall-rating-value").value=e,this.setRating(e);let n="You've rated";document.getElementById("yasr_overall_text").textContent=n+" "+e,t()}})}(),function(){jQuery("#yasr-shortcode-creator").on("click",(function(){tb_show("Ranking Creator","#TB_inline?width=770&height=700&inlineId=yasr-tinypopup-form"),jQuery("#TB_window").css({width:"800px"})})),jQuery("#yasr-builder-copy-shortcode").on("click",(function(){tb_remove()}));let e=!1;null!==document.getElementById("yasr-editor-multiset-container")&&(e=!0);const t=document.getElementById("yasr-tinypopup-link-doc");jQuery("#yasr-link-tab-main").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-main").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-main").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-shortcodes?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-link-tab-charts").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-charts").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-charts").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-shortcodes/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen#yasr-rankings-shortcodes")})),jQuery("#yasr-overall").on("click",(function(){jQuery("#yasr-overall-choose-size").toggle("slow")})),jQuery("#yasr-visitor-votes").on("click",(function(){jQuery("#yasr-visitor-choose-size").toggle("slow")})),jQuery(".yasr-tinymce-shortcode-buttons").on("click",(function(){let e=this.getAttribute("data-shortcode");null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()})),!0===e&&jQuery("#yasr-insert-multiset-select").on("click",(function(){let e,t=jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();e=jQuery("#yasr-allow-vote-multiset").is(":checked")?"[yasr_multiset setid=":"[yasr_visitor_multiset setid=",e+=t,jQuery("#yasr-hide-average-multiset").is(":checked")&&(e+=" show_average='no'"),e+="]",null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()}))}()),function(){jQuery("#yasr-metabox-below-editor-structured-data-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-structured-data-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-structured-data").show()})),jQuery("#yasr-metabox-below-editor-multiset-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-multiset-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-multiset").show()}));let e=document.getElementById("yasr-metabox-below-editor-select-schema").value;null!==document.getElementById("yasr-editor-multiset-container")&&function(){let e=document.getElementById("yasr-editor-multiset-container"),n=parseInt(e.getAttribute("data-nmultiset")),o=parseInt(e.getAttribute("data-setid")),a=parseInt(e.getAttribute("data-postid"));const i=document.getElementById("yasr-pro-review-setid"),s=document.getElementById("yasr-editor-copy-readonly-multiset"),r=document.getElementById("yasr-editor-copy-visitor-multiset"),l=document.getElementById("yasr-editor-copy-average-multiset"),d=document.getElementById("yasr-editor-copy-average-vvmultiset"),y=document.getElementById("yasr-editor-copy-comments-multiset"),c=document.getElementById("yasr-pro-comments-enabled-yes"),u=document.getElementById("yasr-pro-multiset-review-switcher");m(o,a,n),s.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},r.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},l.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},d.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},y.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},null!==u&&(null!==c&&c.addEventListener("change",(e=>{e.currentTarget.checked||(u.checked=!1)})),u.addEventListener("change",(e=>{!0===e.currentTarget.checked?(null!==c?c.checked=!0:document.getElementById("yasr-comment-reviews-disabled-switch").checked=!0,null!==i&&(i.value=o)):null!==i&&(i.value="")})));n>1&&jQuery("#yasr_select_set").on("change",(function(){return o=jQuery("#yasr_select_set").val(),jQuery("#yasr-loader-select-multi-set").show(),m(o,a,n),document.getElementById("yasr-multiset-id").value=o,null!==i&&""!==i&&(i.value===o?u.checked=!0:u.checked=!1),!1}))}();c(e)}()})),document.getElementById("yasr-metabox-below-editor-select-schema").addEventListener("change",(function(){c(this.value)}))})()})();
|
1 |
+
(()=>{"use strict";var e={607:(e,t,n)=>{n.d(t,{v:()=>o});const o=e=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)};tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"})}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e,t=n(607),o=new Uint8Array(16);function a(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}const i=/^(?:[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;const s=function(e){return"string"==typeof e&&i.test(e)};for(var r=[],l=0;l<256;++l)r.push((l+256).toString(16).substr(1));const d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]).toLowerCase();if(!s(n))throw TypeError("Stringified UUID is invalid");return n};const y=function(e,t,n){var o=(e=e||{}).random||(e.rng||a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return d(o)},c=(e,t,n,o)=>{null!==e&&(null!==t&&t.addEventListener("change",(t=>{t.currentTarget.checked||(e.checked=!1)})),e.addEventListener("change",(e=>{!0===e.currentTarget.checked?(null!==t?t.checked=!0:document.getElementById("yasr-comment-reviews-disabled-switch").checked=!0,null!==n&&(n.value=o)):null!==n&&(n.value="")})))},m=(e,t=!1,n=null,o=null)=>{e>1&&jQuery("#yasr_select_set").on("change",(function(){let a=jQuery("#yasr_select_set").val();return jQuery("#yasr-loader-select-multi-set").show(),!1!==t&&u(a,t,e),document.getElementById("yasr-multiset-id").value=a,null!==n&&""!==n&&null!==o&&(n.value===a?o.checked=!0:o.checked=!1),!1}))},u=(e,t,n)=>{const o={action:"yasr_send_id_nameset",set_id:e,post_id:t};return jQuery.post(ajaxurl,o,(function(t){n>1&&(document.getElementById("yasr-loader-select-multi-set").style.display="none");let o=JSON.parse(t),a=document.getElementById("yasr-table-multi-set-admin"),i=document.getElementById("yasr-table-multi-set-admin-visitor");p(o,a),p(o,i,!1),g(),g(!1);let s=document.getElementsByClassName("yasr-editor-multiset-id");for(let t=0;t<s.length;t++)s[t].innerText=e})),!1},p=(e,t,n=!0)=>{let o="",a="yasr-multiset-admin";for(let t=0;t<e.length;t++){let i=e[t].name,s=0,r=!0;!1!==n&&(s=e[t].average_rating,r=!1,a="yasr-multiset-admin-author");let l=e[t].id;o+="<tr>",o+="<td>"+i+"</td>",o+="<td><div class="+a+' id="yasr-multiset-admin-'+y()+'" data-rating="'+s+'" data-multi-idfield="'+l+'" data-readonly="'+r+'"></div>',o+="</td>",o+="</tr>"}if(!1===n){o+='<tr><td colspan="2"><input type="submit" class="button button-primary" value="Submit!" disabled></td></tr>'}t.innerHTML=o},g=(e=!0)=>{let t;t=!1!==e?"yasr-multiset-admin-author":"yasr-multiset-admin";const n=document.getElementsByClassName(t);let o=[],a=!1;for(let e=0;e<n.length;e++)!function(e){let t=n.item(e).id,i=document.getElementById(t),s=parseInt(i.getAttribute("data-multi-idfield")),r=parseInt(i.getAttribute("data-rating")),l="true"===i.getAttribute("data-readonly"),d={field:s,rating:r};o.push(d);yasrSetRaterValue(32,t,!1,.5,l,!1,(function(e,t){e=e.toFixed(1),e=parseFloat(e),this.setRating(e);for(let t=0;t<o.length;t++)o[t].field===s&&(o[t].rating=e);a=JSON.stringify(o),document.getElementById("yasr-multiset-author-votes").value=a,t()}))}(e)};function b(e){"Product"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"LocalBusiness"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Recipe"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"SoftwareApplication"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Book"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Movie"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none"):document.getElementById("yasr-metabox-info-snippet-container").style.display="none"}document.addEventListener("DOMContentLoaded",(function(e){!0!==document.body.classList.contains("block-editor-page")&&(function(){let e=parseFloat(document.getElementById("yasr-overall-rating-value").value);const n=document.getElementById("yasr-editor-copy-overall");null!==n&&(n.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())});raterJs({starSize:32,step:.1,showToolTip:!1,rating:e,readOnly:!1,element:document.getElementById("yasr-rater-overall"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),document.getElementById("yasr-overall-rating-value").value=e,this.setRating(e);let n="You've rated";document.getElementById("yasr_overall_text").textContent=n+" "+e,t()}})}(),function(){jQuery("#yasr-shortcode-creator").on("click",(function(){tb_show("Ranking Creator","#TB_inline?width=770&height=700&inlineId=yasr-tinypopup-form"),jQuery("#TB_window").css({width:"800px"})})),jQuery("#yasr-builder-copy-shortcode").on("click",(function(){tb_remove()}));let e=!1;null!==document.getElementById("yasr-editor-multiset-container")&&(e=!0);const t=document.getElementById("yasr-tinypopup-link-doc");jQuery("#yasr-link-tab-main").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-main").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-main").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-shortcodes?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-link-tab-charts").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-charts").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-charts").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-shortcodes/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen#yasr-rankings-shortcodes")})),jQuery("#yasr-overall").on("click",(function(){jQuery("#yasr-overall-choose-size").toggle("slow")})),jQuery("#yasr-visitor-votes").on("click",(function(){jQuery("#yasr-visitor-choose-size").toggle("slow")})),jQuery(".yasr-tinymce-shortcode-buttons").on("click",(function(){let e=this.getAttribute("data-shortcode");null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()})),!0===e&&jQuery("#yasr-insert-multiset-select").on("click",(function(){let e,t=jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();e=jQuery("#yasr-allow-vote-multiset").is(":checked")?"[yasr_multiset setid=":"[yasr_visitor_multiset setid=",e+=t,jQuery("#yasr-hide-average-multiset").is(":checked")&&(e+=" show_average='no'"),e+="]",null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()}))}()),function(){jQuery("#yasr-metabox-below-editor-structured-data-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-structured-data-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-structured-data").show()})),jQuery("#yasr-metabox-below-editor-multiset-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-multiset-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-multiset").show()}));let e=document.getElementById("yasr-metabox-below-editor-select-schema").value;null!==document.getElementById("yasr-editor-multiset-container")&&(()=>{let e=document.getElementById("yasr-editor-multiset-container"),n=parseInt(e.getAttribute("data-nmultiset")),o=parseInt(e.getAttribute("data-setid")),a=parseInt(e.getAttribute("data-postid"));const i=document.getElementById("yasr-pro-review-setid"),s=document.getElementById("yasr-editor-copy-readonly-multiset"),r=document.getElementById("yasr-editor-copy-visitor-multiset"),l=document.getElementById("yasr-editor-copy-average-multiset"),d=document.getElementById("yasr-editor-copy-average-vvmultiset"),y=document.getElementById("yasr-editor-copy-comments-multiset"),p=document.getElementById("yasr-pro-comments-enabled-yes"),g=document.getElementById("yasr-pro-multiset-review-switcher");u(o,a,n),s.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},r.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},l.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},d.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},y.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},c(g,p,i,o),m(n,a,i,g)})();b(e)}()})),document.getElementById("yasr-metabox-below-editor-select-schema").addEventListener("change",(function(){b(this.value)}))})()})();
|
admin/js/yasr-settings.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(()=>{var e={726:function(e,t,r){"use strict";var n;!function(a){if("function"!=typeof s){var s=function(e){return e};s.nonNative=!0}const o=s("plaintext"),i=s("html"),l=s("comment"),d=/<(\w*)>/g,c=/<\/?([^\s\/>]+)/;function u(e,t,r){return y(e=e||"",m(t=t||[],r=r||""))}function m(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let r;for(;r=d.exec(e);)t.add(r[1])}else s.nonNative||"function"!=typeof e[s.iterator]?"function"==typeof e.forEach&&e.forEach(t.add,t):t=new Set(e);return t}(e),tag_replacement:t,state:o,tag_buffer:"",depth:0,in_quote_char:""}}function y(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let r=t.allowable_tags,n=t.tag_replacement,a=t.state,s=t.tag_buffer,d=t.depth,c=t.in_quote_char,u="";for(let t=0,m=e.length;t<m;t++){let m=e[t];if(a===o)if("<"===m)a=i,s+=m;else u+=m;else if(a===i)switch(m){case"<":if(c)break;d++;break;case">":if(c)break;if(d){d--;break}c="",a=o,s+=">",r.has(p(s))?u+=s:u+=n,s="";break;case'"':case"'":c=m===c?"":c||m,s+=m;break;case"-":"<!-"===s&&(a=l),s+=m;break;case" ":case"\n":if("<"===s){a=o,u+="< ",s="";break}s+=m;break;default:s+=m}else if(a===l)if(">"===m)"--"==s.slice(-2)&&(a=o),s="";else s+=m}return t.state=a,t.tag_buffer=s,t.depth=d,t.in_quote_char=c,u}function p(e){let t=c.exec(e);return t?t[1].toLowerCase():null}u.init_streaming_mode=function(e,t){let r=m(e=e||[],t=t||"");return function(e){return y(e||"",r)}},void 0===(n=function(){return u}.call(t,r,t,e))||(e.exports=n)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,r=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===r&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var n=parseInt(document.getElementById("n-multiset").value);if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===n){var a=jQuery("#yasr-edit-form-number-elements").attr("value");a++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(a>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+a+' <input type="text" name="edit-multi-set-element-'+a+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),a++}))}else n>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";let e;var t,n=function(t){var r=t.colClass,n=t.post,a=n.link,s=n.title;return React.createElement("td",{className:r},React.createElement("a",{href:a},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const r=e.textContent;return e.innerHTML="",r}(s)))},a=new Uint8Array(16);function s(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const o=/^(?:[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;const i=function(e){return"string"==typeof e&&o.test(e)};for(var l=[],d=0;d<256;++d)l.push((d+256).toString(16).substr(1));const c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!i(r))throw TypeError("Stringified UUID is invalid");return r};const u=function(e,t,r){var n=(e=e||{}).random||(e.rng||s)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return c(n)};var m=r(726),y=r.n(m),p=function(e){var t=e.html;return React.createElement("div",{dangerouslySetInnerHTML:{__html:y()(t,"<strong><p>")}})},g=function(e){var t=e.post,r=t.number_of_votes,n=t.rating,a=e.text;if(void 0!==r){var s=JSON.parse(yasrWindowVar.textAfterVr);return s=(s=s.replace("%total_count%",r)).replace("%average%",n),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(p,{html:s}))}return React.createElement("span",null,a," ",n)},f=function(e){var t=e.size,r=e.htmlId,n=e.element,a=e.step,s=e.readonly,o=e.rating;return React.createElement("div",{id:r,ref:function(){return yasrSetRaterValue(t,r,n,a,s,o)}})},v=function(e){var t=e.rankingParams,r=e.tableId,n=e.colClass,a=e.post,s="after",o=JSON.parse(yasrWindowVar.textRating),i=new URLSearchParams(t);null!==i.get("text_position")&&(s=i.get("text_position")),null!==i.get("custom_txt")&&(o=i.get("custom_txt"));var l={rating:a.rating,htmlId:"yasr-ranking-element-"+u(),size:document.getElementById(r).dataset.rankingSize};return"before"===s?React.createElement("td",{className:n},React.createElement(g,{post:a,text:o}),React.createElement(f,l)):React.createElement("td",{className:n},React.createElement(f,l),React.createElement(g,{post:a,text:o}))},h=function(e){var t={colClass:e.leftClass,post:e.post},r={rankingParams:e.rankingParams,tableId:e.tableId,colClass:e.rightClass,post:e.post};return React.createElement("tr",{className:e.trClass},React.createElement(n,t),React.createElement(v,r))},_=function(e){var t=e.tBodyId,r=e.show,n=e.data,a=e.source,s=e.rankingParams,o=e.tableId;return React.createElement("tbody",{id:t,style:{display:r}},n.map((function(e,t){var r="yasr-rankings-td-colored",n="yasr-top-10-most-highest-left",i="yasr-top-10-most-highest-right";return"author_ranking"===a&&(r="yasr-rankings-td-white",n="yasr-top-10-overall-left",i="yasr-top-10-overall-right"),t%2==0&&(r="yasr-rankings-td-white","author_ranking"===a&&(r="yasr-rankings-td-colored")),React.createElement(h,{key:e.post_id,source:a,tableId:o,rankingParams:s,post:e,trClass:r,leftClass:n,rightClass:i})})))},E=function(e){return function(t){t.preventDefault();var r=t.target.id,n=e.tableId,a="link-most-rated-posts-"+n,s="link-highest-rated-posts-"+n,o="most-rated-posts-"+n,i="highest-rated-posts-"+n,l=document.getElementById(r),d=document.createElement("span");d.innerHTML=l.innerHTML,d.id=l.id,l.parentNode.replaceChild(d,l),r===a&&(document.getElementById(i).style.display="none",document.getElementById(o).style.display="",d=document.getElementById(s),l.innerHTML=d.innerHTML,l.id=d.id,d.parentNode.replaceChild(l,d)),r===s&&(document.getElementById(o).style.display="none",document.getElementById(i).style.display="",d=document.getElementById(a),l.innerHTML=d.innerHTML,l.id=d.id,d.parentNode.replaceChild(l,d))}},b=function(e){var t=e.tableId,r=e.source,n=e.defaultView,a="link-most-rated-posts-"+t,s="link-highest-rated-posts-"+t;if("author_ranking"!==r){var o=React.createElement("span",null,React.createElement("span",{id:a},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:s,onClick:E(e)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===n&&(o=React.createElement("span",null,React.createElement("span",{id:s},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:a,onClick:E(e)},JSON.parse(yasrWindowVar.textMostRated)))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,JSON.parse(yasrWindowVar.textLeftColumnHeader)),React.createElement("th",null,JSON.parse(yasrWindowVar.textOrderBy),": ",o)))}return React.createElement(React.Fragment,null)},k=function(e){var t=e.error,r=e.isLoaded,n=e.data,a=e.source,s=e.rankingParams,o=e.tableId;if(t)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error")));if(!1===r)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking))));if("overall_rating"===a||"author_multi"===a)return React.createElement(_,{data:n,tableId:o,tBodyId:"overall_"+o,rankingParams:s,show:"table-row-group",source:a});var i=n.most,l=n.highest,d="table-row-group",c="none",u="most",m=d,y=c,p=new URLSearchParams(s);return null!==p.get("view")&&(u=p.get("view")),"highest"===u&&(m=c,y=d),React.createElement(React.Fragment,null,React.createElement(b,{tableId:o,source:a,defaultView:u}),React.createElement(_,{data:i,tableId:o,tBodyId:"most-rated-posts-"+o,rankingParams:s,show:m,source:a}),React.createElement(_,{data:l,tableId:o,tBodyId:"highest-rated-posts-"+o,rankingParams:s,show:y,source:a}))};function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,s=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw a}}return s}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=wp.element,j=x.useState,R=x.useEffect,C=function(e,t,r){var n=t,a="&nonce_rankings="+r,s=function(e,t){var r="";if(""!==e&&!1!==e){var n=new URLSearchParams(e);null!==n.get("order_by")&&(r+="order_by="+n.get("order_by")),null!==n.get("limit")&&(r+="&limit="+n.get("limit")),null!==n.get("start_date")&&"0"!==n.get("start_date")&&(r+="&start_date="+n.get("start_date")),null!==n.get("end_date")&&"0"!==n.get("end_date")&&(r+="&end_date="+n.get("end_date")),null!==n.get("ctg")?r+="&ctg="+n.get("ctg"):null!==n.get("cpt")&&(r+="&cpt="+n.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==t&&"author_multi"!==t||null!==n.get("setid")&&(r+="&setid="+n.get("setid")),"visitor_votes"===t&&(null!==n.get("required_votes[most]")&&(r="&required_votes="+n.get("required_votes[most]")),null!==n.get("required_votes[highest]")&&(r="&required_votes="+n.get("required_votes[highest]")))}return r}(""!==e?e:"",n);return"author_ranking"===n||"author_multi"===n||"overall_rating"===n?[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+n+s+a]:[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+n+s+a,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+n+s+a]},S=function(e){var t=e.tableId,r=e.source,n=e.params,a=e.nonce,s={tableId:t,source:r,rankingParams:n},o=I(j(null),2),i=o[0],l=o[1],d=I(j(!1),2),c=d[0],u=d[1],m=I(j([]),2),y=m[0],p=m[1],g=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=JSON.parse(document.getElementById(t).dataset.rankingData);!0===e&&console.info("Ajax Disabled, getting data from source"),p(r)};return R((function(){var e,t;"yes"!==yasrWindowVar.ajaxEnabled?(g(!0),u(!0)):r?(e=[],t=C(n,r,a),Promise.all(t.map((function(t){return fetch(t).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?g():("overall_rating"===t.source||"author_multi"===t.source?e="overall_rating"===t.source?t.data_overall:t.data_mv:e[t.show]=t.data_vv,p(e))})).catch((function(e){g(),console.info(e)}))}))).then((function(e){u(!0)})).catch((function(e){g(),console.info(e)}))):l("Invalid Data Source")}),[]),React.createElement(React.Fragment,null,React.createElement(k,w({error:i,isLoaded:c,data:y},s)))},Q=wp.element.render,N=function(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var r=e.item(t).id,n=JSON.parse(e.item(t).dataset.rankingSource),a=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(r);Q(React.createElement(S,{source:n,tableId:r,params:a,nonce:s}),o)}};N();tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var L,O=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(L=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===L){var H,T=function(e){var t=K.value,r=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+r).then((function(e){return!0===e.ok?e.json():(console.info(O("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,U.childNodes.length>0?U.replaceChild(t,U.childNodes[0]):U.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&N()}))}))},V=function(e,t,r,n,a,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",r.style.display="none",n.style.display="none",a.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},M=function(e,t,r,n,a,s,o,i,l){r.style.display="",n.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",a.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},P=function(e,t,r,n,a,s,o,i,l){a.style.display="",l.style.display="none",e.style.display="none",r.style.display="none",n.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},A=function(e,t,r,n,a,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(X.className="",X.classList.add("yasr-settings-row-24"),r.style.display="",n.style.display="",e.style.display="none"):(r.style.display="none",n.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",a.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},J=".yasr-builder-elements-parents",W=".yasr-builder-elements-childs";jQuery(J).prop("disabled",!0),jQuery(W).prop("disabled",!0),jQuery(J).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",J,W);var q=[],z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};H=z.name,document.getElementById("yasr-builder-shortcode").textContent="["+H+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+H+"]");var D=document.getElementById("yasr-builder-button-preview"),F=document.getElementById("yasr-builder-copy-shortcode"),U=document.getElementById("yasr-builder-preview"),K=document.getElementById("yasr-ranking-source"),Y=document.getElementById("yasr-ranking-multiset-select"),$=document.getElementById("yasr-builder-datepicker-start"),G=document.getElementById("yasr-builder-datepicker-end"),X=document.getElementById("yasr-builder-params-container"),Z=document.getElementById("builder-vv-default-view"),ee=document.getElementById("builder-vv-required-votes"),te=document.getElementById("builder-stars-size"),re=document.getElementById("builder-overall-text"),ne=document.getElementById("builder-username-options"),ae=document.getElementById("builder-category"),se=document.getElementById("builder-cpt"),oe=document.getElementById("yasr-ranking-multiset"),ie=document.getElementById("yasr-builder-datepicker"),le=K.value,de=!1;$.value="",G.value="","yasr_ov_ranking"===le?V(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_most_active_users"===le||"yasr_top_reviewers"===le?P(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_multi_set_ranking"===le?A(re,te,Z,ee,ne,ae,se,oe,!1,ie):"yasr_visitor_multi_set_ranking"===le?A(re,te,Z,ee,ne,ae,se,oe,!0,ie):M(re,te,Z,ee,ne,ae,se,oe,ie),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)X.className="",X.classList.add("yasr-settings-row-33"),U.innerHTML="",$.value="",G.value="",z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?V(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?P(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_multi_set_ranking"===e.target.value?(A(re,te,Z,ee,ne,ae,se,oe,!1,ie),z.setid=" setid="+Y[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(A(re,te,Z,ee,ne,ae,se,oe,!0,ie),z.setid=" setid="+Y[0].value):M(re,te,Z,ee,ne,ae,se,oe,ie),z.name=e.target.value,H=z.name+z.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(z.setid=" setid="+e.target.value),q=wp.hooks.applyFilters("yasrBuilderFilterShortcode",z);for(var t=2;z.length;t++)q.hasOwnProperty(z[t])&&(z[t]=q[t]);H=z.name+z.setid+z.rows+z.view+z.minvotesmost+z.minvoteshg+z.size+z.txtPosition+z.txt+z.display+z.start_date+z.end_date+z.category+z.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+H+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+H+"]"),!0===de&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&T()})),F.onclick=function(e){!function(e){var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}(document.getElementById(e.target.id).getAttribute("data-shortcode"))},D.onclick=function(e){T(),de=!0}}})()})();
|
1 |
+
(()=>{"use strict";var e={268:(e,t,r)=>{r.d(t,{v:()=>n});var n=function(e){var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)};tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"})},726:function(e,t,r){var n;!function(a){if("function"!=typeof o){var o=function(e){return e};o.nonNative=!0}const s=o("plaintext"),i=o("html"),l=o("comment"),c=/<(\w*)>/g,d=/<\/?([^\s\/>]+)/;function u(e,t,r){return y(e=e||"",m(t=t||[],r=r||""))}function m(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let r;for(;r=c.exec(e);)t.add(r[1])}else o.nonNative||"function"!=typeof e[o.iterator]?"function"==typeof e.forEach&&e.forEach(t.add,t):t=new Set(e);return t}(e),tag_replacement:t,state:s,tag_buffer:"",depth:0,in_quote_char:""}}function y(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let r=t.allowable_tags,n=t.tag_replacement,a=t.state,o=t.tag_buffer,c=t.depth,d=t.in_quote_char,u="";for(let t=0,m=e.length;t<m;t++){let m=e[t];if(a===s)if("<"===m)a=i,o+=m;else u+=m;else if(a===i)switch(m){case"<":if(d)break;c++;break;case">":if(d)break;if(c){c--;break}d="",a=s,o+=">",r.has(p(o))?u+=o:u+=n,o="";break;case'"':case"'":d=m===d?"":d||m,o+=m;break;case"-":"<!-"===o&&(a=l),o+=m;break;case" ":case"\n":if("<"===o){a=s,u+="< ",o="";break}o+=m;break;default:o+=m}else if(a===l)if(">"===m)"--"==o.slice(-2)&&(a=s),o="";else o+=m}return t.state=a,t.tag_buffer=o,t.depth=c,t.in_quote_char=d,u}function p(e){let t=d.exec(e);return t?t[1].toLowerCase():null}u.init_streaming_mode=function(e,t){let r=m(e=e||[],t=t||"");return function(e){return y(e||"",r)}},void 0===(n=function(){return u}.call(t,r,t,e))||(e.exports=n)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{r(268);function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var n,a=function(){var e=document.getElementById("new-set-criteria-container");document.getElementById("new-criteria-button").onclick=function(t){t.preventDefault();var r,n=s("removable-criteria"),a=i(n);if(!((r=!1!==a?a:n.length+1)<3||r>9)){var d=l(r);c(a,r,e,d),o()}}},o=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=s("removable-criteria").length,r=function(e){var t=document.getElementById("remove-criteria-".concat(e));null!==t&&(t.onclick=function(e){var r=t.dataset.idCriteria;document.getElementById(r).remove()})},n=e;n<=t;n++)r(n);a()},s=function(t){return e(document.getElementsByClassName(t)).map((function(e){return parseInt(e.attributes.value.value)}))},i=function(e){var t=!1;e.sort();for(var r=1;r<=e.length;r++)if(-1===e.indexOf(r)){t=r;break}return t},l=function(e){var t=document.createElement("div");return t.id="criteria-row-container-".concat(e),t.className="criteria-row removable-criteria",t.setAttribute("value",e),t.innerHTML='\n <label for="multi-set-name-element-'.concat(e,'">\n </label>\n <input type="text"\n name="multi-set-name-element-').concat(e,'"\n id="multi-set-name-element-').concat(e,'"\n class="input-text-multi-set"\n placeholder="New Criteria"\n />\n <span \n class="dashicons dashicons-remove yasr-multiset-info-delete criteria-delete" \n id="remove-criteria-').concat(e,'"\n data-id-criteria="').concat(t.id,'"\n > \n </span>'),t},c=function(e,t,r,n){if(!1!==e)for(var a=1,o=3;o<9;o++){var s="criteria-row-container-".concat(t+a);if(!0==!!document.getElementById(s)){var i=document.getElementById(s);r.insertBefore(n,i);break}a++}else document.getElementById("new-set-criteria-container").appendChild(n)};if(document.getElementsByClassName("nav-tab-active").length>0&&(n=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===n){var d=document.getElementById("yasr_auto_insert_switch").checked,u=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===d&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===u&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===n&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===n){var m=parseInt(document.getElementById("n-multiset").value);if(a(),o(),1===m){var y=jQuery("#yasr-edit-form-number-elements").attr("value");y++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(y>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+y+' <input type="text" name="edit-multi-set-element-'+y+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),y++}))}else m>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===n&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===n&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{let e;var t,n=function(t){var r=t.colClass,n=t.post,a=n.link,o=n.title;return React.createElement("td",{className:r},React.createElement("a",{href:a},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const r=e.textContent;return e.innerHTML="",r}(o)))},a=new Uint8Array(16);function o(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const s=/^(?:[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;const i=function(e){return"string"==typeof e&&s.test(e)};for(var l=[],c=0;c<256;++c)l.push((c+256).toString(16).substr(1));const d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!i(r))throw TypeError("Stringified UUID is invalid");return r};const u=function(e,t,r){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return d(n)};var m=r(726),y=r.n(m),p=function(e){var t=e.html;return React.createElement("div",{dangerouslySetInnerHTML:{__html:y()(t,"<strong><p>")}})},g=function(e){var t=e.post,r=t.number_of_votes,n=t.rating,a=e.text;if(void 0!==r){var o=JSON.parse(yasrWindowVar.textAfterVr);return o=(o=o.replace("%total_count%",r)).replace("%average%",n),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(p,{html:o}))}return React.createElement("span",null,a," ",n)},f=function(e){var t=e.size,r=e.htmlId,n=e.element,a=e.step,o=e.readonly,s=e.rating;return React.createElement("div",{id:r,ref:function(){return yasrSetRaterValue(t,r,n,a,o,s)}})},v=function(e){var t=e.rankingParams,r=e.tableId,n=e.colClass,a=e.post,o="after",s=JSON.parse(yasrWindowVar.textRating),i=new URLSearchParams(t);null!==i.get("text_position")&&(o=i.get("text_position")),null!==i.get("custom_txt")&&(s=i.get("custom_txt"));var l={rating:a.rating,htmlId:"yasr-ranking-element-"+u(),size:document.getElementById(r).dataset.rankingSize};return"before"===o?React.createElement("td",{className:n},React.createElement(g,{post:a,text:s}),React.createElement(f,l)):React.createElement("td",{className:n},React.createElement(f,l),React.createElement(g,{post:a,text:s}))},h=function(e){var t={colClass:e.leftClass,post:e.post},r={rankingParams:e.rankingParams,tableId:e.tableId,colClass:e.rightClass,post:e.post};return React.createElement("tr",{className:e.trClass},React.createElement(n,t),React.createElement(v,r))},_=function(e){var t=e.tBodyId,r=e.show,n=e.data,a=e.source,o=e.rankingParams,s=e.tableId;return React.createElement("tbody",{id:t,style:{display:r}},n.map((function(e,t){var r="yasr-rankings-td-colored",n="yasr-top-10-most-highest-left",i="yasr-top-10-most-highest-right";return"author_ranking"===a&&(r="yasr-rankings-td-white",n="yasr-top-10-overall-left",i="yasr-top-10-overall-right"),t%2==0&&(r="yasr-rankings-td-white","author_ranking"===a&&(r="yasr-rankings-td-colored")),React.createElement(h,{key:e.post_id,source:a,tableId:s,rankingParams:o,post:e,trClass:r,leftClass:n,rightClass:i})})))},E=function(e){return function(t){t.preventDefault();var r=t.target.id,n=e.tableId,a="link-most-rated-posts-"+n,o="link-highest-rated-posts-"+n,s="most-rated-posts-"+n,i="highest-rated-posts-"+n,l=document.getElementById(r),c=document.createElement("span");c.innerHTML=l.innerHTML,c.id=l.id,l.parentNode.replaceChild(c,l),r===a&&(document.getElementById(i).style.display="none",document.getElementById(s).style.display="",c=document.getElementById(o),l.innerHTML=c.innerHTML,l.id=c.id,c.parentNode.replaceChild(l,c)),r===o&&(document.getElementById(s).style.display="none",document.getElementById(i).style.display="",c=document.getElementById(a),l.innerHTML=c.innerHTML,l.id=c.id,c.parentNode.replaceChild(l,c))}},b=function(e){var t=e.tableId,r=e.source,n=e.defaultView,a="link-most-rated-posts-"+t,o="link-highest-rated-posts-"+t;if("author_ranking"!==r){var s=React.createElement("span",null,React.createElement("span",{id:a},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:o,onClick:E(e)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===n&&(s=React.createElement("span",null,React.createElement("span",{id:o},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:a,onClick:E(e)},JSON.parse(yasrWindowVar.textMostRated)))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,JSON.parse(yasrWindowVar.textLeftColumnHeader)),React.createElement("th",null,JSON.parse(yasrWindowVar.textOrderBy),": ",s)))}return React.createElement(React.Fragment,null)},w=function(e){var t=e.error,r=e.isLoaded,n=e.data,a=e.source,o=e.rankingParams,s=e.tableId;if(t)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error")));if(!1===r)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking))));if("overall_rating"===a||"author_multi"===a)return React.createElement(_,{data:n,tableId:s,tBodyId:"overall_"+s,rankingParams:o,show:"table-row-group",source:a});var i=n.most,l=n.highest,c="table-row-group",d="none",u="most",m=c,y=d,p=new URLSearchParams(o);return null!==p.get("view")&&(u=p.get("view")),"highest"===u&&(m=d,y=c),React.createElement(React.Fragment,null,React.createElement(b,{tableId:s,source:a,defaultView:u}),React.createElement(_,{data:i,tableId:s,tBodyId:"most-rated-posts-"+s,rankingParams:o,show:m,source:a}),React.createElement(_,{data:l,tableId:s,tBodyId:"highest-rated-posts-"+s,rankingParams:o,show:y,source:a}))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k.apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=wp.element,j=x.useState,R=x.useEffect,C=function(e,t,r){var n=t,a="&nonce_rankings="+r,o=function(e,t){var r="";if(""!==e&&!1!==e){var n=new URLSearchParams(e);null!==n.get("order_by")&&(r+="order_by="+n.get("order_by")),null!==n.get("limit")&&(r+="&limit="+n.get("limit")),null!==n.get("start_date")&&"0"!==n.get("start_date")&&(r+="&start_date="+n.get("start_date")),null!==n.get("end_date")&&"0"!==n.get("end_date")&&(r+="&end_date="+n.get("end_date")),null!==n.get("ctg")?r+="&ctg="+n.get("ctg"):null!==n.get("cpt")&&(r+="&cpt="+n.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==t&&"author_multi"!==t||null!==n.get("setid")&&(r+="&setid="+n.get("setid")),"visitor_votes"===t&&(null!==n.get("required_votes[most]")&&(r="&required_votes="+n.get("required_votes[most]")),null!==n.get("required_votes[highest]")&&(r="&required_votes="+n.get("required_votes[highest]")))}return r}(""!==e?e:"",n);return"author_ranking"===n||"author_multi"===n||"overall_rating"===n?[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+n+o+a]:[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+n+o+a,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+n+o+a]},S=function(e){var t=e.tableId,r=e.source,n=e.params,a=e.nonce,o={tableId:t,source:r,rankingParams:n},s=I(j(null),2),i=s[0],l=s[1],c=I(j(!1),2),d=c[0],u=c[1],m=I(j([]),2),y=m[0],p=m[1],g=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=JSON.parse(document.getElementById(t).dataset.rankingData);!0===e&&console.info("Ajax Disabled, getting data from source"),p(r)};return R((function(){var e,t;"yes"!==yasrWindowVar.ajaxEnabled?(g(!0),u(!0)):r?(e=[],t=C(n,r,a),Promise.all(t.map((function(t){return fetch(t).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?g():("overall_rating"===t.source||"author_multi"===t.source?e="overall_rating"===t.source?t.data_overall:t.data_mv:e[t.show]=t.data_vv,p(e))})).catch((function(e){g(),console.info(e)}))}))).then((function(e){u(!0)})).catch((function(e){g(),console.info(e)}))):l("Invalid Data Source")}),[]),React.createElement(React.Fragment,null,React.createElement(w,k({error:i,isLoaded:d,data:y},o)))},N=wp.element.render,O=function(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var r=e.item(t).id,n=JSON.parse(e.item(t).dataset.rankingSource),a=JSON.parse(e.item(t).dataset.rankingParams),o=JSON.parse(e.item(t).dataset.rankingNonce),s=document.getElementById(r);N(React.createElement(S,{source:n,tableId:r,params:a,nonce:o}),s)}};O();var L,Q=r(268),T=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(L=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===L){var A,H=function(e){var t=$.value,r=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+r).then((function(e){return!0===e.ok?e.json():(console.info(T("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,K.childNodes.length>0?K.replaceChild(t,K.childNodes[0]):K.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&O()}))}))},M=function(e,t,r,n,a,o,s,i,l){e.style.display="",t.style.display="",o.style.display="",l.style.display="",r.style.display="none",n.style.display="none",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="none")},V=function(e,t,r,n,a,o,s,i,l){r.style.display="",n.style.display="",t.style.display="",o.style.display="",l.style.display="",e.style.display="none",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="none")},P=function(e,t,r,n,a,o,s,i,l){a.style.display="",l.style.display="none",e.style.display="none",r.style.display="none",n.style.display="none",t.style.display="none",o.style.display="none",null!==s&&(s.style.display="none"),null!==i&&(i.style.display="none")},J=function(e,t,r,n,a,o,s,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],c=arguments.length>9?arguments[9]:void 0;!0===l?(Z.className="",Z.classList.add("yasr-settings-row-24"),r.style.display="",n.style.display="",e.style.display="none"):(r.style.display="none",n.style.display="none",e.style.display=""),o.style.display="",t.style.display="",c.style.display="",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="")},W=".yasr-builder-elements-parents",q=".yasr-builder-elements-childs";jQuery(W).prop("disabled",!0),jQuery(q).prop("disabled",!0),jQuery(W).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",W,q);var D=[],z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};A=z.name,document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]");var F=document.getElementById("yasr-builder-button-preview"),U=document.getElementById("yasr-builder-copy-shortcode"),K=document.getElementById("yasr-builder-preview"),$=document.getElementById("yasr-ranking-source"),Y=document.getElementById("yasr-ranking-multiset-select"),G=document.getElementById("yasr-builder-datepicker-start"),X=document.getElementById("yasr-builder-datepicker-end"),Z=document.getElementById("yasr-builder-params-container"),ee=document.getElementById("builder-vv-default-view"),te=document.getElementById("builder-vv-required-votes"),re=document.getElementById("builder-stars-size"),ne=document.getElementById("builder-overall-text"),ae=document.getElementById("builder-username-options"),oe=document.getElementById("builder-category"),se=document.getElementById("builder-cpt"),ie=document.getElementById("yasr-ranking-multiset"),le=document.getElementById("yasr-builder-datepicker"),ce=$.value,de=!1;G.value="",X.value="","yasr_ov_ranking"===ce?M(ne,re,ee,te,ae,oe,se,ie,le):"yasr_most_active_users"===ce||"yasr_top_reviewers"===ce?P(ne,re,ee,te,ae,oe,se,ie,le):"yasr_multi_set_ranking"===ce?J(ne,re,ee,te,ae,oe,se,ie,!1,le):"yasr_visitor_multi_set_ranking"===ce?J(ne,re,ee,te,ae,oe,se,ie,!0,le):V(ne,re,ee,te,ae,oe,se,ie,le),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)Z.className="",Z.classList.add("yasr-settings-row-33"),K.innerHTML="",G.value="",X.value="",z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?M(ne,re,ee,te,ae,oe,se,ie,le):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?P(ne,re,ee,te,ae,oe,se,ie,le):"yasr_multi_set_ranking"===e.target.value?(J(ne,re,ee,te,ae,oe,se,ie,!1,le),z.setid=" setid="+Y[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(J(ne,re,ee,te,ae,oe,se,ie,!0,le),z.setid=" setid="+Y[0].value):V(ne,re,ee,te,ae,oe,se,ie,le),z.name=e.target.value,A=z.name+z.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(z.setid=" setid="+e.target.value),D=wp.hooks.applyFilters("yasrBuilderFilterShortcode",z);for(var t=2;z.length;t++)D.hasOwnProperty(z[t])&&(z[t]=D[t]);A=z.name+z.setid+z.rows+z.view+z.minvotesmost+z.minvoteshg+z.size+z.txtPosition+z.txt+z.display+z.start_date+z.end_date+z.category+z.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]"),!0===de&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&H()})),U.onclick=function(e){var t=document.getElementById(e.target.id);(0,Q.v)(t.getAttribute("data-shortcode"))},F.onclick=function(e){H(),de=!0}}})()})();
|
admin/settings/aspect_style/yasr-settings-style-actions.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2020 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2020 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/settings/aspect_style/yasr-settings-style-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/settings/classes/YasrImportRatingPlugins.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2020 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2020 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/settings/classes/YasrSettings.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
@@ -40,6 +40,9 @@ class YasrSettings {
|
|
40 |
//include multiset functions
|
41 |
require(YASR_ABSOLUTE_PATH_ADMIN . '/settings/multiset/yasr-settings-functions-multiset.php');
|
42 |
|
|
|
|
|
|
|
43 |
//include style functions
|
44 |
require(YASR_ABSOLUTE_PATH_ADMIN . '/settings/aspect_style/yasr-settings-style-functions.php');
|
45 |
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
40 |
//include multiset functions
|
41 |
require(YASR_ABSOLUTE_PATH_ADMIN . '/settings/multiset/yasr-settings-functions-multiset.php');
|
42 |
|
43 |
+
$multiset = new YasrSettingsMultiset();
|
44 |
+
$multiset->init();
|
45 |
+
|
46 |
//include style functions
|
47 |
require(YASR_ABSOLUTE_PATH_ADMIN . '/settings/aspect_style/yasr-settings-style-functions.php');
|
48 |
|
admin/settings/classes/YasrSettingsMultiset.php
ADDED
@@ -0,0 +1,311 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class YasrSettingsMultiset {
|
4 |
+
public function init () {
|
5 |
+
add_action('admin_init', array($this, 'manageMultiset')); //This is for general options
|
6 |
+
}
|
7 |
+
|
8 |
+
public function manageMultiset () {
|
9 |
+
register_setting(
|
10 |
+
'yasr_multiset_options_group', // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
|
11 |
+
'yasr_multiset_options', //The name of an option to sanitize and save.
|
12 |
+
array($this, 'sanitize')
|
13 |
+
);
|
14 |
+
|
15 |
+
$option_multiset = get_option('yasr_multiset_options');
|
16 |
+
|
17 |
+
if ($option_multiset === false) {
|
18 |
+
$option_multiset = array(
|
19 |
+
'show_average' => 'no'
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
if (!isset($option_multiset['show_average'])) {
|
24 |
+
$option_multiset['show_average'] = 'yes';
|
25 |
+
}
|
26 |
+
|
27 |
+
$this->addSettingsSections();
|
28 |
+
$this->addSettingsFields($option_multiset);
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Run add_setting_section for the page
|
34 |
+
*
|
35 |
+
* @author Dario Curvino <@dudo>
|
36 |
+
* @since 3.1.3
|
37 |
+
*/
|
38 |
+
public function addSettingsSections() {
|
39 |
+
|
40 |
+
//Add Section for new multiset
|
41 |
+
add_settings_section(
|
42 |
+
'yasr_new_multiset_form_section_id',
|
43 |
+
'',
|
44 |
+
'',
|
45 |
+
'yasr_new_multiset_form'
|
46 |
+
);
|
47 |
+
|
48 |
+
//Add section for edit multiset
|
49 |
+
add_settings_section(
|
50 |
+
'yasr_edit_multiset_form_section_id',
|
51 |
+
'',
|
52 |
+
'',
|
53 |
+
'yasr_edit_multiset_form'
|
54 |
+
);
|
55 |
+
|
56 |
+
//add section for show/hide average
|
57 |
+
add_settings_section(
|
58 |
+
'yasr_multiset_options_section_id',
|
59 |
+
'',
|
60 |
+
'',
|
61 |
+
'yasr_multiset_tab'
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Run addSettingsField for the page
|
67 |
+
*
|
68 |
+
* @author Dario Curvino <@dudo>
|
69 |
+
* @since 3.1.3
|
70 |
+
*/
|
71 |
+
public function addSettingsFields ($option_multiset) {
|
72 |
+
add_settings_field(
|
73 |
+
'add_multi_set',
|
74 |
+
yasr_multiset_description(),
|
75 |
+
array($this, 'formCreateMultiset'),
|
76 |
+
'yasr_new_multiset_form',
|
77 |
+
'yasr_new_multiset_form_section_id'
|
78 |
+
);
|
79 |
+
|
80 |
+
add_settings_field(
|
81 |
+
'manage_multi_set',
|
82 |
+
yasr_manage_multiset_description(),
|
83 |
+
array($this, 'formManageMultiset'),
|
84 |
+
'yasr_edit_multiset_form',
|
85 |
+
'yasr_edit_multiset_form_section_id'
|
86 |
+
);
|
87 |
+
|
88 |
+
add_settings_field(
|
89 |
+
'yasr_multiset_hide_average_id',
|
90 |
+
yasr_show_average_multiset_description(),
|
91 |
+
array($this, 'hideAverage'),
|
92 |
+
'yasr_multiset_tab',
|
93 |
+
'yasr_multiset_options_section_id',
|
94 |
+
$option_multiset
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Output the form to create a new multiset
|
100 |
+
*
|
101 |
+
* @author Dario Curvino <@dudo>
|
102 |
+
* @since 3.1.3
|
103 |
+
*/
|
104 |
+
public function formCreateMultiset () {
|
105 |
+
?>
|
106 |
+
<div class="yasr-new-multi-set">
|
107 |
+
<div style="width: 70%;">
|
108 |
+
<div class="yasr-multi-set-form-headers">
|
109 |
+
<?php esc_html_e('Add new Multi Set', 'yet-another-stars-rating'); ?>
|
110 |
+
</div>
|
111 |
+
<div style="margin-bottom: 10px;">
|
112 |
+
<span style="color: #FEB209; font-size: x-large"> | </span> = required
|
113 |
+
</div>
|
114 |
+
|
115 |
+
<div>
|
116 |
+
<?php
|
117 |
+
wp_nonce_field('add-multi-set', 'add-nonce-new-multi-set'); //Must be inside the form
|
118 |
+
$multiset_name_info = esc_html__('Unique name to identify your set.', 'yet-another-stars-rating');
|
119 |
+
?>
|
120 |
+
<div>
|
121 |
+
<div>
|
122 |
+
<br />
|
123 |
+
<div id="yasr-multiset-page-new-set-criteria-name" class="criteria-row">
|
124 |
+
<label for="new-multi-set-name">
|
125 |
+
</label>
|
126 |
+
<input type="text"
|
127 |
+
name="multi-set-name"
|
128 |
+
id="new-multi-set-name"
|
129 |
+
class="input-text-multi-set"
|
130 |
+
placeholder="Name"
|
131 |
+
required
|
132 |
+
>
|
133 |
+
<span class="dashicons dashicons-info yasr-multiset-info-delete"
|
134 |
+
title="<?php echo esc_attr($multiset_name_info) ?>"></span>
|
135 |
+
</div>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<?php $this->newMultiCriteria(); ?>
|
139 |
+
|
140 |
+
<div>
|
141 |
+
<button class="button-secondary" id="new-criteria-button">
|
142 |
+
<span class="dashicons dashicons-insert" style="line-height: 1.4"></span>
|
143 |
+
<?php esc_html_e('Add new Criteria', 'yet-another-stars-rating'); ?>
|
144 |
+
</button>
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
<br />
|
148 |
+
<div>
|
149 |
+
<p>
|
150 |
+
<input type="submit"
|
151 |
+
value="<?php esc_attr_e('Create New Set', 'yet-another-stars-rating') ?>"
|
152 |
+
class="button-primary"
|
153 |
+
/>
|
154 |
+
</p>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
<?php
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Output the multicriteria form
|
164 |
+
*
|
165 |
+
* @author Dario Curvino <@dudo>
|
166 |
+
* @since 3.1.3
|
167 |
+
*/
|
168 |
+
public function newMultiCriteria () {
|
169 |
+
?>
|
170 |
+
<div id="new-set-criteria-container">
|
171 |
+
<?php
|
172 |
+
for ($i = 1; $i <= 4; $i ++) {
|
173 |
+
$element_n = esc_html__('Element ', 'yet-another-stars-rating') . '#'.$i;
|
174 |
+
$name = 'multi-set-name-element-'.$i;
|
175 |
+
$id = 'multi-set-name-element-'.$i;
|
176 |
+
$id_container = 'criteria-row-container-'.$i;
|
177 |
+
|
178 |
+
$required = '';
|
179 |
+
|
180 |
+
if($i === 1) {
|
181 |
+
$placeholder = 'Story';
|
182 |
+
$required = 'required';
|
183 |
+
}
|
184 |
+
elseif($i === 2) {
|
185 |
+
$placeholder = 'Gameplay';
|
186 |
+
$required = 'required';
|
187 |
+
}
|
188 |
+
elseif($i === 3) {
|
189 |
+
$placeholder = 'Graphics';
|
190 |
+
}
|
191 |
+
elseif($i === 4) {
|
192 |
+
$placeholder = 'Sound';
|
193 |
+
}
|
194 |
+
else {
|
195 |
+
$placeholder = $element_n;
|
196 |
+
}
|
197 |
+
|
198 |
+
$this->outputCriteria($id_container, $i, $id, $name, $placeholder, $required);
|
199 |
+
} //End foreach
|
200 |
+
?>
|
201 |
+
</div>
|
202 |
+
<?php
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Output the single criteria row
|
207 |
+
*
|
208 |
+
* @author Dario Curvino <@dudo>
|
209 |
+
* @since 3.1.3
|
210 |
+
* @param $id_container
|
211 |
+
* @param $i
|
212 |
+
* @param $id
|
213 |
+
* @param $name
|
214 |
+
* @param $placeholder
|
215 |
+
* @param $required
|
216 |
+
*/
|
217 |
+
public function outputCriteria ($id_container, $i, $id, $name, $placeholder, $required) {
|
218 |
+
?>
|
219 |
+
<div class="criteria-row removable-criteria"
|
220 |
+
id="<?php echo esc_attr($id_container) ?>"
|
221 |
+
value="<?php echo esc_attr($i) ?>">
|
222 |
+
<label for="<?php echo esc_attr($id); ?>">
|
223 |
+
</label>
|
224 |
+
<input type="text"
|
225 |
+
name="<?php echo esc_attr($name); ?>"
|
226 |
+
id="<?php echo esc_attr($id); ?>"
|
227 |
+
class="input-text-multi-set"
|
228 |
+
placeholder="<?php echo esc_attr($placeholder); ?>"
|
229 |
+
<?php echo esc_attr($required) ?>
|
230 |
+
>
|
231 |
+
|
232 |
+
<?php
|
233 |
+
if($required !== 'required') {
|
234 |
+
echo '<span class="dashicons dashicons-remove yasr-multiset-info-delete criteria-delete"
|
235 |
+
id="remove-criteria-'.esc_attr($i).'"
|
236 |
+
data-id-criteria="'.esc_attr($id_container).'">
|
237 |
+
</span>';
|
238 |
+
}
|
239 |
+
?>
|
240 |
+
</div>
|
241 |
+
|
242 |
+
<?php
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Shows a form to edit the Multi Set
|
247 |
+
*
|
248 |
+
* @author Dario Curvino <@dudo>
|
249 |
+
* @since 3.1.3
|
250 |
+
*/
|
251 |
+
public function formManageMultiset() {
|
252 |
+
?>
|
253 |
+
<div>
|
254 |
+
<?php yasr_edit_multi_form(); ?>
|
255 |
+
<div id="yasr-multi-set-response" style="display:none">
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
<?php
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Show option to show/hide average
|
263 |
+
*
|
264 |
+
* @author Dario Curvino <@dudo>
|
265 |
+
* @since 3.1.3
|
266 |
+
* @param $option_multiset
|
267 |
+
*/
|
268 |
+
public function hideAverage($option_multiset) {
|
269 |
+
?>
|
270 |
+
|
271 |
+
<div class="yasr-onoffswitch-big">
|
272 |
+
<input type="checkbox" name="yasr_multiset_options[show_average]" class="yasr-onoffswitch-checkbox"
|
273 |
+
id="yasr-multiset-options-show-average-switch" <?php if ($option_multiset['show_average'] === 'yes') {
|
274 |
+
echo " checked='checked' ";
|
275 |
+
} ?> >
|
276 |
+
<label class="yasr-onoffswitch-label" for="yasr-multiset-options-show-average-switch">
|
277 |
+
<span class="yasr-onoffswitch-inner"></span>
|
278 |
+
<span class="yasr-onoffswitch-switch"></span>
|
279 |
+
</label>
|
280 |
+
</div>
|
281 |
+
|
282 |
+
<?php
|
283 |
+
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Sanitize
|
288 |
+
*
|
289 |
+
* @author Dario Curvino <@dudo>
|
290 |
+
* @since 3.1.3
|
291 |
+
* @param $option_multiset
|
292 |
+
*
|
293 |
+
* @return mixed
|
294 |
+
*/
|
295 |
+
public function sanitize($option_multiset) {
|
296 |
+
|
297 |
+
if (is_array($option_multiset)) {
|
298 |
+
if( ! array_key_exists('show_average', $option_multiset)) {
|
299 |
+
$option_multiset['show_average'] = 'no';
|
300 |
+
} else {
|
301 |
+
$option_multiset['show_average'] = 'yes';
|
302 |
+
}
|
303 |
+
} else {
|
304 |
+
$option_multiset['show_average'] = 'no';
|
305 |
+
}
|
306 |
+
|
307 |
+
return $option_multiset;
|
308 |
+
|
309 |
+
}
|
310 |
+
|
311 |
+
}
|
admin/settings/classes/YasrSettingsRankings.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2020 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2020 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/settings/classes/YasrStats.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/settings/migrations/yasr-settings-migration-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/settings/migrations/yasr-settings-migration-page.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/settings/multiset/yasr-settings-functions-multiset-page.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
@@ -50,73 +50,38 @@ if ($error_edit_multi_set) {
|
|
50 |
global $wpdb;
|
51 |
|
52 |
$multi_set = YasrMultiSetData::returnMultiSetNames();
|
53 |
-
$n_multi_set =
|
54 |
|
55 |
?>
|
56 |
-
|
57 |
<input type="hidden" value="<?php echo esc_attr($n_multi_set); ?>" id="n-multiset">
|
58 |
-
<h3> <?php esc_html_e("Manage Multi Set", 'yet-another-stars-rating'); ?></h3>
|
59 |
-
|
60 |
-
<p>
|
61 |
-
<a href="#" id="yasr-multi-set-doc-link">
|
62 |
-
<?php esc_html_e("What is a Multi Set?", 'yet-another-stars-rating') ?>
|
63 |
-
</a>
|
64 |
-
</p>
|
65 |
-
|
66 |
-
<div id="yasr-multi-set-doc-box" style="display:none">
|
67 |
-
<?php esc_html_e(
|
68 |
-
"Multi Set allows you to insert a rate for each aspect about the product / local business /
|
69 |
-
whetever you're reviewing, example in the image below.",
|
70 |
-
'yet-another-stars-rating'
|
71 |
-
);
|
72 |
-
|
73 |
-
echo "<br /><br /><img src=" . YASR_IMG_DIR . "/yasr-multi-set.png> <br /> <br />";
|
74 |
-
|
75 |
-
esc_html_e(
|
76 |
-
"You can create up to 99 different Multi Set and each one can contain up to 9 different fields.
|
77 |
-
Once you've saved it, you can insert the rates while typing your article in the box below the editor,
|
78 |
-
as you can see in this image (click to see it larger)",
|
79 |
-
'yet-another-stars-rating'
|
80 |
-
);
|
81 |
-
|
82 |
-
echo "<br /><br /><a href=\"" . YASR_IMG_DIR . "yasr-multi-set-insert-rate.jpg\"><img src=" . YASR_IMG_DIR . "/yasr-multi-set-insert-rate-small.jpg></a> <br /> <br />";
|
83 |
-
|
84 |
-
esc_html_e(
|
85 |
-
'In order to insert your Multi Sets into a post or page, you can either past the short code that will
|
86 |
-
appear at the bottom of the box or just click on the star in the graphic editor and select "Insert Multi Set".',
|
87 |
-
'yet-another-stars-rating'
|
88 |
-
);
|
89 |
-
|
90 |
-
?>
|
91 |
-
<br/> <br/>
|
92 |
-
<a href="#" id="yasr-multi-set-doc-link-hide">
|
93 |
-
<?php esc_html_e("Close this message", 'yet-another-stars-rating') ?>
|
94 |
-
</a>
|
95 |
-
</div>
|
96 |
-
|
97 |
-
<div class="yasr-multi-set-left">
|
98 |
-
<div class="yasr-new-multi-set">
|
99 |
-
<?php yasr_display_multi_set_form(); ?>
|
100 |
-
</div>
|
101 |
-
</div>
|
102 |
|
103 |
-
<div class="yasr-
|
104 |
-
|
105 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
</div>
|
107 |
-
</div>
|
108 |
-
|
109 |
-
<div class="yasr-space-settings-div">
|
110 |
-
</div>
|
111 |
-
|
112 |
|
113 |
-
<div class="yasr-multi-set-choose-theme">
|
114 |
-
<!--This allow to choose if show average or no-->
|
115 |
-
<form action="options.php" method="post" id="yasr_multiset_form">
|
116 |
-
<?php
|
117 |
-
settings_fields('yasr_multiset_options_group');
|
118 |
-
do_settings_sections('yasr_multiset_tab');
|
119 |
-
submit_button(esc_html__('Save', 'yet-another-stars-rating'));
|
120 |
-
?>
|
121 |
-
</form>
|
122 |
</div>
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
50 |
global $wpdb;
|
51 |
|
52 |
$multi_set = YasrMultiSetData::returnMultiSetNames();
|
53 |
+
$n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
|
54 |
|
55 |
?>
|
|
|
56 |
<input type="hidden" value="<?php echo esc_attr($n_multi_set); ?>" id="n-multiset">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
+
<div class="yasr-settings-div">
|
59 |
+
|
60 |
+
<div>
|
61 |
+
<form method="post">
|
62 |
+
<?php
|
63 |
+
//There is no setting to save here, I'm using these functions for better UIX
|
64 |
+
do_settings_sections('yasr_new_multiset_form');
|
65 |
+
?>
|
66 |
+
</form>
|
67 |
+
|
68 |
+
<!-- Must be into another form -->
|
69 |
+
<form method="post">
|
70 |
+
<?php
|
71 |
+
//There is no setting to save here, I'm using these functions for better UIX
|
72 |
+
do_settings_sections('yasr_edit_multiset_form');
|
73 |
+
?>
|
74 |
+
</form>
|
75 |
+
|
76 |
+
|
77 |
+
<!--This allows to choose if show average or no, must be inside the form-->
|
78 |
+
<form action="options.php" method="post" id="yasr_multiset_form">
|
79 |
+
<?php
|
80 |
+
settings_fields('yasr_multiset_options_group');
|
81 |
+
do_settings_sections('yasr_multiset_tab');
|
82 |
+
submit_button(esc_html__('Save', 'yet-another-stars-rating'));
|
83 |
+
?>
|
84 |
+
</form>
|
85 |
</div>
|
|
|
|
|
|
|
|
|
|
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
</div>
|
admin/settings/multiset/yasr-settings-functions-multiset.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
@@ -24,128 +24,6 @@ if (!defined('ABSPATH')) {
|
|
24 |
|
25 |
/**************** Add yasr multiset options and settings ************/
|
26 |
|
27 |
-
add_action('admin_init', 'yasr_multiset_options_init'); //This is for general options
|
28 |
-
|
29 |
-
function yasr_multiset_options_init() {
|
30 |
-
register_setting(
|
31 |
-
'yasr_multiset_options_group', // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
|
32 |
-
'yasr_multiset_options', //The name of an option to sanitize and save.
|
33 |
-
'yasr_sanitize_multiset_options'
|
34 |
-
);
|
35 |
-
|
36 |
-
$option_multiset = get_option('yasr_multiset_options');
|
37 |
-
|
38 |
-
if ($option_multiset === false) {
|
39 |
-
$option_multiset = array(
|
40 |
-
'show_average' => 'no'
|
41 |
-
);
|
42 |
-
}
|
43 |
-
|
44 |
-
if (!isset($option_multiset['show_average'])) {
|
45 |
-
$option_multiset['show_average'] = 'yes';
|
46 |
-
}
|
47 |
-
|
48 |
-
add_settings_section('yasr_multiset_options_section_id', '', 'yasr_multiset_section_callback', 'yasr_multiset_tab');
|
49 |
-
add_settings_field('yasr_multiset_hide_average_id', __('Show average?', 'yet-another-stars-rating'), 'yasr_multiset_hide_average_callback', 'yasr_multiset_tab', 'yasr_multiset_options_section_id', $option_multiset);
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
function yasr_multiset_section_callback() {
|
54 |
-
//Silence
|
55 |
-
}
|
56 |
-
|
57 |
-
function yasr_multiset_hide_average_callback($option_multiset) {
|
58 |
-
|
59 |
-
?>
|
60 |
-
|
61 |
-
<div class="yasr-onoffswitch-big">
|
62 |
-
<input type="checkbox" name="yasr_multiset_options[show_average]" class="yasr-onoffswitch-checkbox"
|
63 |
-
id="yasr-multiset-options-show-average-switch" <?php if ($option_multiset['show_average'] === 'yes') {
|
64 |
-
echo " checked='checked' ";
|
65 |
-
} ?> >
|
66 |
-
<label class="yasr-onoffswitch-label" for="yasr-multiset-options-show-average-switch">
|
67 |
-
<span class="yasr-onoffswitch-inner"></span>
|
68 |
-
<span class="yasr-onoffswitch-switch"></span>
|
69 |
-
</label>
|
70 |
-
</div>
|
71 |
-
|
72 |
-
<br/>
|
73 |
-
|
74 |
-
<br/>
|
75 |
-
|
76 |
-
<?php
|
77 |
-
|
78 |
-
esc_html_e('If you select no, the "Average" row will not be displayed.
|
79 |
-
You can override this in the single multi set by using the parameter "show_average"',
|
80 |
-
'yet-another-stars-rating');
|
81 |
-
|
82 |
-
}
|
83 |
-
|
84 |
-
|
85 |
-
function yasr_sanitize_multiset_options($option_multiset) {
|
86 |
-
|
87 |
-
if (is_array($option_multiset)) {
|
88 |
-
if( ! array_key_exists('show_average', $option_multiset)) {
|
89 |
-
$option_multiset['show_average'] = 'no';
|
90 |
-
} else {
|
91 |
-
$option_multiset['show_average'] = 'yes';
|
92 |
-
}
|
93 |
-
} else {
|
94 |
-
$option_multiset['show_average'] = 'no';
|
95 |
-
}
|
96 |
-
|
97 |
-
return $option_multiset;
|
98 |
-
|
99 |
-
}
|
100 |
-
|
101 |
-
|
102 |
-
/****** Create a form for settings page to create new multi set ******/
|
103 |
-
function yasr_display_multi_set_form() {
|
104 |
-
?>
|
105 |
-
|
106 |
-
<h4 class="yasr-multi-set-form-headers">
|
107 |
-
<?php esc_html_e("Add New Multiple Set", 'yet-another-stars-rating'); ?>
|
108 |
-
</h4>
|
109 |
-
|
110 |
-
<p>
|
111 |
-
<em>
|
112 |
-
<?php esc_html_e('Name, Element#1 and Element#2 MUST be filled and must be long at least 3 characters',
|
113 |
-
'yet-another-stars-rating') ?>
|
114 |
-
</em>
|
115 |
-
</p>
|
116 |
-
|
117 |
-
<div>
|
118 |
-
<form action="<?php echo admin_url('options-general.php?page=yasr_settings_page&tab=manage_multi') ?>"
|
119 |
-
id="form_add_multi_set" method="post">
|
120 |
-
|
121 |
-
<?php wp_nonce_field('add-multi-set', 'add-nonce-new-multi-set') //Must be inside the form ?>
|
122 |
-
|
123 |
-
<strong><?php esc_html_e("Name", 'yet-another-stars-rating') ?></strong>
|
124 |
-
|
125 |
-
<input type="text" name="multi-set-name" id="new-multi-set-name" class="input-text-multi-set">
|
126 |
-
<br />
|
127 |
-
|
128 |
-
<?php esc_html_e("You can insert up to nine elements", 'yet-another-stars-rating') ?>
|
129 |
-
<br/>
|
130 |
-
|
131 |
-
<?php for ($i = 1; $i <= 9; $i ++) {
|
132 |
-
echo "<strong>" . __('Element ', 'yet-another-stars-rating') . "#$i" . "</strong>";
|
133 |
-
?>
|
134 |
-
<input type="text" name="multi-set-name-element-<?php echo $i ?>" id="multi-set-name-element-<?php echo $i ?>"
|
135 |
-
class="input-text-multi-set">
|
136 |
-
<br/>
|
137 |
-
|
138 |
-
<?php } //End foreach ?>
|
139 |
-
|
140 |
-
<br/>
|
141 |
-
<input type="submit" value="<?php esc_attr_e("Create New Set", 'yet-another-stars-rating') ?>" class="button-primary"/>
|
142 |
-
</form>
|
143 |
-
</div>
|
144 |
-
|
145 |
-
<?php
|
146 |
-
} //End function
|
147 |
-
|
148 |
-
|
149 |
function yasr_edit_multi_form() {
|
150 |
|
151 |
global $wpdb;
|
@@ -161,14 +39,14 @@ function yasr_edit_multi_form() {
|
|
161 |
<h4 class="yasr-multi-set-form-headers"><?php esc_html_e("Manage Multiple Set", 'yet-another-stars-rating'); ?></h4>
|
162 |
|
163 |
<?php esc_html_e('Wich set do you want to edit or remove?', 'yet-another-stars-rating') ?>
|
164 |
-
|
165 |
<select id="yasr_select_edit_set">
|
166 |
<?php foreach ($multi_set as $name) { ?>
|
167 |
<option value="<?php echo $name->set_id ?>"><?php echo $name->set_name ?></option>
|
168 |
<?php } //End foreach ?>
|
169 |
</select>
|
170 |
|
171 |
-
<button href="#" class="button-delete" id="yasr-button-select-set-edit-form"><?php esc_html_e(
|
172 |
</div>
|
173 |
|
174 |
<?php
|
@@ -182,19 +60,21 @@ function yasr_edit_multi_form() {
|
|
182 |
ORDER BY field_id");
|
183 |
|
184 |
foreach ($multi_set as $find_set_id) {
|
185 |
-
$
|
186 |
}
|
187 |
|
188 |
?>
|
189 |
|
190 |
<div class="yasr-manage-multiset-single">
|
191 |
|
192 |
-
<h4 class="yasr-multi-set-form-headers"
|
|
|
|
|
193 |
|
194 |
<form action=" <?php echo admin_url('options-general.php?page=yasr_settings_page&tab=manage_multi') ?>"
|
195 |
id="form_edit_multi_set" method="post">
|
196 |
|
197 |
-
<input type="hidden" name="yasr_edit_multi_set_form" value="<?php echo $
|
198 |
|
199 |
<table id="yasr-table-form-edit-multi-set">
|
200 |
<tr>
|
@@ -244,7 +124,7 @@ function yasr_edit_multi_form() {
|
|
244 |
<td width=\"80%\">" . __("Remove whole set?", 'yet-another-stars-rating') . "</td>
|
245 |
|
246 |
<td width=\"20%\" style=\"text-align:center\">
|
247 |
-
<input type=\"checkbox\" name=\"yasr-remove-multi-set\" value=\"$
|
248 |
</td>
|
249 |
|
250 |
</tr>
|
@@ -253,26 +133,32 @@ function yasr_edit_multi_form() {
|
|
253 |
|
254 |
";
|
255 |
|
256 |
-
echo
|
257 |
-
esc_html_e("If you remove something you will remove all the votes for that set or field. This operation CAN'T BE undone.",
|
258 |
-
|
|
|
|
|
|
|
259 |
|
260 |
wp_nonce_field('edit-multi-set', 'add-nonce-edit-multi-set')
|
261 |
|
262 |
?>
|
263 |
|
264 |
-
<div id="yasr-element-limit"
|
265 |
-
|
|
|
266 |
|
267 |
-
<
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
|
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
276 |
|
277 |
</form>
|
278 |
|
@@ -285,7 +171,6 @@ function yasr_edit_multi_form() {
|
|
285 |
|
286 |
}//End function
|
287 |
|
288 |
-
|
289 |
/****** Get and output multiple set in a form and table, used in settings page ******/
|
290 |
|
291 |
add_action('wp_ajax_yasr_get_multi_set', 'yasr_get_multi_set_callback');
|
@@ -309,81 +194,88 @@ function yasr_get_multi_set_callback() {
|
|
309 |
|
310 |
?>
|
311 |
|
312 |
-
<
|
313 |
-
id="form_edit_multi_set" method="post">
|
314 |
-
<input type="hidden" name="yasr_edit_multi_set_form" value="<?php echo $set_id ?>"/>
|
315 |
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
|
327 |
-
|
328 |
|
329 |
-
|
330 |
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
|
347 |
-
|
348 |
|
349 |
-
|
350 |
|
351 |
-
|
352 |
|
353 |
-
|
354 |
|
355 |
-
|
356 |
-
|
357 |
|
358 |
-
|
359 |
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
|
364 |
-
|
365 |
|
366 |
-
|
367 |
|
368 |
-
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
|
|
|
373 |
|
374 |
-
|
375 |
|
376 |
-
|
377 |
|
378 |
-
|
379 |
-
style="display:none; color:red"><?php esc_html_e("You can use up to 9 elements", 'yet-another-stars-rating') ?></div>
|
380 |
|
381 |
-
|
382 |
-
|
|
|
383 |
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
-
|
|
|
|
|
|
|
387 |
|
388 |
<?php
|
389 |
|
@@ -444,6 +336,7 @@ function yasr_process_new_multi_set_form() {
|
|
444 |
|
445 |
$element_filled = 2;
|
446 |
|
|
|
447 |
//If filled get the element from 3 to 9
|
448 |
for ($i = 3; $i <= 9; $i ++) {
|
449 |
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
24 |
|
25 |
/**************** Add yasr multiset options and settings ************/
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
function yasr_edit_multi_form() {
|
28 |
|
29 |
global $wpdb;
|
39 |
<h4 class="yasr-multi-set-form-headers"><?php esc_html_e("Manage Multiple Set", 'yet-another-stars-rating'); ?></h4>
|
40 |
|
41 |
<?php esc_html_e('Wich set do you want to edit or remove?', 'yet-another-stars-rating') ?>
|
42 |
+
<p> </p>
|
43 |
<select id="yasr_select_edit_set">
|
44 |
<?php foreach ($multi_set as $name) { ?>
|
45 |
<option value="<?php echo $name->set_id ?>"><?php echo $name->set_name ?></option>
|
46 |
<?php } //End foreach ?>
|
47 |
</select>
|
48 |
|
49 |
+
<button href="#" class="button-delete" id="yasr-button-select-set-edit-form"><?php esc_html_e('Select'); ?></button>
|
50 |
</div>
|
51 |
|
52 |
<?php
|
60 |
ORDER BY field_id");
|
61 |
|
62 |
foreach ($multi_set as $find_set_id) {
|
63 |
+
$set_id = $find_set_id->set_id;
|
64 |
}
|
65 |
|
66 |
?>
|
67 |
|
68 |
<div class="yasr-manage-multiset-single">
|
69 |
|
70 |
+
<h4 class="yasr-multi-set-form-headers">
|
71 |
+
<?php esc_html_e('Manage Multi Set', 'yet-another-stars-rating'); ?>
|
72 |
+
</h4>
|
73 |
|
74 |
<form action=" <?php echo admin_url('options-general.php?page=yasr_settings_page&tab=manage_multi') ?>"
|
75 |
id="form_edit_multi_set" method="post">
|
76 |
|
77 |
+
<input type="hidden" name="yasr_edit_multi_set_form" value="<?php echo esc_attr($set_id); ?>"/>
|
78 |
|
79 |
<table id="yasr-table-form-edit-multi-set">
|
80 |
<tr>
|
124 |
<td width=\"80%\">" . __("Remove whole set?", 'yet-another-stars-rating') . "</td>
|
125 |
|
126 |
<td width=\"20%\" style=\"text-align:center\">
|
127 |
+
<input type=\"checkbox\" name=\"yasr-remove-multi-set\" value=\"$set_id\">
|
128 |
</td>
|
129 |
|
130 |
</tr>
|
133 |
|
134 |
";
|
135 |
|
136 |
+
echo '<p>';
|
137 |
+
esc_html_e("If you remove something you will remove all the votes for that set or field. This operation CAN'T BE undone.",
|
138 |
+
'yet-another-stars-rating');
|
139 |
+
echo '</p>';
|
140 |
+
|
141 |
+
echo '<p> </p>';
|
142 |
|
143 |
wp_nonce_field('edit-multi-set', 'add-nonce-edit-multi-set')
|
144 |
|
145 |
?>
|
146 |
|
147 |
+
<div id="yasr-element-limit" style="display:none; color:red">
|
148 |
+
<?php esc_html_e("You can use up to 9 elements", 'yet-another-stars-rating') ?>
|
149 |
+
</div>
|
150 |
|
151 |
+
<div>
|
152 |
+
<input type="button"
|
153 |
+
class="button-delete"
|
154 |
+
id="yasr-add-field-edit-multiset"
|
155 |
+
value="<?php esc_attr_e('Add element', 'yet-another-stars-rating'); ?>"
|
156 |
+
>
|
157 |
|
158 |
+
<input type="submit"
|
159 |
+
value="<?php esc_attr_e('Save changes', 'yet-another-stars-rating') ?>"
|
160 |
+
class="button-primary">
|
161 |
+
</div>
|
162 |
|
163 |
</form>
|
164 |
|
171 |
|
172 |
}//End function
|
173 |
|
|
|
174 |
/****** Get and output multiple set in a form and table, used in settings page ******/
|
175 |
|
176 |
add_action('wp_ajax_yasr_get_multi_set', 'yasr_get_multi_set_callback');
|
194 |
|
195 |
?>
|
196 |
|
197 |
+
<input type="hidden" name="yasr_edit_multi_set_form" value="<?php echo $set_id ?>"/>
|
|
|
|
|
198 |
|
199 |
+
<table id="yasr-table-form-edit-multi-set">
|
200 |
+
<tr>
|
201 |
+
<td id="yasr-table-form-edit-multi-set-header">
|
202 |
+
<?php esc_html_e('Field name', 'yet-another-stars-rating') ?>
|
203 |
+
</td>
|
204 |
|
205 |
+
<td id="yasr-table-form-edit-multi-set-remove">
|
206 |
+
<?php esc_html_e('Remove', 'yet-another-stars-rating') ?>
|
207 |
+
</td>
|
208 |
+
</tr>
|
209 |
|
210 |
+
<?php
|
211 |
|
212 |
+
$i = 1;
|
213 |
|
214 |
+
foreach ($set_name as $name) {
|
215 |
+
echo "
|
216 |
+
<tr>
|
217 |
+
<td width='80%'>
|
218 |
+
Element #$i <input type='text' value='$name->name' name='edit-multi-set-element-$i'>
|
219 |
+
<input type='hidden' value='$name->id' name='db-id-for-element-$i'>
|
220 |
+
</td>
|
221 |
|
222 |
+
<td width='20%' style=\"text-align:center\">
|
223 |
+
<input type=\"checkbox\" value=\"$name->id\" name=\"remove-element-$i\">
|
224 |
+
</td>
|
225 |
+
</tr>
|
226 |
+
";
|
227 |
+
$i ++;
|
228 |
+
}
|
229 |
|
230 |
+
$i = $i - 1; //This is the number of the fields
|
231 |
|
232 |
+
echo "
|
233 |
|
234 |
+
<input type=\"hidden\" name=\"yasr-edit-form-number-elements\" id=\"yasr-edit-form-number-elements\" value=\"$i\">
|
235 |
|
236 |
+
</table>
|
237 |
|
238 |
+
<table width=\"100%\" class=\"yasr-edit-form-remove-entire-set\">
|
239 |
+
<tr>
|
240 |
|
241 |
+
<td width=\"80%\">" . __("Remove whole set?", 'yet-another-stars-rating') . "</td>
|
242 |
|
243 |
+
<td width=\"20%\" style=\"text-align:center\">
|
244 |
+
<input type=\"checkbox\" name=\"yasr-remove-multi-set\" value=\"$set_id\">
|
245 |
+
</td>
|
246 |
|
247 |
+
</tr>
|
248 |
|
249 |
+
</table>
|
250 |
|
251 |
+
";
|
252 |
|
253 |
+
echo '<p>';
|
254 |
+
esc_html_e("If you remove something you will remove all the votes for that set or field. This operation CAN'T BE undone.",
|
255 |
+
'yet-another-stars-rating');
|
256 |
+
echo '</p>';
|
257 |
|
258 |
+
echo '<p> </p>';
|
259 |
|
260 |
+
wp_nonce_field('edit-multi-set', 'add-nonce-edit-multi-set')
|
261 |
|
262 |
+
?>
|
|
|
263 |
|
264 |
+
<div id="yasr-element-limit" style="display:none; color:red">
|
265 |
+
<?php esc_html_e("You can use up to 9 elements", 'yet-another-stars-rating') ?>
|
266 |
+
</div>
|
267 |
|
268 |
+
<div>
|
269 |
+
<input type="button"
|
270 |
+
class="button-delete"
|
271 |
+
id="yasr-add-field-edit-multiset"
|
272 |
+
value="<?php esc_attr_e('Add element', 'yet-another-stars-rating'); ?>"
|
273 |
+
>
|
274 |
|
275 |
+
<input type="submit"
|
276 |
+
value="<?php esc_attr_e('Save changes', 'yet-another-stars-rating') ?>"
|
277 |
+
class="button-primary">
|
278 |
+
</div>
|
279 |
|
280 |
<?php
|
281 |
|
336 |
|
337 |
$element_filled = 2;
|
338 |
|
339 |
+
//@todo increase number of element that can be stored
|
340 |
//If filled get the element from 3 to 9
|
341 |
for ($i = 3; $i <= 9; $i ++) {
|
342 |
|
admin/settings/rankings/yasr-ranking-builder.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/settings/yasr-pricing-page.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2020 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2020 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/settings/yasr-settings-functions-misc.php
CHANGED
@@ -43,7 +43,7 @@ function yasr_settings_tabs( $active_tab )
|
|
43 |
}
|
44 |
?>">
|
45 |
<?php
|
46 |
-
esc_html_e( 'Multi
|
47 |
?>
|
48 |
</a>
|
49 |
|
@@ -168,6 +168,63 @@ function yasr_description_allow_vote()
|
|
168 |
return $name . $div_desc . $description . $end_div;
|
169 |
}
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
/**
|
172 |
* @author Dario Curvino <@dudo>
|
173 |
* @since 2.6.6
|
43 |
}
|
44 |
?>">
|
45 |
<?php
|
46 |
+
esc_html_e( 'Multi Criteria', 'yet-another-stars-rating' );
|
47 |
?>
|
48 |
</a>
|
49 |
|
168 |
return $name . $div_desc . $description . $end_div;
|
169 |
}
|
170 |
|
171 |
+
/**
|
172 |
+
* Describe what is a Multiset in the setting page
|
173 |
+
*
|
174 |
+
* @author Dario Curvino <@dudo>
|
175 |
+
* @since 3.1.3
|
176 |
+
* @return string
|
177 |
+
*/
|
178 |
+
function yasr_multiset_description()
|
179 |
+
{
|
180 |
+
$title = esc_html__( 'Multi-criteria based rating system.', 'yet-another-stars-rating' );
|
181 |
+
$div = '<div class="yasr-settings-description">';
|
182 |
+
$description = sprintf(
|
183 |
+
esc_html__( 'A Multi-criteria set allows you to insert a rating for each aspect of your review (up to nine rows).
|
184 |
+
%s Once you\'ve saved it, you can insert
|
185 |
+
the rates while typing your article in the %s box below the editor.%s %s
|
186 |
+
See it in action %s here%s .', 'yet-another-stars-rating' ),
|
187 |
+
'<br />',
|
188 |
+
'<a href=' . esc_url( YASR_IMG_DIR . 'yasr-multi-set-insert-rating.png' ) . ' target="_blank">',
|
189 |
+
'</a>',
|
190 |
+
'<br />',
|
191 |
+
'<a href=' . esc_url( "https://yetanotherstarsrating.com/yasr-shortcodes/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr_newmultiset_desc#yasr-multiset-shortcodes" ) . ' target="_blank">',
|
192 |
+
'</a>'
|
193 |
+
);
|
194 |
+
return $title . $div . $description . '</div>';
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Description for setting field "edit multiset"
|
199 |
+
*
|
200 |
+
* @author Dario Curvino <@dudo>
|
201 |
+
* @since 3.1.3
|
202 |
+
* @return string
|
203 |
+
*/
|
204 |
+
function yasr_manage_multiset_description()
|
205 |
+
{
|
206 |
+
$title = esc_html__( 'Manage Multi Set', 'yet-another-stars-rating' );
|
207 |
+
$div = '<div class="yasr-settings-description">';
|
208 |
+
$description = esc_html__( 'Add or remove an element, or the entire set.' );
|
209 |
+
return $title . $div . $description . '</div>';
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Show the description for "Show average" row in multi set setting page
|
214 |
+
*
|
215 |
+
* @author Dario Curvino <@dudo>
|
216 |
+
* @since 3.1.3
|
217 |
+
* @return string
|
218 |
+
*/
|
219 |
+
function yasr_show_average_multiset_description()
|
220 |
+
{
|
221 |
+
$title = esc_html__( 'Show average?', 'yet-another-stars-rating' );
|
222 |
+
$div = '<div class="yasr-settings-description">';
|
223 |
+
$description = esc_html__( 'If you select no, the "Average" row will not be displayed.
|
224 |
+
You can override this in the single multi set by using the parameter "show_average".', 'yet-another-stars-rating' );
|
225 |
+
return $title . $div . $description . '</div>';
|
226 |
+
}
|
227 |
+
|
228 |
/**
|
229 |
* @author Dario Curvino <@dudo>
|
230 |
* @since 2.6.6
|
admin/settings/yasr-settings-page.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/settings/yasr-stats-page.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/yasr-admin-actions-ajax.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/yasr-admin-filters.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
admin/yasr-admin-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
admin/yasr-admin-init.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrCustomPostTypes.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrDatabaseRatings.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrDefineOptions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrFindCachingPlugins.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2020 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2020 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrLogDashboardWidget.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrMultiSetData.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrPhpFieldsHelper.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/classes/YasrRankingData.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/img/yasr-multi-set-insert-rate-small.jpg
DELETED
Binary file
|
includes/img/yasr-multi-set-insert-rate.jpg
DELETED
Binary file
|
includes/img/yasr-multi-set-insert-rating.png
ADDED
Binary file
|
includes/img/yasr-multi-set.png
DELETED
Binary file
|
includes/shortcodes/classes/YasrMultiSet.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
@@ -52,11 +52,17 @@ class YasrMultiSet extends YasrShortcode {
|
|
52 |
/**
|
53 |
* @return string | bool
|
54 |
*/
|
55 |
-
public function printMultiset () {
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
$this->shortcode_html = '<!-- Yasr Multi Set Shortcode-->';
|
58 |
|
59 |
-
$multiset_content = YasrMultiSetData::returnMultisetContent($
|
60 |
|
61 |
if ($multiset_content === false) {
|
62 |
return $this->returnErrorData('<!-- Yasr Multi Set Shortcode-->');
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
52 |
/**
|
53 |
* @return string | bool
|
54 |
*/
|
55 |
+
public function printMultiset ($post_id = null, $set_id = null) {
|
56 |
+
if($post_id === null) {
|
57 |
+
$post_id = $this->post_id;
|
58 |
+
}
|
59 |
+
if($set_id === null) {
|
60 |
+
$set_id = $this->set_id;
|
61 |
+
}
|
62 |
|
63 |
$this->shortcode_html = '<!-- Yasr Multi Set Shortcode-->';
|
64 |
|
65 |
+
$multiset_content = YasrMultiSetData::returnMultisetContent($post_id, $set_id);
|
66 |
|
67 |
if ($multiset_content === false) {
|
68 |
return $this->returnErrorData('<!-- Yasr Multi Set Shortcode-->');
|
includes/shortcodes/classes/YasrNoStarsRankings.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/shortcodes/classes/YasrOverallRating.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/shortcodes/classes/YasrRankings.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
includes/shortcodes/classes/YasrShortcode.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/shortcodes/classes/YasrShortcodesAjax.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
includes/shortcodes/classes/YasrVisitorMultiSet.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
includes/shortcodes/classes/YasrVisitorVotes.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
includes/shortcodes/yasr-shortcode-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/yasr-includes-db-functions.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
includes/yasr-includes-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
includes/yasr-includes-init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
includes/yasr-widgets.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
2 |
|
3 |
/*
|
4 |
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
6 |
|
7 |
This program is free software: you can redistribute it and/or modify
|
8 |
it under the terms of the GNU General Public License as published by
|
public/yasr-public-init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
-
Copyright 2014 Dario Curvino (email : d.curvino@
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
/*
|
3 |
|
4 |
+
Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
|
5 |
|
6 |
This program is free software: you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License as published by
|
readme.txt
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Yasr - Yet Another Stars Rating ===
|
2 |
+
Donate link: https://www.paypal.com/donate/?hosted_button_id=SVTAVUF62QZ4W
|
3 |
+
Tags: rating, rate post, star rating, google rating, block
|
4 |
+
Requires at least: 4.7
|
5 |
+
Contributors: Dudo
|
6 |
+
Tested up to: 6.1
|
7 |
+
Stable tag: 3.1.4
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
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
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
Improving the user experience with your website is a top priority for everyone who cares about their online activity,
|
14 |
+
as it promotes familiarity and loyalty with your brand, and enhances visibility of your activity.
|
15 |
+
|
16 |
+
Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your
|
17 |
+
website posts, pages and CPT, without affecting its speed.
|
18 |
+
|
19 |
+
== How To use ==
|
20 |
+
|
21 |
+
== Reviewer Vote ==
|
22 |
+
With the classic editor, when you create or update a page or a post, a box (metabox) will be available in the upper right corner where you'll
|
23 |
+
be able to insert the overall rating.
|
24 |
+
With the new Guteneberg editor, just click on the "+" icon to add a block and search for Yasr Overall Rating.
|
25 |
+
You can either place the overall rating automatically at the beginning or the end of a post (look in "Settings"
|
26 |
+
-> "Yet Another Stars Rating: Settings"), or wherever you want in the page using the shortcode [yasr_overall_rating] (easily added through the visual editor).
|
27 |
+
|
28 |
+
== Visitor Votes ==
|
29 |
+
You can give your users the ability to vote, pasting the shortcode [yasr_visitor_votes] where you want the stars to appear.
|
30 |
+
If you're using the new Gutenberg editor, just click on the "+" icon to add a block and search for Yasr Visitor Votes
|
31 |
+
Again, this can be placed automatically at the beginning or the end of each post; the option is in "Settings" -> "Yet Another Stars Rating: Settings".
|
32 |
+
|
33 |
+
== Multi Set ==
|
34 |
+
Multisets give the opportunity to score different aspects for each review: for example, if you're reviewing a videogame, you can create the aspects "Graphics", "Gameplay", "Story", etc.
|
35 |
+
|
36 |
+
== Migration tools ==
|
37 |
+
You can easily migrate from *WP-PostRatings*, *kk Star Ratings*, *Rate My Post* and *Multi Rating*
|
38 |
+
A tab will appear in the settings if one of these plugin is detected.
|
39 |
+
|
40 |
+
== Supported itemtypes ==
|
41 |
+
YASR supports the following schema.org itemtypes:
|
42 |
+
|
43 |
+
BlogPosting ✝,
|
44 |
+
Book ¶,
|
45 |
+
Course,
|
46 |
+
CreativeWorkSeason,
|
47 |
+
CreativeWorkSeries,
|
48 |
+
Episode,
|
49 |
+
Event,
|
50 |
+
Game,
|
51 |
+
LocalBusiness ‡,
|
52 |
+
MediaObject,
|
53 |
+
Movie Δ,
|
54 |
+
MusicPlaylist,
|
55 |
+
MusicRecording,
|
56 |
+
Organization,
|
57 |
+
Product §,
|
58 |
+
Recipe ||,
|
59 |
+
SoftwareApplication ◊
|
60 |
+
|
61 |
+
✝ BlogPosting itemtype will not show stars in search result.
|
62 |
+
More info [here](https://wordpress.org/plugins/yet-another-stars-rating/faq/)
|
63 |
+
|
64 |
+
¶ Book supports the following properties
|
65 |
+
* author
|
66 |
+
* bookEdition
|
67 |
+
* BookFormat
|
68 |
+
* ISBN
|
69 |
+
* numberOfPages
|
70 |
+
|
71 |
+
‡ LocalBusiness supports the following properties
|
72 |
+
* Address
|
73 |
+
* PriceRange
|
74 |
+
* Telephone
|
75 |
+
|
76 |
+
Δ Movie supports the following properties
|
77 |
+
* actor
|
78 |
+
* director
|
79 |
+
* Duration
|
80 |
+
* dateCreated
|
81 |
+
|
82 |
+
§ Products supports the following properties
|
83 |
+
* Brand
|
84 |
+
* Sku
|
85 |
+
* Global identifiers
|
86 |
+
* Price
|
87 |
+
* Currency
|
88 |
+
* Price Valid Until
|
89 |
+
* Availability
|
90 |
+
* Url
|
91 |
+
|
92 |
+
|| Recipe supports the following properties
|
93 |
+
* cookTime
|
94 |
+
* prepTime
|
95 |
+
* description
|
96 |
+
* keywords
|
97 |
+
* nutrition
|
98 |
+
* recipeCategory
|
99 |
+
* recipeCuisine
|
100 |
+
* recipeIngredient
|
101 |
+
|
102 |
+
◊ SoftwareApplication supports the following properties
|
103 |
+
* applicationCategory
|
104 |
+
* operatingSystem
|
105 |
+
* Currency
|
106 |
+
* Price Valid Until
|
107 |
+
* Availability
|
108 |
+
* Url
|
109 |
+
|
110 |
+
== Video Tutorial ==
|
111 |
+
|
112 |
+
= Old video, but still valid. =
|
113 |
+
[youtube https://www.youtube.com/watch?v=M47xsJMQJ1E]
|
114 |
+
|
115 |
+
= New videos, talked in Italian but easily to understand (eng subs will come) =
|
116 |
+
[Tutorial's playlist](https://www.youtube.com/playlist?list=PLFErQFOLUVMcx8Qb9--KKme3bQ_KGri71)
|
117 |
+
|
118 |
+
== Developers ==
|
119 |
+
While YASR - Yet Another Stars Rating does not require any coding, it is developer friendly!
|
120 |
+
It is the first (and for now only) rating plugin that uses REST API.
|
121 |
+
[Here](https://documenter.getpostman.com/view/12873985/TzJycbVz) you can find the documentation.
|
122 |
+
Further, it comes with a lot of hooks, you can find more info [here](https://yetanotherstarsrating.com/docs/developers/) .
|
123 |
+
|
124 |
+
== GitHub ==
|
125 |
+
* [Follow development on GitHub](https://github.com/Dudo1985/yet-another-stars-rating)
|
126 |
+
|
127 |
+
== Related Link ==
|
128 |
+
* [All available shortcodes in free version](https://yetanotherstarsrating.com/yasr-shortcodes/)
|
129 |
+
* Documentation at [Yasr Official Site](https://yetanotherstarsrating.com/docs/)
|
130 |
+
|
131 |
+
Do you want more feature? [Check out Yasr Pro!](https://yetanotherstarsrating.com/#yasr-pro)
|
132 |
+
|
133 |
+
== Press ==
|
134 |
+
[Tutorial by Qode Magazine](https://qodeinteractive.com/magazine/how-to-add-post-rating-to-your-wordpress-website/)
|
135 |
+
[Tutorial by Greengeeks](https://www.greengeeks.com/tutorials/star-rating-system-yasr-wordpress/)
|
136 |
+
|
137 |
+
== Installation ==
|
138 |
+
1. Navigate to Dashboard -> Plugins -> Add New and search for YASR
|
139 |
+
2. Click on "Installa Now" and than "Activate"
|
140 |
+
|
141 |
+
== Frequently Asked Questions ==
|
142 |
+
|
143 |
+
= What is "Overall Rating"? =
|
144 |
+
It is the vote given by who writes the review: readers are able to see this vote in read-only mode. Reviewer can vote using the box on the top right in the editor screen. Remember to insert this shortcode **[yasr_overall_rating]** to make it appear where you like.
|
145 |
+
|
146 |
+
= What is "Visitor Rating"? =
|
147 |
+
It is the vote that allows your visitors to vote: just paste this shortcode **[yasr_visitor_votes]** where you want the stars to appear.
|
148 |
+
|
149 |
+
[Demo page for Overall Rating and Vistor Rating](https://yetanotherstarsrating.com/yasr-shortcodes/)
|
150 |
+
|
151 |
+
= What is "Multi Set"? =
|
152 |
+
It is the feature that makes YASR awesome. Multisets give the opportunity to score different aspects for each review: for example, if you're reviewing a videogame, you can create the aspects "Graphics", "Gameplay", "Story", etc. and give a vote for each one. To create a set, just go in "Settings" -> "Yet Another Stars Rating: Settings" and click on the "Multi Sets" tab. To insert it into a post, just paste the shortcode that YASR will create for you.
|
153 |
+
|
154 |
+
[Demo page for Multi Sets](https://yetanotherstarsrating.com/yasr-shortcodes/#yasr-multiset-shortcodes)
|
155 |
+
|
156 |
+
= What is "Ranking reviews" ? =
|
157 |
+
It is the 10 highest rated item ranking by reviewer. In order to insert it into a post or page, just paste this shortcode **[yasr_ov_ranking]**
|
158 |
+
|
159 |
+
= Wht is "Users' ranking" ? =
|
160 |
+
This is 2 charts in 1. Infact, this chart shows both the most rated posts/pages or the highest rated posts/pages.
|
161 |
+
For an item to appear in this chart, it has to be rated twice at least.
|
162 |
+
Paste this shortcode to make it appear where you want **[yasr_most_or_highest_rated_posts]**
|
163 |
+
|
164 |
+
= What is "Most active reviewers" ? =
|
165 |
+
If in your site there are more than 1 person writing reviews, this chart will show the 5 most active reviewers. Shortcode is **[yasr_top_reviewers]**
|
166 |
+
|
167 |
+
= What is "Most active users" ? =
|
168 |
+
When a visitor (logged in or not) rates a post/page, his rating is stored in the database. This chart will show the 10 most active users, displaying the login name if logged in or "Anonymous" otherwise. The shortcode : **[yasr_most_active_users]**
|
169 |
+
|
170 |
+
[Demo page for Rankings](https://yetanotherstarsrating.com/yasr-shortcodes/#yasr-rankings-shortcodes)
|
171 |
+
|
172 |
+
= Wait, wait! Do I need to keep in mind all this shortcode? =
|
173 |
+
If you're using the new Gutenberg editor, you don't need at all: just use the blocks.
|
174 |
+
If, instead, you're using the classic editor, in the visual tab just click the "Yasr Shortcode" button above the editor
|
175 |
+
|
176 |
+
= Does it work with caching plugins? =
|
177 |
+
Since version 2.3.0 YASR works with *every caching plugin available out there*.
|
178 |
+
In the settings, just select "yes" to "Load results with AJAX".
|
179 |
+
YASR has been tested with:
|
180 |
+
* Wp Super Cache
|
181 |
+
* LiteSpeed Cache
|
182 |
+
* Wp Fastest Cache
|
183 |
+
* WP-Optimize
|
184 |
+
* Cache Enabler
|
185 |
+
* Hyper Cache
|
186 |
+
* Wp Rocket
|
187 |
+
|
188 |
+
= Why I don't see stars in google? =
|
189 |
+
[Read here](https://yetanotherstarsrating.com/yasr-rich-snippets/) and find out how to set up rich snippets.
|
190 |
+
You can use the [Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool/u/0/) to validate your pages.
|
191 |
+
Also [read this](https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html) google announcement.
|
192 |
+
If you set up everything fine, in 99% of cases your stars will appear in a week.
|
193 |
+
If doesn't, you should work on your seo reputation.
|
194 |
+
|
195 |
+
= Does it work with PHP 8? =
|
196 |
+
Yes, YASR is 100% fully compatible with PHP 8
|
197 |
+
|
198 |
+
== Screenshots ==
|
199 |
+
1. Example of Yasr Overall Rating and Yasr Visitor Votes shortcodes
|
200 |
+
2. Yasr Multi Set
|
201 |
+
3. User's ranking showing most rated posts
|
202 |
+
4. User's ranking showing the highest rated posts
|
203 |
+
5. Ranking reviews
|
204 |
+
|
205 |
+
== Changelog ==
|
206 |
+
|
207 |
+
The full changelog can be found in the plugin's directory. Recent entries:
|
208 |
+
|
209 |
+
= 3.1.4 =
|
210 |
+
* TWEAKED: in the setting page, there is now a new form for creating multi set
|
211 |
+
* TWEAKED: minor changes and code cleanup
|
212 |
+
|
213 |
+
= 3.1.3 =
|
214 |
+
* FIXED: security fix
|
215 |
+
* FIXED: in the settings page, last div didn't float good
|
216 |
+
|
217 |
+
= 3.1.2 =
|
218 |
+
* TWEAKED: added new filters yasr_custom_loader and yasr_custom_loader_url to customize loader
|
219 |
+
* FIXED: better ajax response when data is imported from another plugin
|
220 |
+
|
221 |
+
= 3.1.1 =
|
222 |
+
* FIXED: Rich snippets fix for "Product itemType". See [#1](https://github.com/Dudo1985/Yet-Another-Stars-Rating/issues/1).
|
223 |
+
* TWEAKED: updated Freemius sdk to version 2.4.5
|
224 |
+
|
225 |
+
= 3.1.0 =
|
226 |
+
* TWEAKED: A lot of under the hood changes
|
227 |
+
* TWEAKED: Updated Freemius sdk to version 2.4.4
|
228 |
+
|
229 |
+
= 3.0.9 =
|
230 |
+
* TWEAKED: code cleanup in gutenberg blocks
|
231 |
+
|
232 |
+
= 3.0.8 =
|
233 |
+
* FIXED: YASR gutenberg panel didn't shop up once hidden
|
234 |
+
* TWEAKED: minor changes
|
235 |
+
|
236 |
+
= 3.0.7 =
|
237 |
+
* FIXED: when the value 0 is entered for the Price the ‘Offers’ field is not displayed in the Schema markup.
|
238 |
+
* TWEAKED: minor changes
|
239 |
+
|
240 |
+
= 3.0.6 =
|
241 |
+
* FIX: translation for rankings shortcodes
|
242 |
+
* FIX: in the classic editor, if Multi Set is used, a duplicate query were run
|
243 |
+
* FIX: "Insert Multiset" button in shortcode creator didn't work
|
244 |
+
* TWEAKED: gutenberg block now works with .block.json files
|
245 |
+
* TWEAKED: added yasr_user_rate_history in shortcode creator for classic editor, and as new Gutenberg Block
|
246 |
+
* TWEAKED: added new actions
|
247 |
+
* TWEAKED: under the hood changes.
|
248 |
+
|
249 |
+
= 3.0.5 =
|
250 |
+
* FIX: set_id parameter didn't work in shortcodes yasr_multi_set_ranking and yasr_visitor_multi_set_ranking
|
251 |
+
* FIX: rankings didn't show up when post title contains quotation marks ( " )
|
252 |
+
* TWEAKED: In the setting page, section "Custom texts" is now renamed in "Customize strings", and it works on two columns
|
253 |
+
(more strings will come soon)
|
254 |
+
* TWEAKED: under the hood changes.
|
255 |
+
|
256 |
+
|
257 |
+
= 3.0.4 =
|
258 |
+
* FIX: Author multiset didn't get saved
|
259 |
+
* TWEAKED: better error handling
|
260 |
+
|
261 |
+
= Additional Info =
|
262 |
+
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: 3.1.
|
8 |
* Requires at least: 4.7
|
9 |
* Requires PHP: 5.4
|
10 |
* Author: Dario Curvino
|
@@ -17,7 +17,7 @@
|
|
17 |
*/
|
18 |
/*
|
19 |
|
20 |
-
Copyright 2015 Dario Curvino (email : d.curvino@
|
21 |
|
22 |
This program is free software: you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -78,7 +78,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
78 |
yasr_fs();
|
79 |
// Signal that SDK was initiated.
|
80 |
do_action( 'yasr_fs_loaded' );
|
81 |
-
define( 'YASR_VERSION_NUM', '3.1.
|
82 |
//Plugin absolute path
|
83 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
84 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|
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: 3.1.4
|
8 |
* Requires at least: 4.7
|
9 |
* Requires PHP: 5.4
|
10 |
* Author: Dario Curvino
|
17 |
*/
|
18 |
/*
|
19 |
|
20 |
+
Copyright 2015 Dario Curvino (email : d.curvino@gmail.com)
|
21 |
|
22 |
This program is free software: you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
78 |
yasr_fs();
|
79 |
// Signal that SDK was initiated.
|
80 |
do_action( 'yasr_fs_loaded' );
|
81 |
+
define( 'YASR_VERSION_NUM', '3.1.4' );
|
82 |
//Plugin absolute path
|
83 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
84 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|