Yasr – Yet Another Stars Rating - Version 0.5.7

Version Description

  • Bug fixes in [yasr_most_or_highest_rated_posts] chart
Download this release

Release Info

Developer Dudo
Plugin Icon 128x128 Yasr – Yet Another Stars Rating
Version 0.5.7
Comparing to
See all releases

Code changes from version 0.5.6 to 0.5.7

css/yasr-table-dark.css CHANGED
@@ -24,111 +24,24 @@
24
  color: #ffffff;
25
  }
26
 
27
-
28
- .yasr-top-10-highest-rated {
29
- border-spacing: 1px;
30
- margin-top: 10px;
31
- margin-bottom: 24px;
32
- width: 100%;
33
- }
34
-
35
- .yasr-top-10-highest-rated td {
36
- padding: 8px;
37
- }
38
-
39
- .yasr-top-10-highest-rated tr:nth-child(odd) {
40
- background: #292929;
41
- }
42
- /* Define the background color for all the EVEN background rows */
43
- .yasr-top-10-highest-rated tr:nth-child(even) {
44
- background: #161616;
45
- }
46
-
47
- #loader-most-highest-chart {
48
- color: #ffffff;
49
- background-color: #161616;
50
- text-align: center;
51
- width: 100%;
52
- margin: 0 auto;
53
- }
54
-
55
- .yasr-most-or-highest-rated-posts {
56
- color: #ffffff;
57
- border-spacing: 1px;
58
- margin-top: 10px;
59
- margin-bottom: 24px;
60
- width: 100%;
61
- }
62
-
63
- .yasr-most-or-highest-rated-posts th {
64
- padding: 12px;
65
  color: white;
66
- }
67
-
68
- .yasr-most-or-highest-rated-posts td {
69
- padding: 8px;
70
- width: 50%;
71
- }
72
-
73
- .yasr-most-or-highest-rated-posts tr:nth-child(odd) {
74
- background: #292929;
75
- }
76
- /* Define the background color for all the EVEN background rows */
77
- .yasr-most-or-highest-rated-posts tr:nth-child(even) {
78
- background: #161616;
79
- }
80
-
81
-
82
- .yasr-top-5-active-reviewer {
83
- color: #ffffff;
84
  border-spacing: 1px;
85
  margin-top: 10px;
86
  margin-bottom: 24px;
87
  width: 100%;
88
  }
89
 
90
- .yasr-top-5-active-reviewer th {
91
- padding: 12px;
92
- color: white;
93
- }
94
-
95
- .yasr-top-5-active-reviewer td {
96
  padding: 8px;
97
  width: 50%;
98
  }
99
 
100
- .yasr-top-5-active-reviewer tr:nth-child(odd) {
101
  background: #292929;
102
  }
103
  /* Define the background color for all the EVEN background rows */
104
- .yasr-top-5-active-reviewer tr:nth-child(even) {
105
  background: #161616;
106
  }
107
-
108
-
109
-
110
- .yasr-top-10-active-users {
111
- border-spacing: 1px;
112
- margin-top: 10px;
113
- margin-bottom: 24px;
114
- width: 100%;
115
- }
116
-
117
- .yasr-top-10-active-users th {
118
- padding: 12px;
119
- color: white;
120
- }
121
-
122
- .yasr-top-10-active-users td {
123
- padding: 8px;
124
- color: white;
125
- width: 50%;
126
- }
127
-
128
- .yasr-top-10-active-users tr:nth-child(odd) {
129
- background: #292929;
130
- }
131
- /* Define the background color for all the EVEN background rows */
132
- .yasr-top-10-active-users tr:nth-child(even) {
133
- background: #161616;
134
- }
24
  color: #ffffff;
25
  }
26
 
27
+ /*** Chart ***/
28
+ .yasr-table-chart {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  color: white;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  border-spacing: 1px;
31
  margin-top: 10px;
32
  margin-bottom: 24px;
33
  width: 100%;
34
  }
35
 
36
+ .yasr-table-chart td {
 
 
 
 
 
37
  padding: 8px;
38
  width: 50%;
39
  }
40
 
