Yasr – Yet Another Stars Rating - Version 2.8.1

Version Description

  • FIXED: error that could occour in some circumstances
Download this release

Release Info

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

Code changes from version 2.8.0 to 2.8.1

public/classes/YasrRichSnippets.php CHANGED
@@ -100,12 +100,12 @@ class YasrRichSnippets {
100
 
101
  //Add everywhere except for blogPosting
102
  if ($review_choosen !== 'BlogPosting') {
103
- $rich_snippet = $this->richSnippetsReview($rich_snippet_data, $cleaned_content, $overall_rating);
104
 
105
  //if both are included, google will index AggregateRating instead of Review.
106
  //So, if post is selected as review, exclude AggregateRating
107
  if($rich_snippet_data['is_post_a_review'] !== 'yes') {
108
- $rich_snippet = $this->richSnippetsAggregateRating($visitor_votes);
109
  }
110
  }
111
 
@@ -216,7 +216,7 @@ class YasrRichSnippets {
216
  */
217
  private function richSnippetsReview($rich_snippet_data, $cleaned_content, $overall_rating) {
218
  if ($overall_rating) {
219
- $rich_snippet['Review'] = array(
220
  '@type' => 'Review',
221
  'name' => $rich_snippet_data['review_name'],
222
  'reviewBody' => $cleaned_content,
@@ -233,7 +233,7 @@ class YasrRichSnippets {
233
  'worstRating' => 1
234
  ),
235
  );
236
- $rich_snippet['Review']['publisher'] = $rich_snippet_data['publisher'];
237
 
238
  return $rich_snippet;
239
  }
@@ -253,7 +253,7 @@ class YasrRichSnippets {
253
  $average_rating = $visitor_votes['sum_votes'] / $visitor_votes['number_of_votes'];
254
  $average_rating = round($average_rating, 1);
255
 
256
- $rich_snippet['aggregateRating'] = array(
257
  '@type' => 'AggregateRating',
258
  'ratingValue' => $average_rating,
259
  'ratingCount' => $visitor_votes['number_of_votes'],
@@ -303,7 +303,10 @@ class YasrRichSnippets {
303
  $more_rich_snippet = $this->movie($post_meta);
304
  }
305
 
306
- return array_merge($rich_snippet, $more_rich_snippet);
 
 
 
307
 
308
  }
309
 
100
 
101
  //Add everywhere except for blogPosting
102
  if ($review_choosen !== 'BlogPosting') {
103
+ $rich_snippet['Review'] = $this->richSnippetsReview($rich_snippet_data, $cleaned_content, $overall_rating);
104
 
105
  //if both are included, google will index AggregateRating instead of Review.
106
  //So, if post is selected as review, exclude AggregateRating
107
  if($rich_snippet_data['is_post_a_review'] !== 'yes') {
108
+ $rich_snippet['aggregateRating'] = $this->richSnippetsAggregateRating($visitor_votes);
109
  }
110
  }
111
 
216
  */
217
  private function richSnippetsReview($rich_snippet_data, $cleaned_content, $overall_rating) {
218
  if ($overall_rating) {
219
+ $rich_snippet = array(
220
  '@type' => 'Review',
221
  'name' => $rich_snippet_data['review_name'],
222
  'reviewBody' => $cleaned_content,
233
  'worstRating' => 1
234
  ),
235
  );
236
+ $rich_snippet['publisher'] = $rich_snippet_data['publisher'];
237
 
238
  return $rich_snippet;
239
  }
253
  $average_rating = $visitor_votes['sum_votes'] / $visitor_votes['number_of_votes'];
254
  $average_rating = round($average_rating, 1);
255
 
256
+ $rich_snippet = array(
257
  '@type' => 'AggregateRating',
258
  'ratingValue' => $average_rating,
259
  'ratingCount' => $visitor_votes['number_of_votes'],
303
  $more_rich_snippet = $this->movie($post_meta);
304
  }
305
 
306
+ if(is_array($rich_snippet) && is_array($more_rich_snippet)) {
307
+ return array_merge($rich_snippet, $more_rich_snippet);
308
+ }
309
+ return $rich_snippet;
310
 
311
  }
312
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 5.0
5
  Contributors: Dudo
6
  Tested up to: 5.8
7
  Requires PHP: 5.4
8
- Stable tag: 2.8.0
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
@@ -194,6 +194,9 @@ Yes, YASR is 100% fully compatible with PHP 8
194
 
195
  The full changelog can be found in the plugin's directory. Recent entries:
196
 
 
 
 
197
  = 2.8.0 =
198
  * FIXED: if blogPosting itemType is selected, and a non valid url image is is supplied in the rich snippets settings,
199
  a php warning is returned
@@ -276,4 +279,4 @@ The class yasr-total-average-container has be renamed yasr-vv-stats-text-contain
276
 
277
 
278
  = Additional Info =
279
- See credits.txt file
5
  Contributors: Dudo
6
  Tested up to: 5.8
7
  Requires PHP: 5.4
8
+ Stable tag: 2.8.1
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
194
 
195
  The full changelog can be found in the plugin's directory. Recent entries:
196
 
197
+ = 2.8.1 =
198
+ * FIXED: error that could occour in some circumstances
199
+
200
  = 2.8.0 =
201
  * FIXED: if blogPosting itemType is selected, and a non valid url image is is supplied in the rich snippets settings,
202
  a php warning is returned
279
 
280
 
281
  = Additional Info =
282
+ See credits.txt file
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
7
- * Version: 2.8.0
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
- define( 'YASR_VERSION_NUM', '2.8.0' );
80
  //Plugin absolute path
81
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
82
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
7
+ * Version: 2.8.1
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
+ define( 'YASR_VERSION_NUM', '2.8.1' );
80
  //Plugin absolute path
81
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
82
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );