Yasr – Yet Another Stars Rating - Version 0.3.2

Version Description

  • Forced multiset field name to be #555 . This is to avoid reading problem when using light font color
Download this release

Release Info

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

Code changes from version 0.3.1 to 0.3.2

css/yasr.css CHANGED
@@ -182,6 +182,19 @@ h2.nav-tab-wrapper, h3.nav-tab-wrapper {
182
  background: #FFFFFF;
183
  }
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  .yasr_table_multi_set_admin {
186
  border: 1px solid rgba(0, 0, 0, 0.1);
187
  padding: 10px;
@@ -213,6 +226,7 @@ h2.nav-tab-wrapper, h3.nav-tab-wrapper {
213
  background: #FFFFFF;
214
  }
215
 
 
216
  #yasr-log-container {
217
  width: 98%;
218
  }
182
  background: #FFFFFF;
183
  }
184
 
185
+ .yasr-multi-set-name-field {
186
+ color: #555;
187
+ }
188
+
189
+ .yasr-top-10-highest-rated tr:nth-child(odd) {
190
+ background: #FFFFec;
191
+ }
192
+ /* Define the background color for all the EVEN background rows */
193
+ .yasr-top-10-highest-rated tr:nth-child(even) {
194
+ background: #FFFFFF;
195
+ }
196
+
197
+
198
  .yasr_table_multi_set_admin {
199
  border: 1px solid rgba(0, 0, 0, 0.1);
200
  padding: 10px;
226
  background: #FFFFFF;
227
  }
228
 
229
+
230
  #yasr-log-container {
231
  width: 98%;
232
  }
lib/yasr-shortcode-functions.php CHANGED
@@ -7,14 +7,15 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
7
  add_shortcode ('yasr_overall_rating', 'shortcode_overall_rating_callback');
8
 
