Yasr – Yet Another Stars Rating - Version 1.0.1

Version Description

  • NEX FEATURE: is now possible to choose a recipe as itemType for rich snippets
  • TWEAKED: moved from jquery(document).ready to DOMContentLoaded in some shortcodes
  • FIXED: various minor fixes
Download this release

Release Info

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

Code changes from version 1.0.0 to 1.0.1

img/yasr_review.png CHANGED
Binary file
js/yasr-admin.js CHANGED
@@ -350,7 +350,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
350
jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
351
jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
352
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
353
- jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted this article with');
354
355
});
356
350
jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
351
jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
352
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
353
+ jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted this article');
354
355
});
356
lib/yasr-ajax-functions.php CHANGED
@@ -145,6 +145,12 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
145
146
elseif ($reviewtype === "3") {
147
148
$reviewtype = 'Other';
149
150
}
@@ -181,7 +187,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
181
}
182
183
if($review_type) {
184
- _e("$reviewtype selected", "yet-another-stars-rating");
185
}
186
else {
187
_e("There was an error while trying to insert the review type. Please report it", "yet-another-stars-rating");
145
146
elseif ($reviewtype === "3") {
147
148
+ $reviewtype = "Recipe";
149
+
150
+ }
151
+
152
+ elseif ($reviewtype === "4") {
153
+
154
$reviewtype = 'Other';
155
156
}
187
}
188
189
if($review_type) {
190
+ _e("Type Saved", "yet-another-stars-rating");
191
}
192
else {
193
_e("There was an error while trying to insert the review type. Please report it", "yet-another-stars-rating");
lib/yasr-db-functions.php CHANGED
@@ -185,7 +185,7 @@ function yasr_get_snippet_type() {
185
$snippet_type = trim($snippet->review_type);
186
}
187
188
- if ($snippet_type != 'Product' && $snippet_type != 'Place' && $snippet_type != 'Other') {
189
190
$snippet_type = YASR_ITEMTYPE;
191
185
$snippet_type = trim($snippet->review_type);
186
}
187
188
+ if ($snippet_type != 'Product' && $snippet_type != 'Place' && $snippet_type != 'Recipe' && $snippet_type != 'Other') {
189
190
$snippet_type = YASR_ITEMTYPE;
191
lib/yasr-functions.php CHANGED
@@ -314,6 +314,10 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
314
$title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/Product\"> <span itemprop=\"name\"> ". get_the_title() ." </span></span>";
315
}
316
317
elseif ($review_choosen == "Other") {
318
$title = "<span itemprop=\"itemReviewed\" itemscope itemType=\"http://schema.org/BlogPosting\"> <span itemprop=\"name headline\"> ". get_the_title() ." </span>";
319
$date =__('reviewed on', 'yet-another-stars-rating') . " <meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date() . " </span>";
@@ -368,16 +372,21 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
368
$date = '';
369
}
370
371
- if ($review_choosen == 'Other') {
372
- $div_1 = "<div class=\"yasr_schema\" itemscope itemType=\"http://schema.org/BlogPosting\"><span itemprop=\"name headline\">". get_the_title() ."</span>";
373
- $date = __(' on ', 'yet-another-stars-rating') . "<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date();
374
- }
375
-
376
elseif ($review_choosen == "Product") {
377
$div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Product\"><span itemprop=\"name\">". get_the_title() ."</span>";
378
$date = '';
379
}
380
381
$author = __( ' written by ' , 'yet-another-stars-rating' ) . get_the_author();
382
383
$span_1 = "<span itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">";
@@ -454,6 +463,12 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
454
455
}
456
457
elseif ($review_choosen == "Place") {
458
459
$rich_snippet["@type"]="LocalBusiness";
@@ -530,6 +545,13 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
530
531
}
532
533
elseif ($review_choosen == "Other") {
534
535
$rich_snippet["@type"] = "BlogPosting";
@@ -564,7 +586,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
564
565
function yasr_select_itemtype() {
566
567
- $i18n_array_review = __('Product, Place, Other', 'yet-another-stars-rating');
568
569
$array_review_type = explode(',', $i18n_array_review);
570
314
$title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/Product\"> <span itemprop=\"name\"> ". get_the_title() ." </span></span>";
315
}
316
317
+ elseif ($review_choosen == "Recipe") {
318
+ $title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/Recipe\"> <span itemprop=\"name\"> ". get_the_title() ." </span></span>";
319
+ }
320
+
321
elseif ($review_choosen == "Other") {
322
$title = "<span itemprop=\"itemReviewed\" itemscope itemType=\"http://schema.org/BlogPosting\"> <span itemprop=\"name headline\"> ". get_the_title() ." </span>";
323
$date =__('reviewed on', 'yet-another-stars-rating') . " <meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date() . " </span>";
372
$date = '';
373
}
374
375
elseif ($review_choosen == "Product") {
376
$div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Product\"><span itemprop=\"name\">". get_the_title() ."</span>";
377
$date = '';
378
}
379
380
+ elseif ($review_choosen == "Recipe") {
381
+ $div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Recipe\"> <span itemprop=\"name\"> ". get_the_title() ." </span>";
382
+ $date = '';
383
+ }
384
+
385
+ elseif ($review_choosen == 'Other') {
386
+ $div_1 = "<div class=\"yasr_schema\" itemscope itemType=\"http://schema.org/BlogPosting\"><span itemprop=\"name headline\">". get_the_title() ."</span>";
387
+ $date = __(' on ', 'yet-another-stars-rating') . "<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date();
388
+ }
389
+
390
$author = __( ' written by ' , 'yet-another-stars-rating' ) . get_the_author();
391
392
$span_1 = "<span itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">";
463
464
}
465
466
+ elseif ($review_choosen == "Recipe") {
467
+
468
+ $rich_snippet["@type"]="Recipe";
469
+
470
+ }
471
+
472
elseif ($review_choosen == "Place") {
473
474
$rich_snippet["@type"]="LocalBusiness";
545
546
}
547
548
+ elseif ($review_choosen == "Recipe") {
549
+
550
+ $rich_snippet["@type"]="Recipe";
551
+
552
+ }
553
+
554
+
555
elseif ($review_choosen == "Other") {
556
557
$rich_snippet["@type"] = "BlogPosting";
586
587
function yasr_select_itemtype() {
588
589
+ $i18n_array_review = __('Product, Place, Recipe, BlogPosting', 'yet-another-stars-rating');
590
591
$array_review_type = explode(',', $i18n_array_review);
592
lib/yasr-settings-functions.php CHANGED
@@ -429,8 +429,12 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
429
<?php _e('Place', 'yet-another-stars-rating')?>
430
<br />
431
432
<input type="radio" name="yasr_general_options[snippet_itemtype]" value="Other" class="yasr_choose_snippet" <?php if ($option['snippet_itemtype']==='Other') echo " checked=\"checked\" "; ?> >
433
- <?php _e('Other', 'yet-another-stars-rating')?>
434
<br />
435
436
429
<?php _e('Place', 'yet-another-stars-rating')?>
430
<br />
431
432
+ <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Recipe" class="yasr_choose_snippet" <?php if ($option['snippet_itemtype']==='Recipe') echo " checked=\"checked\" "; ?> >
433
+ <?php _e('Recipe', 'yet-another-stars-rating')?>
434
+ <br />
435
+
436
<input type="radio" name="yasr_general_options[snippet_itemtype]" value="Other" class="yasr_choose_snippet" <?php if ($option['snippet_itemtype']==='Other') echo " checked=\"checked\" "; ?> >
437
+ <?php _e('BlogPosting', 'yet-another-stars-rating')?>
438
<br />
439
440
lib/yasr-shortcode-functions.php CHANGED
@@ -336,7 +336,7 @@ function shortcode_visitor_votes_callback ($atts) {
336
337
<script type=\"text/javascript\">
338
339
- jQuery(document).ready(function() {
340
341
var stringTooltipValues = $var_tooltip_values;
342
var arrayTooltipValues = stringTooltipValues.split(', ');
@@ -709,7 +709,7 @@ function yasr_visitor_multiset_callback ( $atts ) {
709
710
<script type=\"text/javascript\">
711
712
- jQuery(document).ready(function() {
713
714
var postId = $var_post_id;
715
var setType = $setid;
@@ -881,7 +881,7 @@ function yasr_most_or_highest_rated_posts_callback () {
881
882
<script type="text/javascript">
883
884
- jQuery(document).ready(function() {
885
886
yasrMostOrHighestRatedChart ();
887
336
337
<script type=\"text/javascript\">
338
339
+ document.addEventListener('DOMContentLoaded', function(event) {
340
341
var stringTooltipValues = $var_tooltip_values;
342
var arrayTooltipValues = stringTooltipValues.split(', ');
709
710
<script type=\"text/javascript\">
711
712
+ document.addEventListener('DOMContentLoaded', function(event) {
713
714
var postId = $var_post_id;
715
var setType = $setid;
881
882
<script type="text/javascript">
883
884
+ document.addEventListener('DOMContentLoaded', function(event) {
885
886
yasrMostOrHighestRatedChart ();
887
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.3.1
7
- Stable tag: 1.0.0
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
@@ -121,6 +121,11 @@ Of course not: you can easily add it on the visual editor just by clicking on th
121
122
== Changelog ==
123
124
= 1.0.0 =
125
* TWEAK: Changed textdomain from 'yasr' to 'yet-another-stars-rating'.
126
4
Requires at least: 3.5
5
Contributors: Dudo
6
Tested up to: 4.3.1
7
+ Stable tag: 1.0.1
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
121
122
== Changelog ==
123
124
+ = 1.0.1 =
125
+ * NEX FEATURE: is now possible to choose a recipe as itemType for rich snippets
126
+ * TWEAKED: moved from jquery(document).ready to DOMContentLoaded in some shortcodes
127
+ * FIXED: various minor fixes
128
+
129
= 1.0.0 =
130
* TWEAK: Changed textdomain from 'yasr' to 'yet-another-stars-rating'.
131
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: 1.0.0
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
@@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
30
*/
31
32
33
- define('YASR_VERSION_NUM', '1.0.0');
34
35
//Plugin relative path
36
define( "YASR_RELATIVE_PATH", dirname(__FILE__) );
@@ -216,5 +216,4 @@ if ($version_installed != YASR_VERSION_NUM) {
216
217
}
218
219
-
220
?>
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: 1.0.1
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
30
*/
31
32
33
+ define('YASR_VERSION_NUM', '1.0.1');
34
35
//Plugin relative path
36
define( "YASR_RELATIVE_PATH", dirname(__FILE__) );
216
217
}
218
219
?>