Yasr – Yet Another Stars Rating - Version 0.6.9

Version Description

  • Yasr Visitor Votes shortag is finally avaible in archive pages!
  • Code cleanup on yasr visitor votes shortag
  • Javascript loaded again at the bottom in the frontend. Theme that doesn't use wp_footer will no be supported anymore
Download this release

Release Info

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

Code changes from version 0.6.8 to 0.6.9

js/yasr-front.js CHANGED
@@ -1,8 +1,8 @@
1
  /****** Yasr shortcode page ******/
2
 
3
- function yasrVisitorsVotes (tooltipValues, postid, ajaxurl, size, loggedUser, voteIfUserAlredyRated, votes, votesNumber, loaderHtml, nonceVisitor) {
4
 
5
- jQuery("#yasr_rateit_visitor_votes").bind('over', function (event, value) { jQuery(this).attr('title', tooltipValues[value-1]); });
6
 
7
  var cookiename = "yasr_visitor_vote_" + postid;
8
 
@@ -28,7 +28,7 @@
28
  }
29
 
30
  jQuery.post(ajaxurl, data, function(response) {
31
- jQuery('#yasr_visitor_votes').html(response);
32
  jQuery('.rateit').rateit();
33
  });
34
 
@@ -36,7 +36,7 @@
36
 
37
  //If not logged and not cookie allowed to voted
38
  else {
39
- yasrDefaultRatingShortcode ();
40
  }
41
 
42
  } //End if (!loggeduser)
@@ -48,19 +48,19 @@
48
  //Check if has cookie or vote in db