41
+ .yasr-table-chart tr:nth-child(odd) {
42
  background: #292929;
43
  }
44
  /* Define the background color for all the EVEN background rows */
45
+ .yasr-table-chart tr:nth-child(even) {
46
  background: #161616;
47
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/yasr-table-light.css CHANGED
@@ -24,110 +24,23 @@
24
  color: #555;
25
  }
26
 
27
-
28
- .yasr-top-10-highest-rated {
29
  border-spacing: 1px;
30
  margin-top: 10px;
31
  margin-bottom: 24px;
32
  width: 100%;
33
  }
34
 
35
- .yasr-top-10-highest-rated td {
36
- padding: 8px;
37
- }
38
-
39
- .yasr-top-10-highest-rated tr:nth-child(odd) {
40
- background: #FFFFec;
41
- }
42
- /* Define the background color for all the EVEN background rows */
43
- .yasr-top-10-highest-rated tr:nth-child(even) {
44
- background: #FFFFFF;
45
- }
46
-
47
-
48
- #loader-most-highest-chart {
49
- background-color: #FFFFec;
50
- text-align: center;
51
- width: 100%;
52
- margin: 0 auto;
53
- }
54
-
55
- .yasr-most-or-highest-rated-posts {
56
- border-spacing: 1px;
57
- margin-top: 10px;
58
- margin-bottom: 24px;
59
- width: 100%;
60
- }
61
-
62
- .yasr-most-or-highest-rated-posts th {
63
- padding: 12px;
64
- color: #555;
65
- }
66
-
67
- .yasr-most-or-highest-rated-posts td {
68
  padding: 8px;
69
  width: 50%;
70
- color: #555;
71
  }
72
 
73
- .yasr-most-or-highest-rated-posts tr:nth-child(odd) {
74
  background: #FFFFec;
75
  }
76
  /* Define the background color for all the EVEN background rows */
77
- .yasr-most-or-highest-rated-posts tr:nth-child(even) {
78
  background: #FFFFFF;
79
  }
80
-
81
-
82
- .yasr-top-5-active-reviewer {
83
- border-spacing: 1px;
84
- margin-top: 10px;
85
- margin-bottom: 24px;
86
- width: 100%;
87
- }
88
-
89
- .yasr-top-5-active-reviewer th {
90
- padding: 12px;
91
- color: #555;
92
- }
93
-
94
- .yasr-top-5-active-reviewer td {
95
- padding: 8px;
96
- width: 50%;
97
- }
98
-
99
- .yasr-top-5-active-reviewer tr:nth-child(odd) {
100
- background: #FFFFec;
101
- }
102
- /* Define the background color for all the EVEN background rows */
103
- .yasr-top-5-active-reviewer tr:nth-child(even) {
104
- background: #FFFFFF;
105
- }
106
-
107
-
108
-
109
-
110
- .yasr-top-10-active-users {
111
- border-spacing: 1px;
112
- margin-top: 10px;
113
- margin-bottom: 24px;
114
- width: 100%;
115
- }
116
-
117
- .yasr-top-10-active-users th {
118
- padding: 12px;
119
- color: #555;
120
- }
121
-
122
- .yasr-top-10-active-users td {
123
- padding: 8px;
124
- width: 50%;
125
- }
126
-
127
- .yasr-top-10-active-users tr:nth-child(odd) {
128
- background: #FFFFec;
129
- }
130
- /* Define the background color for all the EVEN background rows */
131
- .yasr-top-10-active-users tr:nth-child(even) {
132
- background: #FFFFFF;
133
- }
24
  color: #555;
25
  }
26
 
27
+ /*** Charts ***/
28
+ .yasr-table-chart {
29
  border-spacing: 1px;
30
  margin-top: 10px;
31
  margin-bottom: 24px;
32
  width: 100%;
33
  }
34
 
35
+ .yasr-table-chart td {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  padding: 8px;
37
  width: 50%;
 
38
  }
39
 
40
+ .yasr-table-chart tr:nth-child(odd) {
41
  background: #FFFFec;
42
  }
43
  /* Define the background color for all the EVEN background rows */
44
+ .yasr-table-chart tr:nth-child(even) {
45
  background: #FFFFFF;
46
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/yasr-front.js CHANGED
@@ -145,25 +145,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
145
 
146
  });
147
 
148
- var data = {
149
- action : 'yasr_multi_chart_most_highest' //declared in yasr-ajax-functions
150
- };
151
-
152
-
153
- jQuery.post(ajaxurl, data, function(response) {
154
-
155
- jQuery('.yasr-most-or-highest-rated-posts').html(response);
156
- jQuery('.rateit').rateit();
157
-
158
  //By default, hide the highest rated chart
159
- jQuery('.yasr-highest-rated-posts').hide();
160
 
161
  //On click on highest, hide most and show highest
162
  jQuery('#yasr_multi_chart_highest').on("click", function () {
163
 
164
- jQuery('.yasr-most-rated-posts').hide();
165
 
166
- jQuery('.yasr-highest-rated-posts').show();
167
 
168
  return false; // prevent default click action from happening!
169
 
@@ -172,16 +162,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
172
  //Vice versa
173
  jQuery('#yasr_multi_chart_most').on("click", function () {
174
 
175
- jQuery('.yasr-highest-rated-posts').hide();
176
 
177
- jQuery('.yasr-most-rated-posts').show();
178
 
179
  return false; // prevent default click action from happening!
180
 
181
  });
182
 
183
- });
184
-
185
  }
186
 
187
 
145
 
146
  });
147
 
 
 
 
 
 
 
 
 
 
 
148
  //By default, hide the highest rated chart
149
+ jQuery('#yasr-highest-rated-posts').hide();
150
 
151
  //On click on highest, hide most and show highest
152
  jQuery('#yasr_multi_chart_highest').on("click", function () {
153
 
154
+ jQuery('#yasr-most-rated-posts').hide();
155
 
156
+ jQuery('#yasr-highest-rated-posts').show();
157
 
158
  return false; // prevent default click action from happening!
159
 
162
  //Vice versa
163
  jQuery('#yasr_multi_chart_most').on("click", function () {
164
 
165
+ jQuery('#yasr-highest-rated-posts').hide();
166
 
167
+ jQuery('#yasr-most-rated-posts').show();
168
 
169
  return false; // prevent default click action from happening!
170
 
171
  });
172
 
 
 
173
  }
174
 
175
 
lib/yasr-ajax-functions.php CHANGED
@@ -100,7 +100,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
100
  /****** Get Set name from post or page and output the set,
101
  used in yasr-metabox-multiple-rating******/
102
 
103
- add_action( 'wp_ajax_yasr_send_id_nameset', 'yasr_output_multiple_set_callback' );
104
 
105
  function yasr_output_multiple_set_callback() {
106
  if(isset($_POST['set_id']) && isset($_POST['post_id'])) {
@@ -235,7 +235,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
235
 
236
  /****** Get multiple value and insert into database, used in yasr-metabox-multiple-rating ******/
237
 
238
- add_action( 'wp_ajax_yasr_send_id_field_with_vote', 'yasr_get_multiple_votes_callback' );
239
 
240
  function yasr_get_multiple_votes_callback() {
241
 
100
  /****** Get Set name from post or page and output the set,
101
  used in yasr-metabox-multiple-rating******/
102
 
103
+ add_action( 'wp_ajax_yasr_send_id_nameset', 'yasr_output_multiple_set_callback' );
104
 
105
  function yasr_output_multiple_set_callback() {
106
  if(isset($_POST['set_id']) && isset($_POST['post_id'])) {
235
 
236
  /****** Get multiple value and insert into database, used in yasr-metabox-multiple-rating ******/
237
 
238
+ add_action( 'wp_ajax_yasr_send_id_field_with_vote', 'yasr_get_multiple_votes_callback' );
239
 
240
  function yasr_get_multiple_votes_callback() {
241
 
lib/yasr-shortcode-functions.php CHANGED
@@ -1,23 +1,5 @@
1
  <?php
2
 
3
- /*
4
-
5
- Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
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
9
- the Free Software Foundation, either version 2 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see <http://www.gnu.org/licenses/>
19
- */
20
-
21
  if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
22
 
23
  /****** Add shortcode for overall rating ******/
@@ -66,6 +48,7 @@ function shortcode_overall_rating_callback ($atts) {
66
  break;
67
  }
68
 
 
69
  if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
70
 
71
  $shortcode_html .= "</div>";
@@ -132,6 +115,8 @@ function shortcode_visitor_votes_callback ($atts) {
132
  //To avoid double visualization, I will insert this only if auto insert is off or if auto insert is set on overall rating.
133
  //If auto insert is on visitor rating this shortcode must return nothing
134
 
 
 
135
  $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
136
 
137
  if( is_singular() && is_main_query() ) {
@@ -191,7 +176,6 @@ function shortcode_visitor_votes_callback ($atts) {
191
  $px_size = '32';
192
  }
193
 
194
-
195
  //if anonymous are allowed to vote
196
  if (YASR_ALLOWED_USER === 'allow_anonymous') {
197
 
@@ -287,7 +271,7 @@ function shortcode_visitor_votes_callback ($atts) {
287
 
288
  } //End if user is logged in
289
 
290
- //Else mean user is not logged in
291
  else {
292
 
293
  $vote_if_user_already_rated = 0;
@@ -308,6 +292,7 @@ function shortcode_visitor_votes_callback ($atts) {
308
 
309
  }
310
 
 
311
  if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_VISITOR_RATING != '') {
312
 
313
  $shortcode_html_tmp = "<div class=\"yasr-container-custom-text-and-visitor-rating\">
@@ -347,6 +332,7 @@ function shortcode_visitor_votes_callback ($atts) {
347
 
348
  } //End if is singular
349
 
 
350
 
351
  } //End function shortcode_visitor_votes_callback
352
 
@@ -418,7 +404,7 @@ function yasr_top_ten_highest_rated_callback () {
418
 
419
  if ($query_result) {
420
 
421
- $shortcode_html = "<table class=\"yasr-top-10-highest-rated\">";
422
 
423
  foreach ($query_result as $result) {
424
 
@@ -477,7 +463,7 @@ function yasr_most_or_highest_rated_posts_callback () {
477
 
478
  if ($query_result_most_rated) {
479
 
480
- $shortcode_html .= "<table class=\"yasr-most-rated-posts\">
481
  <tr>
482
  <th>Post / Page</th>
483
  <th>Order By:&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_link_to_nothing\">Most Rated</a> | <a href=\"#\" id=\"yasr_multi_chart_highest\">Highest Rated</a></th>
@@ -515,7 +501,7 @@ function yasr_most_or_highest_rated_posts_callback () {
515
 
516
  if ($query_result_highest) {
517
 
518
- $shortcode_html .= "<table class=\"yasr-highest-rated-posts\">
519
  <tr>
520
  <th>Post / Page</th>
521
  <th>Order By:&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_most\">Most Rated</a> | <a href=\"#\" id=\"yasr_multi_chart_link_to_nothing\">Highest Rated</a></th>
@@ -588,7 +574,7 @@ function yasr_top_5_reviewers_callback () {
588
  if ($query_result) {
589
 
590
  $shortcode_html = "
591
- <table class=\"yasr-top-5-active-reviewer\">
592
  <tr>
593
  <th>Author</th>
594
  <th>Reviews</th>
@@ -659,7 +645,7 @@ function yasr_top_ten_active_users_callback () {
659
  if ($query_result) {
660
 
661
  $shortcode_html = "
662
- <table class=\"yasr-top-10-active-users\">
663
  <tr>
664
  <th>UserName</th>
665
  <th>Number of votes</th>
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
4
 
5
  /****** Add shortcode for overall rating ******/
48
  break;
49
  }
50
 
51
+
52
  if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
53
 
54
  $shortcode_html .= "</div>";
115
  //To avoid double visualization, I will insert this only if auto insert is off or if auto insert is set on overall rating.
116
  //If auto insert is on visitor rating this shortcode must return nothing
117
 
118
+ //if (YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'overall_rating' )) {
119
+
120
  $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
121
 
122
  if( is_singular() && is_main_query() ) {
176
  $px_size = '32';
177
  }
178
 
 
179
  //if anonymous are allowed to vote
180
  if (YASR_ALLOWED_USER === 'allow_anonymous') {
181
 
271
 
272
  } //End if user is logged in
273
 
274
+ //Else mean user is not logged in
275
  else {
276
 
277
  $vote_if_user_already_rated = 0;
292
 
293
  }
294
 
295
+
296
  if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_VISITOR_RATING != '') {
297
 
298
  $shortcode_html_tmp = "<div class=\"yasr-container-custom-text-and-visitor-rating\">
332
 
333
  } //End if is singular
334
 
335
+ //} //End if auto_insert_enabled
336
 
337
  } //End function shortcode_visitor_votes_callback
338
 
404
 
405
  if ($query_result) {
406
 
407
+ $shortcode_html = "<table class=\"yasr-table-chart\">";
408
 
409
  foreach ($query_result as $result) {
410
 
463
 
464
  if ($query_result_most_rated) {
465
 
466
+ $shortcode_html .= "<table class=\"yasr-table-chart\" id=\"yasr-most-rated-posts\">
467
  <tr>
468
  <th>Post / Page</th>
469
  <th>Order By:&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_link_to_nothing\">Most Rated</a> | <a href=\"#\" id=\"yasr_multi_chart_highest\">Highest Rated</a></th>
501
 
502
  if ($query_result_highest) {
503
 
504
+ $shortcode_html .= "<table class=\"yasr-table-chart\" id=\"yasr-highest-rated-posts\">
505
  <tr>
506
  <th>Post / Page</th>
507
  <th>Order By:&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_most\">Most Rated</a> | <a href=\"#\" id=\"yasr_multi_chart_link_to_nothing\">Highest Rated</a></th>
574
  if ($query_result) {
575
 
576
  $shortcode_html = "
577
+ <table class=\"yasr-table-chart\">
578
  <tr>
579
  <th>Author</th>
580
  <th>Reviews</th>
645
  if ($query_result) {
646
 
647
  $shortcode_html = "
648
+ <table class=\"yasr-table-chart\">
649
  <tr>
650
  <th>UserName</th>
651
  <th>Number of votes</th>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
3
  Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post rating, posts, rate, rating, rating platform, rating system, ratings, review, reviews, rich snippets, seo, star, star rating, stars, vote, Votes, voting, voting contest, schema, serp
4
  Requires at least: 3.5
5
  Tested up to: 4.0
6
- Stable tag: 0.5.6
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -84,6 +84,9 @@ Of course not: you can easily add it on the visual editor just by clicking on th
84
 
85
  == Changelog ==
86
 
 
 
 
87
  = 0.5.6 =
88
  * Code cleanup and speed improvement on the [yasr_most_or_highest_rated_posts] chart
89
  * Bug fixes in setting page
3
  Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post rating, posts, rate, rating, rating platform, rating system, ratings, review, reviews, rich snippets, seo, star, star rating, stars, vote, Votes, voting, voting contest, schema, serp
4
  Requires at least: 3.5
5
  Tested up to: 4.0
6
+ Stable tag: 0.5.7
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
84
 
85
  == Changelog ==
86
 
87
+ = 0.5.7 =
88
+ * Bug fixes in [yasr_most_or_highest_rated_posts] chart
89
+
90
  = 0.5.6 =
91
  * Code cleanup and speed improvement on the [yasr_most_or_highest_rated_posts] chart
92
  * Bug fixes in setting page
yet-another-stars-rating.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Yet Another Stars Rating
4
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
  * Description: Rating system with rich snippets
6
- * Version: 0.5.6
7
  * Author: Dario Curvino
8
  * Author URI: http://profiles.wordpress.org/dudo/
9
  * License: GPL2
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
28
  */
29
 
30
 
31
- define('YASR_VERSION_NUM', '0.5.6');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
3
  * Plugin Name: Yet Another Stars Rating
4
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
  * Description: Rating system with rich snippets
6
+ * Version: 0.5.7
7
  * Author: Dario Curvino
8
  * Author URI: http://profiles.wordpress.org/dudo/
9
  * License: GPL2
28
  */
29
 
30
 
31
+ define('YASR_VERSION_NUM', '0.5.7');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );