Version Description
- Removed showing ip from widget in the user dashboard
- Better cookie managment
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6.2
- js/yasr-front.js +0 -2
- lib/yasr-ajax-functions.php +14 -4
- lib/yasr-db-functions.php +6 -8
- lib/yasr-functions.php +17 -10
- lib/yasr-settings-functions.php +1 -1
- lib/yasr-shortcode-functions.php +70 -20
- readme.txt +5 -1
- yet-another-stars-rating.php +2 -2
js/yasr-front.js
CHANGED
@@ -128,8 +128,6 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
128 |
|
129 |
jQuery('#yasr-send-visitor-multiset-'+postId+'-'+setType).hide();
|
130 |
|
131 |
-
var cookiename = "yasr_multi_visitor_vote_" + postId+'_'+setType;
|
132 |
-
|
133 |
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).show();
|
134 |
|
135 |
var data = {
|
128 |
|
129 |
jQuery('#yasr-send-visitor-multiset-'+postId+'-'+setType).hide();
|
130 |
|
|
|
|
|
131 |
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).show();
|
132 |
|
133 |
var data = {
|
lib/yasr-ajax-functions.php
CHANGED
@@ -1126,9 +1126,14 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1126 |
$user_votes_sum = $stored_user_votes_sum;
|
1127 |
$number_of_votes = $stored_number_of_votes;
|
1128 |
|
1129 |
-
$cookiename =
|
1130 |
|
1131 |
-
|
|
|
|
|
|
|
|
|
|
|
1132 |
|
1133 |
$total_rating = ($user_votes_sum / $number_of_votes);
|
1134 |
$medium_rating = round ($total_rating, 1);
|
@@ -1281,9 +1286,14 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1281 |
|
1282 |
if(!$error_found) {
|
1283 |
|
1284 |
-
$cookiename = '
|
|
|
|
|
|
|
|
|
|
|
1285 |
|
1286 |
-
yasr_setcookie($cookiename,
|
1287 |
|
1288 |
_e('Rating saved!', 'yet-another-stars-rating');
|
1289 |
|
1126 |
$user_votes_sum = $stored_user_votes_sum;
|
1127 |
$number_of_votes = $stored_number_of_votes;
|
1128 |
|
1129 |
+
$cookiename = 'yasr_visitor_vote_cookie';
|
1130 |
|
1131 |
+
$data_to_save = array(
|
1132 |
+
'post_id' => $post_id,
|
1133 |
+
'rating' => $rating
|
1134 |
+
);
|
1135 |
+
|
1136 |
+
yasr_setcookie($cookiename, $data_to_save);
|
1137 |
|
1138 |
$total_rating = ($user_votes_sum / $number_of_votes);
|
1139 |
$medium_rating = round ($total_rating, 1);
|
1286 |
|
1287 |
if(!$error_found) {
|
1288 |
|
1289 |
+
$cookiename = 'yasr_multi_visitor_cookie';
|
1290 |
+
|
1291 |
+
$data_to_save = array(
|
1292 |
+
'post_id' => $post_id,
|
1293 |
+
'set_id' => $set_type
|
1294 |
+
);
|
1295 |
|
1296 |
+
yasr_setcookie($cookiename, $data_to_save);
|
1297 |
|
1298 |
_e('Rating saved!', 'yet-another-stars-rating');
|
1299 |
|
lib/yasr-db-functions.php
CHANGED
@@ -586,10 +586,11 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
|
|
586 |
$link = get_permalink( $column->post_id );
|
587 |
|
588 |
$yasr_log_vote_text = sprintf(__('You rated %s on ', 'yet-another-stars-rating'), '<strong style="color: blue">'.$column->vote.'</strong>');
|
|
|
589 |
|
590 |
echo "
|
591 |
|
592 |
-
<div class=\"yasr-log-div-child\">
|
593 |
|
594 |
<div class=\"yasr-log-image\">
|
595 |
$avatar
|
@@ -598,14 +599,11 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
|
|
598 |
<div class=\"yasr-log-child-head\">
|
599 |
<span id=\"yasr-log-vote\">$yasr_log_vote_text</span><span class=\"yasr-log-post\"><a href=\"$link\">$title_post</a></span>
|
600 |
</div>
|
601 |
-
|
602 |
-
<div class=\"yasr-log-
|
603 |
-
|
604 |
-
<span class=\"yasr-log-ip\">" . __("Ip address" , 'yet-another-stars-rating') . ": <span style=\"color:blue\">$column->ip</span></span>
|
605 |
-
|
606 |
-
<span class=\"yasr-log-date\">$column->date</span>
|
607 |
-
|
608 |
</div>
|
|
|
609 |
|
610 |
</div>
|
611 |
|
586 |
$link = get_permalink( $column->post_id );
|
587 |
|
588 |
$yasr_log_vote_text = sprintf(__('You rated %s on ', 'yet-another-stars-rating'), '<strong style="color: blue">'.$column->vote.'</strong>');
|
589 |
+
$yasr_log_date_text = __('Date:', 'yet-another-stars-rating');
|
590 |
|
591 |
echo "
|
592 |
|
593 |
+
<div class=\"yasr-log-div-child\" style=\"padding-bottom: 2px;\" >
|
594 |
|
595 |
<div class=\"yasr-log-image\">
|
596 |
$avatar
|
599 |
<div class=\"yasr-log-child-head\">
|
600 |
<span id=\"yasr-log-vote\">$yasr_log_vote_text</span><span class=\"yasr-log-post\"><a href=\"$link\">$title_post</a></span>
|
601 |
</div>
|
602 |
+
|
603 |
+
<div class=\"yasr-log-child-head\">
|
604 |
+
<strong>$yasr_log_date_text</strong> <span class=\"yasr-log-date-user\">$column->date</span>
|
|
|
|
|
|
|
|
|
605 |
</div>
|
606 |
+
|
607 |
|
608 |
</div>
|
609 |
|
lib/yasr-functions.php
CHANGED
@@ -216,7 +216,7 @@ function yasr_css_stars_set() {
|
|
216 |
'manage_options', //capability
|
217 |
'yasr_settings_page', //menu slug
|
218 |
'yasr_settings_page_callback', //The function to be called to output the content for this page.
|
219 |
-
'dashicons-star-
|
220 |
);
|
221 |
|
222 |
add_submenu_page('yasr_settings_page',
|
@@ -788,7 +788,6 @@ function yasr_stars_size ($size) {
|
|
788 |
|
789 |
$size = sanitize_text_field($size);
|
790 |
|
791 |
-
//var_dump($size);
|
792 |
|
793 |
$stars_attribute = array();
|
794 |
|
@@ -811,8 +810,6 @@ function yasr_stars_size ($size) {
|
|
811 |
$stars_attribute['px_size'] = '32';
|
812 |
}
|
813 |
|
814 |
-
//var_dump($stars_attribute);
|
815 |
-
|
816 |
return $stars_attribute;
|
817 |
|
818 |
}
|
@@ -855,16 +852,26 @@ function yasr_litespeed_cache_support($post_id) {
|
|
855 |
|
856 |
|
857 |
/*** Function to set cookie, since version 0.8.3 ***/
|
858 |
-
function yasr_setcookie($cookiename, $
|
859 |
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
|
864 |
-
|
|
|
865 |
|
866 |
-
|
|
|
867 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
|
869 |
/*** Function to get ip, since version 0.8.8
|
870 |
This code can be found on http://codex.wordpress.org/Plugin_API/Filter_Reference/pre_comment_user_ip
|
216 |
'manage_options', //capability
|
217 |
'yasr_settings_page', //menu slug
|
218 |
'yasr_settings_page_callback', //The function to be called to output the content for this page.
|
219 |
+
'dashicons-star-half'
|
220 |
);
|
221 |
|
222 |
add_submenu_page('yasr_settings_page',
|
788 |
|
789 |
$size = sanitize_text_field($size);
|
790 |
|
|
|
791 |
|
792 |
$stars_attribute = array();
|
793 |
|
810 |
$stars_attribute['px_size'] = '32';
|
811 |
}
|
812 |
|
|
|
|
|
813 |
return $stars_attribute;
|
814 |
|
815 |
}
|
852 |
|
853 |
|
854 |
/*** Function to set cookie, since version 0.8.3 ***/
|
855 |
+
function yasr_setcookie($cookiename, $data_to_save) {
|
856 |
|
857 |
+
if ( ! $data_to_save || ! $cookiename ) {
|
858 |
+
exit( 'Error setting yasr cookie' );
|
859 |
+
}
|
860 |
|
861 |
+
//setcookie add \ , so I need to stripslahes
|
862 |
+
$existing_data = stripslashes( $_COOKIE[ $cookiename ] );
|
863 |
|
864 |
+
//unserialize
|
865 |
+
$existing_data = unserialize( $existing_data);
|
866 |
|
867 |
+
//whetever exists or not, push into at the end of array
|
868 |
+
$existing_data[] = $data_to_save;
|
869 |
+
|
870 |
+
$encoded_data = serialize( $existing_data );
|
871 |
+
|
872 |
+
setcookie( $cookiename, $encoded_data, time() + 31536000, COOKIEPATH, COOKIE_DOMAIN );
|
873 |
+
|
874 |
+
}
|
875 |
|
876 |
/*** Function to get ip, since version 0.8.8
|
877 |
This code can be found on http://codex.wordpress.org/Plugin_API/Filter_Reference/pre_comment_user_ip
|
lib/yasr-settings-functions.php
CHANGED
@@ -1664,7 +1664,7 @@ function yasr_upgrade_pro_box ($position=FALSE) {
|
|
1664 |
</ul>
|
1665 |
|
1666 |
|
1667 |
-
<a href="
|
1668 |
<p> or </p>
|
1669 |
<a href="<?php echo yasr_fs()->get_upgrade_url(); ?>"><button class="button button-primary">Upgrade Now</button></a>
|
1670 |
|
1664 |
</ul>
|
1665 |
|
1666 |
|
1667 |
+
<a href="<?php echo yasr_fs()->get_trial_url() ?>">Free 14-Day Trial - No Credit Card</a>
|
1668 |
<p> or </p>
|
1669 |
<a href="<?php echo yasr_fs()->get_upgrade_url(); ?>"><button class="button button-primary">Upgrade Now</button></a>
|
1670 |
|
lib/yasr-shortcode-functions.php
CHANGED
@@ -131,6 +131,11 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
131 |
|
132 |
$ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
|
133 |
|
|
|
|
|
|
|
|
|
|
|
134 |
$votes=yasr_get_visitor_votes($post_id); //always reference it
|
135 |
|
136 |
$medium_rating=0; //Avoid undefined variable
|
@@ -156,23 +161,43 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
156 |
|
157 |
$stars_attribute = yasr_stars_size($size);
|
158 |
|
159 |
-
//
|
160 |
-
|
161 |
-
$yasr_cookiename = 'yasr_visitor_vote_' . $post_id;
|
162 |
|
163 |
if (isset($_COOKIE[$yasr_cookiename])) {
|
164 |
|
165 |
-
$
|
|
|
|
|
166 |
|
167 |
-
$
|
168 |
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
$cookie_value = 5;
|
172 |
|
173 |
}
|
174 |
|
175 |
-
elseif ($cookie_value < 1) {
|
176 |
|
177 |
$cookie_value = 1;
|
178 |
|
@@ -271,7 +296,8 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
271 |
|
272 |
}
|
273 |
|
274 |
-
|
|
|
275 |
|
276 |
$text_before_star = str_replace('%total_count%', $votes_number, YASR_TEXT_BEFORE_VISITOR_RATING);
|
277 |
|
@@ -314,10 +340,7 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
314 |
<!--End Yasr Visitor Votes Shortcode-->
|
315 |
';
|
316 |
|
317 |
-
|
318 |
-
'nonceVisitor' => $ajax_nonce_visitor
|
319 |
-
)
|
320 |
-
);
|
321 |
|
322 |
|
323 |
|
@@ -559,8 +582,6 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
559 |
|
560 |
}
|
561 |
|
562 |
-
$cookiename = 'yasr_multi_visitor_cookie_' . $post_id . '_' . $setid;
|
563 |
-
|
564 |
$image = YASR_IMG_DIR . "/loader.gif";
|
565 |
|
566 |
$average_txt = __("Average", "yet-another-stars-rating");
|
@@ -569,13 +590,42 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
569 |
|
570 |
$button_html = "<input type=\"submit\" name=\"submit\" id=\"yasr-send-visitor-multiset-$post_id-$setid\" class=\"button button-primary\" value=\"" . __('Submit!', 'yet-another-stars-rating') . " \" />";
|
571 |
|
572 |
-
|
573 |
|
574 |
-
|
575 |
-
$star_readonly = 'true';
|
576 |
-
$span_message_content = __('Thank you for voting! ', 'yet-another-stars-rating');
|
577 |
|
578 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
|
580 |
else {
|
581 |
|
@@ -608,7 +658,7 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
608 |
$star_readonly = 'false';
|
609 |
$span_message_content = "";
|
610 |
|
611 |
-
|
612 |
|
613 |
}
|
614 |
|
131 |
|
132 |
$ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
|
133 |
|
134 |
+
wp_localize_script( 'yasrfront', "yasrVisitorsVotesData", array(
|
135 |
+
'nonceVisitor' => $ajax_nonce_visitor
|
136 |
+
)
|
137 |
+
);
|
138 |
+
|
139 |
$votes=yasr_get_visitor_votes($post_id); //always reference it
|
140 |
|
141 |
$medium_rating=0; //Avoid undefined variable
|
161 |
|
162 |
$stars_attribute = yasr_stars_size($size);
|
163 |
|
164 |
+
//name of coockie to check
|
165 |
+
$yasr_cookiename = 'yasr_visitor_vote_cookie';
|
|
|
166 |
|
167 |
if (isset($_COOKIE[$yasr_cookiename])) {
|
168 |
|
169 |
+
$cookie_data = stripslashes($_COOKIE[$yasr_cookiename]);
|
170 |
+
|
171 |
+
$cookie_data = unserialize($cookie_data);
|
172 |
|
173 |
+
foreach ($cookie_data as $value) {
|
174 |
|
175 |
+
$cookie_post_id = (int)$value['post_id'];
|
176 |
+
|
177 |
+
if ($cookie_post_id === $post_id) {
|
178 |
+
|
179 |
+
$cookie_value = (int)$value['rating'];
|
180 |
+
|
181 |
+
//Stop doing foreach, here we've found the rating for current post
|
182 |
+
break;
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
else {
|
187 |
+
|
188 |
+
$cookie_value = FALSE;
|
189 |
+
|
190 |
+
}
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
if ($cookie_value !== FALSE && $cookie_value > 5) {
|
195 |
|
196 |
$cookie_value = 5;
|
197 |
|
198 |
}
|
199 |
|
200 |
+
elseif ($cookie_value !== FALSE && $cookie_value < 1) {
|
201 |
|
202 |
$cookie_value = 1;
|
203 |
|
296 |
|
297 |
}
|
298 |
|
299 |
+
|
300 |
+
if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_VISITOR_RATING != '') {
|
301 |
|
302 |
$text_before_star = str_replace('%total_count%', $votes_number, YASR_TEXT_BEFORE_VISITOR_RATING);
|
303 |
|
340 |
<!--End Yasr Visitor Votes Shortcode-->
|
341 |
';
|
342 |
|
343 |
+
|
|
|
|
|
|
|
344 |
|
345 |
|
346 |
|
582 |
|
583 |
}
|
584 |
|
|
|
|
|
585 |
$image = YASR_IMG_DIR . "/loader.gif";
|
586 |
|
587 |
$average_txt = __("Average", "yet-another-stars-rating");
|
590 |
|
591 |
$button_html = "<input type=\"submit\" name=\"submit\" id=\"yasr-send-visitor-multiset-$post_id-$setid\" class=\"button button-primary\" value=\"" . __('Submit!', 'yet-another-stars-rating') . " \" />";
|
592 |
|
593 |
+
$yasr_cookiename = 'yasr_multi_visitor_cookie';
|
594 |
|
595 |
+
if (isset($_COOKIE[$yasr_cookiename])) {
|
|
|
|
|
596 |
|
597 |
+
$cookie_data = stripslashes($_COOKIE[$yasr_cookiename]);
|
598 |
+
|
599 |
+
$cookie_data = unserialize($cookie_data);
|
600 |
+
|
601 |
+
foreach ($cookie_data as $value) {
|
602 |
+
|
603 |
+
$cookie_post_id = (int)$value['post_id'];
|
604 |
+
$cookie_set_id = (int)$value['set_id'];
|
605 |
+
|
606 |
+
if ($cookie_post_id === $post_id && $cookie_set_id == $setid) {
|
607 |
+
|
608 |
+
$button = "";
|
609 |
+
$star_readonly = 'true';
|
610 |
+
$span_message_content = __('Thank you for voting! ', 'yet-another-stars-rating');
|
611 |
+
|
612 |
+
//Stop doing foreach, here we've found the rating for current post
|
613 |
+
break;
|
614 |
+
|
615 |
+
}
|
616 |
+
|
617 |
+
else {
|
618 |
+
|
619 |
+
$button = $button_html;
|
620 |
+
$star_readonly = 'false';
|
621 |
+
$span_message_content = "";
|
622 |
+
|
623 |
+
}
|
624 |
+
|
625 |
+
}
|
626 |
+
|
627 |
+
|
628 |
+
}
|
629 |
|
630 |
else {
|
631 |
|
658 |
$star_readonly = 'false';
|
659 |
$span_message_content = "";
|
660 |
|
661 |
+
}
|
662 |
|
663 |
}
|
664 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: ratings, rating, postrating, google rating, 5 star, review, reviews, star
|
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.0
|
7 |
-
Stable tag: 1.6.
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
@@ -107,6 +107,10 @@ Of course not: you can easily add it on the visual editor just by clicking the "
|
|
107 |
|
108 |
The full changelog can be found in the plugin's directory. Recent entries:
|
109 |
|
|
|
|
|
|
|
|
|
110 |
= 1.6.1 =
|
111 |
* To accomplish GDPR european law, now the IP is not stored by default
|
112 |
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.0
|
7 |
+
Stable tag: 1.6.2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
107 |
|
108 |
The full changelog can be found in the plugin's directory. Recent entries:
|
109 |
|
110 |
+
= 1.6.2 =
|
111 |
+
* Removed showing ip from widget in the user dashboard
|
112 |
+
* Better cookie managment
|
113 |
+
|
114 |
= 1.6.1 =
|
115 |
* To accomplish GDPR european law, now the IP is not stored by default
|
116 |
|
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: Yet Another Stars Rating turn your WordPress into a complete review website.
|
7 |
-
* Version: 1.6.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -74,7 +74,7 @@ function yasr_fs()
|
|
74 |
yasr_fs();
|
75 |
// Signal that SDK was initiated.
|
76 |
do_action( 'yasr_fs_loaded' );
|
77 |
-
define( 'YASR_VERSION_NUM', '1.6.
|
78 |
//Plugin relative path
|
79 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
80 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
|
7 |
+
* Version: 1.6.2
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
74 |
yasr_fs();
|
75 |
// Signal that SDK was initiated.
|
76 |
do_action( 'yasr_fs_loaded' );
|
77 |
+
define( 'YASR_VERSION_NUM', '1.6.2' );
|
78 |
//Plugin relative path
|
79 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
80 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|