Yasr – Yet Another Stars Rating - Version 0.9.6

Version Description

  • Fixed author missing in schema info if blogposting is used
  • Minor fix on schema
  • Code Cleanup

  • Fixed minor bug on schema info.

Download this release

Release Info

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

Code changes from version 0.9.5 to 0.9.6

lib/yasr-functions.php CHANGED
@@ -264,11 +264,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
264
 
265
  add_filter('the_content', 'yasr_add_schema');
266
 
267
- /****** Add review schema data at the end of the post *******/
268
-
269
- add_filter('the_content', 'yasr_add_schema');
270
-
271
- function yasr_add_schema($content) {
272
 
273
  //Add buddypress compatibility
274
  if (function_exists('bp_is_active')) {
@@ -284,18 +280,18 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
284
 
285
  }
286
 
287
- $schema=NULL; //To avoid undefined variable notice outside the loop
288
 
289
  $review_choosen = yasr_get_snippet_type();
290
 
291
- if (YASR_SNIPPET == 'overall_rating') {
292
 
293
- $overall_rating=yasr_get_overall_rating();
294
 
295
- if($overall_rating && $overall_rating != '-1' && $overall_rating != '0.0') {
296
 
297
- if(is_singular() && is_main_query() ) {
298
- global $post;
299
 
300
  $div = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Review\">";
301
 
@@ -309,14 +305,14 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
309
  $title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/LocalBusiness\"> <span itemprop=\"name\">". get_the_title() ."</span></span>";
310
  }
311
 
312
- elseif ($review_choosen == "Product") {
313
  $title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/Product\"> <span itemprop=\"name\">". get_the_title() ."</span></span>";
314
  }
315
 
316
- elseif ($review_choosen == "Product" || !$review_choosen) {
317
  $title = "<span itemprop=\"itemReviewed\" itemscope itemType=\"http://schema.org/BlogPosting\"> <span itemprop=\"name headline\">". get_the_title() ." </span>";
318
  $date =__('reviewed on', 'yasr')."<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date() . " </span>";
319
- $author = "<span itemprop=\"author\" itemscope itemtype=\"http://schema.org/Person\">" . __('by ', 'yasr') . "<span itemprop=\"name\">" . get_the_author() . "</span></span>";
320
 
321
  }
322
 
@@ -333,15 +329,15 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
333
  }
334
 
335
 
336
- }
337
 
338
- } //END id if $overall_rating != '-1'
339
 
340
- } //end if ($choosen_snippet['snippet'] == 'overall_rating')
341
 
342
- if (YASR_SNIPPET == 'visitor_rating') {
343
 
344
- $visitor_votes = yasr_get_visitor_votes ();
345
 
346
  if ($visitor_votes) {
347
 
@@ -356,11 +352,11 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
356
  $visitor_rating = NULL;
357
  }
358
 
359
- if ($visitor_rating['sum'] != 0 && $visitor_rating['votes_number'] != 0) {
360
 
361
- $average_rating = $visitor_rating['sum'] / $visitor_rating['votes_number'];
362
 
363
- $average_rating=round($average_rating, 1);
364
 
365
  if ($review_choosen == 'Place') {
366
  $div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/LocalBusiness\"> <span itemprop=\"name\">". get_the_title() ."</span>";
264
 
265
  add_filter('the_content', 'yasr_add_schema');
266
 
267
+ function yasr_add_schema($content) {
 
 
 
 
268
 
269
  //Add buddypress compatibility
270
  if (function_exists('bp_is_active')) {
280
 
281
  }
282
 
283
+ $schema=NULL; //To avoid undefined variable notice outside the loop
284
 
285
  $review_choosen = yasr_get_snippet_type();
286
 
287
+ if (YASR_SNIPPET == 'overall_rating') {
288
 
289
+ $overall_rating=yasr_get_overall_rating();
290
 
291
+ if($overall_rating && $overall_rating != '-1' && $overall_rating != '0.0') {
292
 
293
+ if(is_singular() && is_main_query() ) {
294
+ global $post;
295
 
296
  $div = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Review\">";
297
 
305
  $title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/LocalBusiness\"> <span itemprop=\"name\">". get_the_title() ."</span></span>";
306
  }
307
 
308
+ elseif ($review_choosen == "Product" || !$review_choosen) {
309
  $title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/Product\"> <span itemprop=\"name\">". get_the_title() ."</span></span>";
310
  }
311
 
312
+ elseif ($review_choosen == "Other") {
313
  $title = "<span itemprop=\"itemReviewed\" itemscope itemType=\"http://schema.org/BlogPosting\"> <span itemprop=\"name headline\">". get_the_title() ." </span>";
314
  $date =__('reviewed on', 'yasr')."<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date() . " </span>";
315
+ $author = __('by ', 'yasr') . "<span itemprop=\"author\" itemscope itemtype=\"http://schema.org/Person\"><span itemprop=\"name\">" . get_the_author() . " </span></span>";
316
 
317
  }
318
 
329
  }
330
 
331
 
332
+ }
333
 
334
+ } //END id if $overall_rating != '-1'
335
 
336
+ } //end if ($choosen_snippet['snippet'] == 'overall_rating')
337
 
338
+ if (YASR_SNIPPET == 'visitor_rating') {
339
 
340
+ $visitor_votes = yasr_get_visitor_votes ();
341
 
342
  if ($visitor_votes) {
343
 
352
  $visitor_rating = NULL;
353
  }
354
 
355
+ if ($visitor_rating['sum'] != 0 && $visitor_rating['votes_number'] != 0) {
356
 
357
+ $average_rating = $visitor_rating['sum'] / $visitor_rating['votes_number'];
358
 
359
+ $average_rating=round($average_rating, 1);
360
 
361
  if ($review_choosen == 'Place') {
362
  $div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/LocalBusiness\"> <span itemprop=\"name\">". get_the_title() ."</span>";
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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
  Contributors: Dudo
6
- Tested up to: 4.3
7
- Stable tag: 0.9.5
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
@@ -123,6 +123,13 @@ Of course not: you can easily add it on the visual editor just by clicking on th
123
 
124
  == Changelog ==
125
 
 
 
 
 
 
 
 
126
  = 0.9.5 =
127
  * Fixed div not created if schema info not present
128
 
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
  Contributors: Dudo
6
+ Tested up to: 4.3.1
7
+ Stable tag: 0.9.6
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
123
 
124
  == Changelog ==
125
 
126
+ = 0.9.6 =
127
+ * Fixed author missing in schema info if blogposting is used
128
+ * Minor fix on schema
129
+ * Code Cleanup
130
+
131
+ * Fixed minor bug on schema info.
132
+
133
  = 0.9.5 =
134
  * Fixed div not created if schema info not present
135
 
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.9.5
7
  * Author: Dario Curvino
8
  * Author URI: https://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.9.5');
32
 
33
  //Plugin relative path
34
  define( "YASR_RELATIVE_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.9.6
7
  * Author: Dario Curvino
8
  * Author URI: https://yetanotherstarsrating.com/
9
  * License: GPL2
28
  */
29
 
30
 
31
+ define('YASR_VERSION_NUM', '0.9.6');
32
 
33
  //Plugin relative path
34
  define( "YASR_RELATIVE_PATH", dirname(__FILE__) );