49
  if (jQuery.cookie(cookiename) || voteIfUserAlredyRated != '') {
50
 
51
- jQuery('#yasr_rateit_visitor_votes').on('rated', function() {
52
 
53
  var el = jQuery(this);
54
  var value = el.rateit('value');
55
  var value = value.toFixed(1); //
56
 
57
  if (value < 1) {
58
- jQuery('#yasr_visitor_votes').html('You can\'t vote 0');
59
  }
60
 
61
  else {
62
 
63
- jQuery('#yasr_visitor_votes').html(loaderHtml);
64
 
65
  var data = {
66
  action: 'yasr_update_visitor_rating',
@@ -73,7 +73,7 @@
73
  //Send value to the Server
74
  jQuery.post(ajaxurl, data, function(response) {
75
  //response
76
- jQuery('#yasr_visitor_votes').html(response);
77
  jQuery('.rateit').rateit();
78
  //Create a cookie to disable double vote
79
  jQuery.cookie(cookiename, value, { expires : 360 });
@@ -87,28 +87,28 @@
87
 
88
  else if (!jQuery.cookie(cookiename) && voteIfUserAlredyRated == '') {
89
 
90
- yasrDefaultRatingShortcode ();
91
 
92
  }
93
 
94
  } //End else logged
95
 
96
- function yasrDefaultRatingShortcode () {
97
 
98
  //On click Insert visitor votes
99
- jQuery('#yasr_rateit_visitor_votes').on('rated', function() {
100
 
101
  var el = jQuery(this);
102
  var value = el.rateit('value');
103
  var value = value.toFixed(1); //
104
 
105
  if (value < 1) {
106
- jQuery('#yasr_visitor_votes').html('You can\'t vote 0');
107
  }
108
 
109
  else {
110
 
111
- jQuery('#yasr_visitor_votes').html(loaderHtml);
112
 
113
  var data = {
114
  action: 'yasr_send_visitor_rating',
@@ -121,7 +121,7 @@
121
  //Send value to the Server
122
  jQuery.post(ajaxurl, data, function(response) {
123
  //response
124
- jQuery('#yasr_visitor_votes').html(response);
125
  jQuery('.rateit').rateit();
126
  //Create a cookie to disable double vote
127
  jQuery.cookie(cookiename, value, { expires : 360 });
@@ -203,7 +203,7 @@
203
 
204
  var varTipsContent = null;
205
 
206
- jQuery('.yasr-total-average-text').tooltip({
207
 
208
  position: { my: 'center bottom' , at: 'center top-10' },
209
  tooltipClass: "yasr-visitors-stats-tooltip",
1
  /****** Yasr shortcode page ******/
2
 
3
+ function yasrVisitorsVotes (tooltipValues, postid, ajaxurl, size, loggedUser, voteIfUserAlredyRated, votes, votesNumber, loaderHtml, nonceVisitor) {
4
 
5
+ jQuery('#yasr_rateit_visitor_votes_' + postid).bind('over', function (event, value) { jQuery(this).attr('title', tooltipValues[value-1]); });
6
 
7
  var cookiename = "yasr_visitor_vote_" + postid;
8
 
28
  }
29
 
30
  jQuery.post(ajaxurl, data, function(response) {
31
+ jQuery('#yasr_visitor_votes_' + postid).html(response);
32
  jQuery('.rateit').rateit();
33
  });
34
 
36
 
37
  //If not logged and not cookie allowed to voted
38
  else {
39
+ yasrDefaultRatingShortcode (postid);
40
  }
41
 
42
  } //End if (!loggeduser)
48
  //Check if has cookie or vote in db
49
  if (jQuery.cookie(cookiename) || voteIfUserAlredyRated != '') {
50
 
51
+ jQuery('#yasr_rateit_visitor_votes_' + postid).on('rated', function() {
52
 
53
  var el = jQuery(this);
54
  var value = el.rateit('value');
55
  var value = value.toFixed(1); //
56
 
57
  if (value < 1) {
58
+ jQuery('#yasr_visitor_votes_' + postid).html('You can\'t vote 0');
59
  }
60
 
61
  else {
62
 
63
+ jQuery('#yasr_visitor_votes_' + postid).html(loaderHtml);
64
 
65
  var data = {
66
  action: 'yasr_update_visitor_rating',
73
  //Send value to the Server
74
  jQuery.post(ajaxurl, data, function(response) {
75
  //response
76
+ jQuery('#yasr_visitor_votes_' + postid).html(response);
77
  jQuery('.rateit').rateit();
78
  //Create a cookie to disable double vote
79
  jQuery.cookie(cookiename, value, { expires : 360 });
87
 
88
  else if (!jQuery.cookie(cookiename) && voteIfUserAlredyRated == '') {
89
 
90
+ yasrDefaultRatingShortcode (postid);
91
 
92
  }
93
 
94
  } //End else logged
95
 
96
+ function yasrDefaultRatingShortcode (postid) {
97
 
98
  //On click Insert visitor votes
99
+ jQuery('#yasr_rateit_visitor_votes_' + postid).on('rated', function() {
100
 
101
  var el = jQuery(this);
102
  var value = el.rateit('value');
103
  var value = value.toFixed(1); //
104
 
105
  if (value < 1) {
106
+ jQuery('#yasr_visitor_votes_' + postid).html('You can\'t vote 0');
107
  }
108
 
109
  else {
110
 
111
+ jQuery('#yasr_visitor_votes_' + postid).html(loaderHtml);
112
 
113
  var data = {
114
  action: 'yasr_send_visitor_rating',
121
  //Send value to the Server
122
  jQuery.post(ajaxurl, data, function(response) {
123
  //response
124
+ jQuery('#yasr_visitor_votes_' + postid).html(response);
125
  jQuery('.rateit').rateit();
126
  //Create a cookie to disable double vote
127
  jQuery.cookie(cookiename, value, { expires : 360 });
203
 
204
  var varTipsContent = null;
205
 
206
+ jQuery('#yasr-total-average-text_' + postid).tooltip({
207
 
208
  position: { my: 'center bottom' , at: 'center top-10' },
209
  tooltipClass: "yasr-visitors-stats-tooltip",
lib/yasr-ajax-functions.php CHANGED
@@ -1141,6 +1141,8 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
1141
  $rating = $_POST['rating'];
1142
  $post_id = $_POST['post_id'];
1143
  $size = $_POST['size'];
 
 
1144
  }
1145
  else {
1146
  exit();
@@ -1165,7 +1167,7 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
1165
  global $wpdb;
1166
 
1167
  //I've to pass post_id here cause get_the_id doesn't work if called with ajax
1168
- $array_votes=yasr_get_visitor_votes($post_id);
1169
 
1170
  foreach ($array_votes as $vote) {
1171
  $number_of_votes = $vote->number_of_votes;
@@ -1177,9 +1179,9 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
1177
  $number_of_votes = 1;
1178
  }
1179
 
1180
- $average_rating = $sum_votes/$number_of_votes;
1181
 
1182
- $average_rating = round ($average_rating, 1);
1183
 
1184
 
1185
  //Check if user specifyed a custom text to display when a vistor har rated
@@ -1187,7 +1189,7 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
1187
  if( YASR_TEXT_BEFORE_STARS == 1 && YASR_CUSTOM_TEXT_USER_VOTED != '' ) {
1188
 
1189
  echo "<div class=\"$rateit_class\" id=\"yasr_rateit_user_votes_voted_ro\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$average_rating\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
1190
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$number_of_votes &nbsp; &nbsp;" . __("Average " , "yasr") . "$average_rating/5 ]</span>
1191
  <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . YASR_CUSTOM_TEXT_USER_VOTED . " </span>";
1192
 
1193
  }
@@ -1195,7 +1197,7 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
1195
  else {
1196
 
1197
  echo "<div class=\"$rateit_class\" id=\"yasr_rateit_user_votes_voted_ro\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$average_rating\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
1198
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$number_of_votes &nbsp; &nbsp;" . __("Average " , "yasr") . "$average_rating/5 ]</span>
1199
  <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", "yasr") . " $rating </span>";
1200
 
1201
  }
1141
  $rating = $_POST['rating'];
1142
  $post_id = $_POST['post_id'];
1143
  $size = $_POST['size'];
1144
+ $average_rating = $_POST['votes'];
1145
+ $votes_number = $_POST['votes_number'];
1146
  }
1147
  else {
1148
  exit();
1167
  global $wpdb;
1168
 
1169
  //I've to pass post_id here cause get_the_id doesn't work if called with ajax
1170
+ /*$array_votes=yasr_get_visitor_votes($post_id);
1171
 
1172
  foreach ($array_votes as $vote) {
1173
  $number_of_votes = $vote->number_of_votes;
1179
  $number_of_votes = 1;
1180
  }
1181
 
1182
+ $average_rating = $vote/$votes_number;
1183
 
1184
+ $average_rating = round ($average_rating, 1);*/
1185
 
1186
 
1187
  //Check if user specifyed a custom text to display when a vistor har rated
1189
  if( YASR_TEXT_BEFORE_STARS == 1 && YASR_CUSTOM_TEXT_USER_VOTED != '' ) {
1190
 
1191
  echo "<div class=\"$rateit_class\" id=\"yasr_rateit_user_votes_voted_ro\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$average_rating\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
1192
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average " , "yasr") . "$average_rating/5 ]</span>
1193
  <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . YASR_CUSTOM_TEXT_USER_VOTED . " </span>";
1194
 
1195
  }
1197
  else {
1198
 
1199
  echo "<div class=\"$rateit_class\" id=\"yasr_rateit_user_votes_voted_ro\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$average_rating\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
1200
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average " , "yasr") . "$average_rating/5 ]</span>
1201
  <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", "yasr") . " $rating </span>";
1202
 
1203
  }
lib/yasr-db-functions.php CHANGED
@@ -104,6 +104,7 @@ function yasr_install() {
104
  $option['auto_insert_exclude_pages'] = 'yes';
105
  $option['auto_insert_custom_post_only'] = 'no';
106
  $option['show_overall_in_loop'] = 'disabled';
 
107
  $option['text_before_stars'] = 0;
108
  $option['snippet'] = 'overall_rating';
109
  $option['allowed_user'] = 'allow_anonymous';
104
  $option['auto_insert_exclude_pages'] = 'yes';
105
  $option['auto_insert_custom_post_only'] = 'no';
106
  $option['show_overall_in_loop'] = 'disabled';
107
+ $option['show_visitor_votes_in_loop'] = 'disabled';
108
  $option['text_before_stars'] = 0;
109
  $option['snippet'] = 'overall_rating';
110
  $option['allowed_user'] = 'allow_anonymous';
lib/yasr-functions.php CHANGED
@@ -50,8 +50,8 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
50
 
51
  //From 0.6.8 and yasr pro 0.1.0 last parameter it's come back to FALSE, cause this work only if wp_footer is used.
52
  //We're in 2014 and out there still exists themes that doesn't use it.
53
- wp_enqueue_script( 'rateit', YASR_JS_DIR . 'jquery.rateit.min.js' , array('jquery'), '1.0.22', FALSE );
54
- wp_enqueue_script( 'cookie', YASR_JS_DIR . 'jquery-cookie.min.js' , array('jquery', 'rateit'), '1.4.0', FALSE );
55
 
56
  //if visitors stats are enabled
57
  if (YASR_VISITORS_STATS === 'yes') {
@@ -59,7 +59,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
59
  wp_enqueue_script( 'jquery-ui-tooltip' ); //script
60
  }
61
 
62
- wp_enqueue_script( 'yasrfront', YASR_JS_DIR . 'yasr-front.js' , array('jquery', 'rateit'), '1.0.00', FALSE );
63
 
64
  }
65
 
50
 
51
  //From 0.6.8 and yasr pro 0.1.0 last parameter it's come back to FALSE, cause this work only if wp_footer is used.
52
  //We're in 2014 and out there still exists themes that doesn't use it.
53
+ wp_enqueue_script( 'rateit', YASR_JS_DIR . 'jquery.rateit.min.js' , array('jquery'), '1.0.22', TRUE );
54
+ wp_enqueue_script( 'cookie', YASR_JS_DIR . 'jquery-cookie.min.js' , array('jquery', 'rateit'), '1.4.0', TRUE );
55
 
56
  //if visitors stats are enabled
57
  if (YASR_VISITORS_STATS === 'yes') {
59
  wp_enqueue_script( 'jquery-ui-tooltip' ); //script
60
  }
61
 
62
+ wp_enqueue_script( 'yasrfront', YASR_JS_DIR . 'yasr-front.js' , array('jquery', 'rateit'), '1.0.00', TRUE );
63
 
64
  }
65
 
lib/yasr-settings-functions.php CHANGED
@@ -48,7 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
48
 
49
  add_settings_section( 'yasr_general_options_section_id', __('General settings', 'yasr'), 'yasr_section_callback', 'yasr_general_settings_tab' );
50
  add_settings_field( 'yasr_use_auto_insert_id', __('Auto insert options', 'yasr'), 'yasr_auto_insert_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option );
51
- add_settings_field( 'yasr_show_overall_in_loop', __('Show "Overall Rating" in Home Page?', 'yasr'), 'yasr_show_overall_in_loop_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
 
52
  add_settings_field( 'yasr_custom_text', __('Insert custom text to show before / after stars', 'yasr'), 'yasr_custom_text_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
53
  add_settings_field( 'yasr_visitors_stats', __('Do you want show stats for visitors votes?', 'yasr'), 'yasr_visitors_stats_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
54
  add_settings_field( 'yasr_color_scheme', __('Which color scheme do you want to use?', 'yasr') , 'yasr_color_scheme_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
@@ -221,6 +222,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
221
 
222
  }
223
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  function yasr_custom_text_callback($option) {
225
 
226
  $text_before_overall = htmlspecialchars("$option[text_before_overall]");
48
 
49
  add_settings_section( 'yasr_general_options_section_id', __('General settings', 'yasr'), 'yasr_section_callback', 'yasr_general_settings_tab' );
50
  add_settings_field( 'yasr_use_auto_insert_id', __('Auto insert options', 'yasr'), 'yasr_auto_insert_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option );
51
+ add_settings_field( 'yasr_show_overall_in_loop', __('Show "Overall Rating" in Archive Page?', 'yasr'), 'yasr_show_overall_in_loop_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
52
+ add_settings_field( 'yasr_show_visitor_votes_in_loop', __('Show "Visitor Votes" in Archive Page?', 'yasr'), 'yasr_show_visitor_votes_in_loop_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
53
  add_settings_field( 'yasr_custom_text', __('Insert custom text to show before / after stars', 'yasr'), 'yasr_custom_text_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
54
  add_settings_field( 'yasr_visitors_stats', __('Do you want show stats for visitors votes?', 'yasr'), 'yasr_visitors_stats_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
55
  add_settings_field( 'yasr_color_scheme', __('Which color scheme do you want to use?', 'yasr') , 'yasr_color_scheme_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
222
 
223
  }
224
 
225
+ function yasr_show_visitor_votes_in_loop_callback ($option) {
226
+
227
+ ?>
228
+
229
+ <input type='radio' name='yasr_general_options[show_visitor_votes_in_loop]' value='enabled' class='yasr-general-option-show-visitor-votes-in-loop' <?php if ($option['show_visitor_votes_in_loop']==='enabled') echo " checked=\"checked\" "; ?> />
230
+ <?php _e('Yes', 'yasr')?>
231
+
232
+ &nbsp;&nbsp;&nbsp;
233
+
234
+ <input type='radio' name='yasr_general_options[show_visitor_votes_in_loop]' value='disabled' class='yasr-general-option-show-visitor-votes-in-loop' <?php if ($option['show_visitor_votes_in_loop']==='disabled') echo " checked=\"checked\" "; ?> />
235
+ <?php _e('No', 'yasr')?>
236
+ <br />
237
+ <br />
238
+
239
+ <?php _e('If you enable this, "Visitor Votes" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yasr')?>
240
+
241
+ <p>&nbsp;</p>
242
+
243
+ <br />
244
+
245
+ <hr>
246
+
247
+ <?php
248
+
249
+ }
250
+
251
  function yasr_custom_text_callback($option) {
252
 
253
  $text_before_overall = htmlspecialchars("$option[text_before_overall]");
lib/yasr-shortcode-functions.php CHANGED
@@ -103,7 +103,7 @@ function shortcode_overall_rating_callback ($atts) {
103
  } // End if YASR_SHOW_OVERALL_IN_LOOP === 'disabled') {
104
 
105
  //If overall rating in loop is enabled don't use is_singular && is main_query
106
- elseif ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
107
 
108
  //If pages are not excluted return always
109
  if ( YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' || !YASR_AUTO_INSERT_EXCLUDE_PAGES ) {
@@ -134,234 +134,243 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
134
 
135
  function shortcode_visitor_votes_callback ($atts) {
136
 
137
- //To avoid double visualization, I will insert this only if auto insert is off or if auto insert is set on overall rating.
138
- //If auto insert is on visitor rating this shortcode must return nothing
139
 
140
- //if (YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'overall_rating' )) {
141
 
142
- $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
143
 
144
- if( is_singular() && is_main_query() ) {
145
 
146
- $ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
147
 
148
- $votes=yasr_get_visitor_votes();
149
-
150
- $medium_rating=0; //Avoid undefined variable
 
151
 
152
- if (!$votes) {
153
- $votes=0; //Avoid undefined variable if there is not overall rating
154
- $votes_number=0; //Avoid undefined variable
 
 
155
  }
156
-
157
  else {
158
- foreach ($votes as $user_votes) {
159
- $votes_number = $user_votes->number_of_votes;
160
- if ($votes_number !=0 ) {
161
- $medium_rating = ($user_votes->sum_votes/$votes_number);
162
- }
163
- }
164
  }
 
 
165
 
 
166
 
167
- $image = YASR_IMG_DIR . "/loader.gif";
168
 
169
- $loader_html = "<div id=\"loader-visitor-rating\" >&nbsp; " . __("Loading, please wait","yasr") . " <img src= \" $image \"></div>";
170
 
171
- $medium_rating=round($medium_rating, 1);
 
 
172
 
173
- if (!$atts) {
174
- $size = 'large';
175
- }
 
 
 
 
176
 
177
- else {
178
- extract( shortcode_atts (
179
- array(
180
- 'size' => 'string',
181
- ), $atts )
182
- );
183
- }
184
 
185
- if ($size === 'small') {
186
- $rateit_class='rateit';
187
- $px_size = '16';
188
- }
189
 
190
- elseif ($size === 'medium') {
191
- $rateit_class = 'rateit medium';
192
- $px_size = '24';
193
- }
 
194
 
195
- //default values
196
- else {
197
- $rateit_class = 'rateit bigstars';
198
- $px_size = '32';
199
- }
200
 
201
- //if anonymous are allowed to vote
202
- if (YASR_ALLOWED_USER === 'allow_anonymous') {
203
 
204
- //I've to block a logged in user that has already rated
205
- if ( is_user_logged_in() ) {
206
 
207
- //Chek if a logged in user has already rated for this post
208
- $vote_if_user_already_rated = yasr_check_if_user_already_voted();
209
 
210
- //If user has already rated show readonly stars
211
- if ($vote_if_user_already_rated) {
212
 
213
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
214
- <div class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</div>
215
- <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", "yasr") . " $vote_if_user_already_rated </span></div>";
216
 
217
- }
218
 
219
- //else logged user can vote
220
- else {
221
 
222
- $vote_if_user_already_rated = 0;
223
 
224
- if ($votes_number>0) {
225
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
226
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span></div>";
227
- }
228
 
229
- else {
230
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
231
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span></div>";
232
- }
233
 
234
- } //End else
235
 
236
- } //End if user is logged
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
 
239
- //else if is not logged can vote
240
  else {
241
 
242
  $vote_if_user_already_rated = 0;
243
 
244
- if ($votes_number>0) {
245
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
246
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\"> [" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span></div>";
247
- }
248
 
249
- else {
250
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
251
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span></div>";
252
- }
253
 
254
- } //end else
255
-
256
- } //end if ($allow_logged_option['allowed_user']==='allow_anonymous') {
257
 
 
 
 
258
 
259
- //If only logged in users can vote
260
- elseif (YASR_ALLOWED_USER === 'logged_only') {
261
 
262
- //If user is logged in and can vote
263
- if ( is_user_logged_in() ) {
264
 
265
- //Chek if a logged in user has already rated for this post
266
- $vote_if_user_already_rated = yasr_check_if_user_already_voted();
267
 
268
- if ($vote_if_user_already_rated) {
269
 
270
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
271
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>
272
- <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", "yasr") . " $vote_if_user_already_rated </span></div>";
273
 
274
- }
275
 
276
- else {
 
277
 
278
- $vote_if_user_already_rated = 0;
279
 
280
- if ($votes_number>0) {
281
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
282
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>
283
- </div>";
284
- }
285
 
286
- else {
287
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
288
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>
289
- </div>";
290
- }
291
 
292
- }
293
 
294
- } //End if user is logged in
295
 
296
- //Else mean user is not logged in
297
- else {
298
 
299
- $vote_if_user_already_rated = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
 
301
- if ($votes_number>0) {
302
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
303
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>
304
- " . __("You must sign to vote", "yasr") . "</div>";
305
- }
306
 
307
- else {
308
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
309
- <span class=\"yasr-total-average-text\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>"
310
- . __("You must sign to vote", "yasr") . "</div>";
311
- }
312
 
313
- }
314
-
315
- }
316
 
 
 
317
 
318
- if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_VISITOR_RATING != '') {
319
-
320
- $shortcode_html_tmp = "<div class=\"yasr-container-custom-text-and-visitor-rating\">
321
- <span id=\"yasr-custom-text-before-visitor-rating\">" . YASR_TEXT_BEFORE_VISITOR_RATING . "</span>" . $shortcode_html . "</div>";
322
 
323
- $shortcode_html = $shortcode_html_tmp;
 
 
324
 
325
  }
326
 
 
 
327
 
328
- ?>
329
 
330
- <script type="text/javascript">
331
 
332
- jQuery(document).ready(function() {
333
 
334
- var tooltipValues = [<?php json_encode (_e("'bad', 'poor', 'ok', 'good', 'super'", "yasr")); ?>];
335
- var postid = <?php echo (the_ID()); ?>;
336
- var ajaxurl = <?php echo (json_encode(admin_url('admin-ajax.php'))); ?>;
337
- var size = <?php echo (json_encode($size)) ?>;
338
- var loggedUser = <?php echo (json_encode(is_user_logged_in())); ?>;
339
- var voteIfUserAlredyRated = <?php echo (json_encode($vote_if_user_already_rated)) ?>;
340
- var votes = <?php echo (json_encode($medium_rating)) ?>;
341
- var votesNumber = <?php echo (json_encode($votes_number)) ?>;
342
- var loaderHtml = <?php echo (json_encode("$loader_html")); ?>;
343
- var nonceVisitor = <?php echo (json_encode("$ajax_nonce_visitor")); ?>;
344
-
345
- yasrVisitorsVotes(tooltipValues, postid, ajaxurl, size, loggedUser, voteIfUserAlredyRated, votes, votesNumber, loaderHtml, nonceVisitor);
346
 
347
- var visitorStatsEnabled = <?php echo (json_encode(YASR_VISITORS_STATS)); ?>;
 
348
 
349
- //If stats are enabled call the function
350
- if (visitorStatsEnabled == 'yes') {
351
- yasrDrawTipsProgress (postid, ajaxurl, loaderHtml);
352
- }
353
 
354
- });
355
 
356
- </script>
357
 
358
- <?php
 
359
 
360
- return $shortcode_html;
 
 
361
 
362
- } //End if is singular
363
 
364
- //} //End if auto_insert_enabled
 
 
365
 
366
  } //End function shortcode_visitor_votes_callback
367
 
103
  } // End if YASR_SHOW_OVERALL_IN_LOOP === 'disabled') {
104
 
105
  //If overall rating in loop is enabled don't use is_singular && is main_query
106
+ elseif ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
107
 
108
  //If pages are not excluted return always
109
  if ( YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' || !YASR_AUTO_INSERT_EXCLUDE_PAGES ) {
134
 
135
  function shortcode_visitor_votes_callback ($atts) {
136
 
137
+ $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
 
138
 
139
+ $post_id = get_the_ID();
140
 
141
+ $ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
142
 
143
+ $votes=yasr_get_visitor_votes();
144
 
145
+ $medium_rating=0; //Avoid undefined variable
146
 
147
+ if (!$votes) {
148
+ $votes=0; //Avoid undefined variable if there is not overall rating
149
+ $votes_number=0; //Avoid undefined variable
150
+ }
151
 
152
+ else {
153
+ foreach ($votes as $user_votes) {
154
+ $votes_number = $user_votes->number_of_votes;
155
+ if ($votes_number != 0 ) {
156
+ $medium_rating = ($user_votes->sum_votes/$votes_number);
157
  }
 
158
  else {
159
+ $medium_rating = 0;
 
 
 
 
 
160
  }
161
+ }
162
+ }
163
 
164
+ $image = YASR_IMG_DIR . "/loader.gif";
165
 
166
+ $loader_html = "<div id=\"loader-visitor-rating\" >&nbsp; " . __("Loading, please wait","yasr") . " <img src= \" $image \"></div>";
167
 
168
+ $medium_rating=round($medium_rating, 1);
169
 
170
+ if (!$atts) {
171
+ $size = 'large';
172
+ }
173
 
174
+ else {
175
+ extract( shortcode_atts (
176
+ array(
177
+ 'size' => 'string',
178
+ ), $atts )
179
+ );
180
+ }
181
 
182
+ if ($size === 'small') {
183
+ $rateit_class='rateit';
184
+ $px_size = '16';
185
+ }
 
 
 
186
 
187
+ elseif ($size === 'medium') {
188
+ $rateit_class = 'rateit medium';
189
+ $px_size = '24';
190
+ }
191
 
192
+ //default values
193
+ else {
194
+ $rateit_class = 'rateit bigstars';
195
+ $px_size = '32';
196
+ }
197
 
198
+ $shortcode_html = "<div id=\"yasr_visitor_votes_$post_id\">";
 
 
 
 
199
 
200
+ //if anonymous are allowed to vote
201
+ if (YASR_ALLOWED_USER === 'allow_anonymous') {
202
 
203
+ //I've to block a logged in user that has already rated
204
+ if ( is_user_logged_in() ) {
205
 
206
+ //Chek if a logged in user has already rated for this post
207
+ $vote_if_user_already_rated = yasr_check_if_user_already_voted();
208
 
209
+ //If user has already rated
210
+ if ($vote_if_user_already_rated) {
211
 
212
+ $shortcode_html.="<div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes_$post_id\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
213
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>
214
+ <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", "yasr") . " $vote_if_user_already_rated </span>";
215
 
216
+ }
217
 
218
+ //else logged user can vote
219
+ else {
220
 
221
+ $vote_if_user_already_rated = 0;
222
 
223
+ $shortcode_html.="<div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes_$post_id\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
224
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>";
 
 
225
 
226
+ } //End else
 
 
 
227
 
228
+ } //End if user is logged
229
 
 
230
 
231
+ //else if is not logged can vote
232
+ else {
233
+
234
+ $shortcode_html.="<div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes_$post_id\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
235
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>";
236
+
237
+ } //end else
238
+
239
+ } //end if ($allow_logged_option['allowed_user']==='allow_anonymous') {
240
+
241
+
242
+ //If only logged in users can vote
243
+ elseif (YASR_ALLOWED_USER === 'logged_only') {
244
+
245
+ //If user is logged in and can vote
246
+ if ( is_user_logged_in() ) {
247
+
248
+ //Chek if a logged in user has already rated for this post
249
+ $vote_if_user_already_rated = yasr_check_if_user_already_voted();
250
+
251
+ if ($vote_if_user_already_rated) {
252
+
253
+ $shortcode_html.="<div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes_$post_id\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
254
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>
255
+ <span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", "yasr") . " $vote_if_user_already_rated </span>";
256
+
257
+ }
258
 
 
259
  else {
260
 
261
  $vote_if_user_already_rated = 0;
262
 
263
+ $shortcode_html.="<div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes_$post_id\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
264
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>";
265
+
266
+ }
267
 
268
+ } //End if user is logged in
 
 
 
269
 
270
+ //Else mean user is not logged in
271
+ else {
 
272
 
273
+ $shortcode_html.="<div class=\"$rateit_class\" id=\"yasr_rateit_visitor_votes_$post_id\" data-rateit-starwidth=\"$px_size\" data-rateit-starheight=\"$px_size\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
274
+ <span class=\"yasr-total-average-text\" id=\"yasr-total-average-text_$post_id\" title=\"yasr-stats\">[" . __("Total: ", "yasr") . "$votes_number &nbsp; &nbsp;" . __("Average: ","yasr") . "$medium_rating/5]</span>
275
+ " . __("You must sign to vote", "yasr");
276
 
277
+ }
 
278
 
279
+ }
 
280
 
281
+ $shortcode_html .= "</div>";
 
282
 
 
283
 
 
 
 
284
 
285
+ if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_VISITOR_RATING != '') {
286
 
287
+ $shortcode_html_tmp = "<div class=\"yasr-container-custom-text-and-visitor-rating\">
288
+ <span id=\"yasr-custom-text-before-visitor-rating\">" . YASR_TEXT_BEFORE_VISITOR_RATING . "</span>" . $shortcode_html . "</div>";
289
 
290
+ $shortcode_html = $shortcode_html_tmp;
291
 
292
+ }
 
 
 
 
293
 
 
 
 
 
 
294
 
295
+ ?>
296
 
297
+ <script type="text/javascript">
298
 
299
+ jQuery(document).ready(function() {
 
300
 
301
+ var tooltipValues = [<?php json_encode (_e("'bad', 'poor', 'ok', 'good', 'super'", "yasr")); ?>];
302
+ var postid = <?php echo (json_encode($post_id)) ?>;
303
+ var ajaxurl = <?php echo (json_encode(admin_url('admin-ajax.php'))); ?>;
304
+ var size = <?php echo (json_encode($size)) ?>;
305
+ var loggedUser = <?php echo (json_encode(is_user_logged_in())); ?>;
306
+ var voteIfUserAlredyRated = <?php echo (json_encode($vote_if_user_already_rated)) ?>;
307
+ var votes = <?php echo (json_encode($medium_rating)) ?>;
308
+ var votesNumber = <?php echo (json_encode($votes_number)) ?>;
309
+ var loaderHtml = <?php echo (json_encode("$loader_html")); ?>;
310
+ var nonceVisitor = <?php echo (json_encode("$ajax_nonce_visitor")); ?>;
311
+
312
+ yasrVisitorsVotes(tooltipValues, postid, ajaxurl, size, loggedUser, voteIfUserAlredyRated, votes, votesNumber, loaderHtml, nonceVisitor);
313
+
314
+ var visitorStatsEnabled = <?php echo (json_encode(YASR_VISITORS_STATS)); ?>;
315
+
316
+ //If stats are enabled call the function
317
+ if (visitorStatsEnabled == 'yes') {
318
+ yasrDrawTipsProgress (postid, ajaxurl);
319
+ }
320
+
321
+ });
322
 
323
+ </script>
 
 
 
 
324
 
325
+ <?php
 
 
 
 
326
 
327
+ //IF show visitor votes in loop is disabled use is_singular && is_main query
328
+ if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'disabled' ) {
 
329
 
330
+ //If pages are not excluted
331
+ if ( YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' || !YASR_AUTO_INSERT_EXCLUDE_PAGES ) {
332
 
333
+ if( is_singular() && is_main_query() ) {
 
 
 
334
 
335
+ return $shortcode_html;
336
+
337
+ }
338
 
339
  }
340
 
341
+ //If page are excluted
342
+ else {
343
 
344
+ if( is_singular() && is_main_query() && !is_page() )
345
 
346
+ return $shortcode_html;
347
 
348
+ }
349
 
350
+ } // End if YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'disabled') {
 
 
 
 
 
 
 
 
 
 
 
351
 
352
+ //If overall rating in loop is enabled don't use is_singular && is main_query
353
+ elseif ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
354
 
355
+ //If pages are not excluted return always
356
+ if ( YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' || !YASR_AUTO_INSERT_EXCLUDE_PAGES ) {
 
 
357
 
358
+ return $shortcode_html;
359
 
360
+ }
361
 
362
+ //Else if page are excluted return only if is not a page
363
+ else {
364
 
365
+ if ( !is_page() ) {
366
+
367
+ return $shortcode_html;
368
 
369
+ }
370
 
371
+ }
372
+
373
+ }
374
 
375
  } //End function shortcode_visitor_votes_callback
376
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post r
4
  Requires at least: 3.5
5
  Contributors: Dudo
6
  Tested up to: 4.0
7
- Stable tag: 0.6.8
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
@@ -91,6 +91,11 @@ Of course not: you can easily add it on the visual editor just by clicking on th
91
 
92
  == Changelog ==
93
 
 
 
 
 
 
94
  = 0.6.8 =
95
  * In the front end, Javascript is loaded at the top of the page, cause out there still exists theme that doesn't use wp_footer function
96
  * Smaller bugfixes
4
  Requires at least: 3.5
5
  Contributors: Dudo
6
  Tested up to: 4.0
7
+ Stable tag: 0.6.9
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
91
 
92
  == Changelog ==
93
 
94
+ = 0.6.9 =
95
+ * Yasr Visitor Votes shortag is finally avaible in archive pages!
96
+ * Code cleanup on yasr visitor votes shortag
97
+ * Javascript loaded again at the bottom in the frontend. Theme that doesn't use wp_footer will no be supported anymore
98
+
99
  = 0.6.8 =
100
  * In the front end, Javascript is loaded at the top of the page, cause out there still exists theme that doesn't use wp_footer function
101
  * Smaller bugfixes
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.6.8
7
  * Author: Dario Curvino
8
  * Author URI: http://yetanotherstarsrating.com/
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.6.8');
32
 
33
  //Plugin relative path
34
  define( "YASR_RELATIVE_PATH", dirname(__FILE__) );
@@ -84,6 +84,17 @@ define ("YASR_LOG_TABLE", $wpdb->prefix . 'yasr_log');
84
 
85
  define ("YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif");
86
 
 
 
 
 
 
 
 
 
 
 
 
87
  //remove end gen 2015
88
  if ($version_installed && $version_installed < '0.5.9') {
89
 
@@ -180,6 +191,7 @@ else {
180
  }
181
 
182
  define ("YASR_SHOW_OVERALL_IN_LOOP", $stored_options['show_overall_in_loop']);
 
183
  define ("YASR_TEXT_BEFORE_STARS", $stored_options['text_before_stars']);
184
 
185
  if ( YASR_TEXT_BEFORE_STARS == 1 ) {
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.6.9
7
  * Author: Dario Curvino
8
  * Author URI: http://yetanotherstarsrating.com/
9
  * License: GPL2
28
  */
29
 
30
 
31
+ define('YASR_VERSION_NUM', '0.6.9');
32
 
33
  //Plugin relative path
34
  define( "YASR_RELATIVE_PATH", dirname(__FILE__) );
84
 
85
  define ("YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif");
86
 
87
+ //Remove mid feb 2015
88
+ if ($version_installed && $version_installed < '0.6.9' ) {
89
+
90
+ $stored_options = get_option ( 'yasr_general_options' );
91
+
92
+ $stored_options['show_visitor_votes_in_loop'] = 'disabled';
93
+
94
+ update_option("yasr_general_options", $stored_options);
95
+
96
+ }
97
+
98
  //remove end gen 2015
99
  if ($version_installed && $version_installed < '0.5.9') {
100
 
191
  }
192
 
193
  define ("YASR_SHOW_OVERALL_IN_LOOP", $stored_options['show_overall_in_loop']);
194
+ define ("YASR_SHOW_VISITOR_VOTES_IN_LOOP", $stored_options['show_visitor_votes_in_loop']);
195
  define ("YASR_TEXT_BEFORE_STARS", $stored_options['text_before_stars']);
196
 
197
  if ( YASR_TEXT_BEFORE_STARS == 1 ) {