9
  function shortcode_overall_rating_callback () {
10
- $overall_rating=yasr_get_overall_rating();
 
11
 
12
  if (!$overall_rating) {
13
- $overall_rating = "-1";
14
  }
15
 
16
- $shortcode_html="<div class=\"rateit bigstars\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
17
- </div>";
18
 
19
  return $shortcode_html;
20
 
@@ -26,178 +27,172 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
26
 
27
  function shortcode_visitor_votes_callback () {
28
 
29
- $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
30
 
31
- if( is_singular() && is_main_query() ) {
32
 
33
- $ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
34
 
35
  $votes=yasr_get_visitor_votes();
36
 
37
- $medium_rating=0; //Avoid undefined variable
38
 
39
  if (!$votes) {
40
  $votes=0; //Avoid undefined variable if there is not overall rating
41
  $votes_number=0; //Avoid undefined variable
42
  }
43
 
44
- else {
45
- foreach ($votes as $user_votes) {
46
- $votes_number = $user_votes->number_of_votes;
47
  if ($votes_number !=0 ) {
48
- $medium_rating = ($user_votes->sum_votes/$votes_number);
49
  }
50
  }
51
- }
52
-
53
- $allow_logged_option = get_option( 'yasr_general_options' );
54
-
55
- if (!$allow_logged_option) {
56
- $allow_logged_option = array();
57
- $allow_logged_option['allowed_user']='allow_anonymous';
58
- }
59
 
60
- $image = YASR_IMG_DIR . "/loader.gif";
61
 
62
- $loader_html = "<div id=\"loader-visitor-rating\" >&nbsp; " . __("Loading, please wait","yasr") . " <img src= \" $image \"></div>";
 
 
 
63
 
64
- $medium_rating=round($medium_rating, 1);
65
 
66
- $ready_only_stars_for_logged_users_showed = 0;
67
 
68
- //if anonymous are allowed to vote
69
- if ($allow_logged_option['allowed_user']==='allow_anonymous') {
70
 
71
- //I've to block a logged in user that has already rated
72
- if ( is_user_logged_in() ) {
73
 
74
- //Chek if a logged in user has already rated for this post
75
- $vote_if_user_already_rated = yasr_check_if_user_already_voted();
76
 
77
- //If user has already rated show readonly stars
78
- if ($vote_if_user_already_rated) {
79
 
80
- global $current_user;
81
- get_currentuserinfo();
82
 
83
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
84
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
85
 
86
- $ready_only_stars_for_logged_users_showed = 1;
 
87
 
88
- }
89
 
90
- //else logged user can vote
91
- else {
92
 
93
- $vote_if_user_already_rated = 0;
94
 
95
- if ($votes_number>0) {
96
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
97
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
98
- }
99
 
100
- else {
101
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
102
- </div><br /> " . __("No rating yet" , "yasr") . "</div>";
103
- }
104
 
105
- } //End else
106
 
107
- } //End if user is logged
108
 
109
 
110
- //else is not logged can vote
111
- else {
112
 
113
- if ($votes_number>0) {
114
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
115
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
116
- }
117
 
118
- else {
119
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
120
- </div><br /> " . __("No rating yet" , "yasr") . "</div>";
121
- }
122
 
123
- } //end else
124
 
125
- } //end if ($allow_logged_option['allowed_user']==='allow_anonymous') {
126
-
127
 
128
 
129
- //If only logged in users can vote
130
- elseif ($allow_logged_option['allowed_user']==='logged_only') {
131
 
132
- //If user is logged in and can vote
133
- if ( is_user_logged_in() ) {
134
 
135
- //Chek if a logged in user has already rated for this post
136
- $vote_if_user_already_rated = yasr_check_if_user_already_voted();
137
 
138
- if ($vote_if_user_already_rated) {
 
139
 
140
- global $current_user;
141
- get_currentuserinfo();
142
 
143
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
144
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
145
 
146
- $ready_only_stars_for_logged_users_showed = 1;
 
147
 
148
- }
149
 
150
- else {
151
 
152
- if ($votes_number>0) {
153
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
154
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
155
- }
156
 
157
- else {
158
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
159
- </div><br /> " . __("No rating yet" , "yasr") . "</div>";
160
- }
161
 
162
- }
163
 
164
 
165
- } //End if user is logged in
166
 
167
  //Else mean user is not logged in
168
- else {
169
 
170
 
171
- if ($votes_number>0) {
172
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
173
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br />" . __("You must sign to vote", "yasr") . "</div>";
174
- }
175
 
176
- else {
177
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
178
- </div><br /> " . __("No rating yet" , "yasr") . "<br />" . _e("You must sign to vote", "") . "</div>";
179
- }
180
 
181
- }
182
 
183
- }
184
 
185
 
186
  ?>
187
 
188
  <script>
189
- jQuery(document).ready(function() {
190
 
191
- <?php
192
-
193
- echo "var read_only_stars_showed = $ready_only_stars_for_logged_users_showed;";
194
 
195
- ?>
196
 
197
- if (read_only_stars_showed != 1) {
198
- read_only_stars_showed = 0;
199
  }
200
 
 
 
201
  var tooltipvalues = ['bad', 'poor', 'ok', 'good', 'super'];
202
  jQuery("#yasr_rateit_visitor_votes").bind('over', function (event, value) { jQuery(this).attr('title', tooltipvalues[value-1]); });
203
 
@@ -236,7 +231,7 @@ function shortcode_visitor_votes_callback () {
236
  else {
237
 
238
  //if php read only stars are not be showes echo readonly stars from cookie
239
- if (read_only_stars_showed == 0) {
240
 
241
  var cookievote=jQuery.cookie(cookiename);
242
  var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
@@ -293,7 +288,7 @@ function shortcode_multi_set_callback( $atts ) {
293
  if ($set_name_content) {
294
  $shortcode_html="<table class=\"yasr_table_multi_set_shortcode\">";
295
  foreach ($set_name_content as $set_content) {
296
- $shortcode_html .= "<tr> <td>$set_content->name </td>
297
  <td><div class=\"rateit\" id=\"$set_content->id\" data-rateit-value=\"$set_content->vote\" data-rateit-step=\"0.5\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td>
298
  </tr>";
299
  }
@@ -306,7 +301,9 @@ function shortcode_multi_set_callback( $atts ) {
306
  FROM " . YASR_MULTI_SET_FIELDS_TABLE . "
307
  WHERE parent_set_id=$setid
308
  ORDER BY field_id ASC");
 
309
  $shortcode_html="<table>";
 
310
  foreach ($set_name as $set_content) {
311
  $shortcode_html .= "<tr> <td>$set_content->name </td>
312
  <td><div class=\"rateit\" id=\"$set_content->id\" data-rateit-value=\"0\" data-rateit-step=\"0.5\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td>
@@ -317,4 +314,48 @@ function shortcode_multi_set_callback( $atts ) {
317
  }
318
  return $shortcode_html;
319
  } //End function
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  ?>
7
  add_shortcode ('yasr_overall_rating', 'shortcode_overall_rating_callback');
8
 
9
  function shortcode_overall_rating_callback () {
10
+
11
+ $overall_rating=yasr_get_overall_rating();
12
 
13
  if (!$overall_rating) {
14
+ $overall_rating = "-1";
15
  }
16
 
17
+ $shortcode_html="<div class=\"rateit bigstars\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
18
+ </div>";
19
 
20
  return $shortcode_html;
21
 
27
 
28
  function shortcode_visitor_votes_callback () {
29
 
30
+ $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
31
 
32
+ if( is_singular() && is_main_query() ) {
33
 
34
+ $ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
35
 
36
  $votes=yasr_get_visitor_votes();
37
 
38
+ $medium_rating=0; //Avoid undefined variable
39
 
40
  if (!$votes) {
41
  $votes=0; //Avoid undefined variable if there is not overall rating
42
  $votes_number=0; //Avoid undefined variable
43
  }
44
 
45
+ else {
46
+ foreach ($votes as $user_votes) {
47
+ $votes_number = $user_votes->number_of_votes;
48
  if ($votes_number !=0 ) {
49
+ $medium_rating = ($user_votes->sum_votes/$votes_number);
50
  }
51
  }
52
+ }
 
 
 
 
 
 
 
53
 
54
+ $allow_logged_option = get_option( 'yasr_general_options' );
55
 
56
+ if (!$allow_logged_option) {
57
+ $allow_logged_option = array();
58
+ $allow_logged_option['allowed_user']='allow_anonymous';
59
+ }
60
 
61
+ $image = YASR_IMG_DIR . "/loader.gif";
62
 
63
+ $loader_html = "<div id=\"loader-visitor-rating\" >&nbsp; " . __("Loading, please wait","yasr") . " <img src= \" $image \"></div>";
64
 
65
+ $medium_rating=round($medium_rating, 1);
 
66
 
67
+ //if anonymous are allowed to vote
68
+ if ($allow_logged_option['allowed_user']==='allow_anonymous') {
69
 
70
+ //I've to block a logged in user that has already rated
71
+ if ( is_user_logged_in() ) {
72
 
73
+ //Chek if a logged in user has already rated for this post
74
+ $vote_if_user_already_rated = yasr_check_if_user_already_voted();
75
 
76
+ //If user has already rated show readonly stars
77
+ if ($vote_if_user_already_rated) {
78
 
79
+ global $current_user;
80
+ get_currentuserinfo();
81
 
82
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes_logged_rated\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
83
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
84
 
85
+ }
86
 
87
+ //else logged user can vote
88
+ else {
89
 
90
+ $vote_if_user_already_rated = 0;
91
 
92
+ if ($votes_number>0) {
93
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
94
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
95
+ }
96
 
97
+ else {
98
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
99
+ </div><br /> " . __("No rating yet" , "yasr") . "</div>";
100
+ }
101
 
102
+ } //End else
103
 
104
+ } //End if user is logged
105
 
106
 
107
+ //else is not logged can vote
108
+ else {
109
 
110
+ if ($votes_number>0) {
111
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
112
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
113
+ }
114
 
115
+ else {
116
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
117
+ </div><br /> " . __("No rating yet" , "yasr") . "</div>";
118
+ }
119
 
120
+ } //end else
121
 
122
+ } //end if ($allow_logged_option['allowed_user']==='allow_anonymous') {
 
123
 
124
 
 
 
125
 
126
+ //If only logged in users can vote
127
+ elseif ($allow_logged_option['allowed_user']==='logged_only') {
128
 
129
+ //If user is logged in and can vote
130
+ if ( is_user_logged_in() ) {
131
 
132
+ //Chek if a logged in user has already rated for this post
133
+ $vote_if_user_already_rated = yasr_check_if_user_already_voted();
134
 
135
+ if ($vote_if_user_already_rated) {
 
136
 
137
+ global $current_user;
138
+ get_currentuserinfo();
139
 
140
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes_logged_rated\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
141
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
142
 
143
+ }
144
 
145
+ else {
146
 
147
+ if ($votes_number>0) {
148
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
149
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
150
+ }
151
 
152
+ else {
153
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
154
+ </div><br /> " . __("No rating yet" , "yasr") . "</div>";
155
+ }
156
 
157
+ }
158
 
159
 
160
+ } //End if user is logged in
161
 
162
  //Else mean user is not logged in
163
+ else {
164
 
165
 
166
+ if ($votes_number>0) {
167
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
168
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br />" . __("You must sign to vote", "yasr") . "</div>";
169
+ }
170
 
171
+ else {
172
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
173
+ </div><br /> " . __("No rating yet" , "yasr") . "<br />" . _e("You must sign to vote", "") . "</div>";
174
+ }
175
 
176
+ }
177
 
178
+ }
179
 
180
 
181
  ?>
182
 
183
  <script>
184
+ jQuery(document).ready(function() {
185
 
186
+ var logged_message_showed = false;
 
 
187
 
188
+ logged_message_showed = jQuery("#yasr_rateit_visitor_votes_logged_rated").attr("data-rateit-value");
189
 
190
+ if (logged_message_showed) {
191
+ logged_message_showed = true;
192
  }
193
 
194
+
195
+
196
  var tooltipvalues = ['bad', 'poor', 'ok', 'good', 'super'];
197
  jQuery("#yasr_rateit_visitor_votes").bind('over', function (event, value) { jQuery(this).attr('title', tooltipvalues[value-1]); });
198
 
231
  else {
232
 
233
  //if php read only stars are not be showes echo readonly stars from cookie
234
+ if (!logged_message_showed) {
235
 
236
  var cookievote=jQuery.cookie(cookiename);
237
  var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
288
  if ($set_name_content) {
289
  $shortcode_html="<table class=\"yasr_table_multi_set_shortcode\">";
290
  foreach ($set_name_content as $set_content) {
291
+ $shortcode_html .= "<tr> <td><span class=\"yasr-multi-set-name-field\">$set_content->name </span></td>
292
  <td><div class=\"rateit\" id=\"$set_content->id\" data-rateit-value=\"$set_content->vote\" data-rateit-step=\"0.5\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td>
293
  </tr>";
294
  }
301
  FROM " . YASR_MULTI_SET_FIELDS_TABLE . "
302
  WHERE parent_set_id=$setid
303
  ORDER BY field_id ASC");
304
+
305
  $shortcode_html="<table>";
306
+
307
  foreach ($set_name as $set_content) {
308
  $shortcode_html .= "<tr> <td>$set_content->name </td>
309
  <td><div class=\"rateit\" id=\"$set_content->id\" data-rateit-value=\"0\" data-rateit-step=\"0.5\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td>
314
  }
315
  return $shortcode_html;
316
  } //End function
317
+
318
+
319
+
320
+ /****** Add top 10 highest rated post *****
321
+
322
+ add_shortcode ('yasr_10_ten_highest_rated', 'yasr_top_ten_highest_rated_callback');
323
+
324
+ function yasr_top_ten_highest_rated_callback () {
325
+
326
+ global $wpdb;
327
+
328
+ $query_result = $wpdb->get_results("SELECT overall_rating, post_id FROM " . YASR_VOTES_TABLE . " ORDER BY overall_rating DESC LIMIT 10");
329
+
330
+ if ($query_result) {
331
+
332
+ $shortcode_html = "<table class=\"yasr-top-10-highest-rated\">";
333
+
334
+ foreach ($query_result as $result) {
335
+
336
+ $post_title = get_the_title($result->post_id);
337
+
338
+ $link = get_permalink($result->post_id); //Get permalink from post it
339
+
340
+ $shortcode_html .= "<tr>
341
+ <td><a href=\"$link\">$post_title</a></td>
342
+ <td><div class=\"rateit\" data-rateit-value=\"$result->overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td>
343
+ </tr>";
344
+
345
+ } //End foreach
346
+
347
+ $shortcode_html .= "</table>";
348
+
349
+ return $shortcode_html;
350
+
351
+ } //end if $query_result
352
+
353
+ else {
354
+ _e("There was an error while getting result for yasr_10_ten_highest_rated shortcode. Please report it", "yasr");
355
+ }
356
+
357
+ } //End function
358
+
359
+ */
360
+
361
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
3
  Tags: Rating, Review, Star, Snippet, Rich snippet, Schema, Schema.org, Serp
4
  Requires at least: 3.5
5
  Tested up to: 3.9.1
6
- Stable tag: 0.3.1
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -48,6 +48,9 @@ If with gd-star-rating you're using a different number of stars from the default
48
 
49
  == Changelog ==
50
 
 
 
 
51
  = 0.3.1 =
52
  * Avoid multiple vote in a same post for logged in user
53
  * Bug fixes and cleanup
3
  Tags: Rating, Review, Star, Snippet, Rich snippet, Schema, Schema.org, Serp
4
  Requires at least: 3.5
5
  Tested up to: 3.9.1
6
+ Stable tag: 0.3.2
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
48
 
49
  == Changelog ==
50
 
51
+ = 0.3.2 =
52
+ * Forced multiset field name to be #555 . This is to avoid reading problem when using light font color
53
+
54
  = 0.3.1 =
55
  * Avoid multiple vote in a same post for logged in user
56
  * Bug fixes and cleanup
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.3.1
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.3.1');
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.3.2
7
  * Author: Dario Curvino
8
  * Author URI: http://profiles.wordpress.org/dudo/
9
  * License: GPL2
28
  */
29
 
30
 
31
+ define('YASR_VERSION_NUM', '0.3.2');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );