Yasr – Yet Another Stars Rating - Version 0.5.2

Version Description

  • Bugfixes
Download this release

Release Info

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

Code changes from version 0.5.1 to 0.5.2

lib/yasr-ajax-functions.php CHANGED
@@ -1086,6 +1086,11 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
1086
$number_of_votes = $votes->number_of_votes;
1087
}
1088
1089
1090
foreach ($previous_vote as $vote) {
1091
$old_vote = $vote->vote;
1086
$number_of_votes = $votes->number_of_votes;
1087
}
1088
1089
+ //Avoid division by 0. This should never happen, just to be safe, check this post
1090
+ //http://wordpress.org/support/topic/warning-division-by-zero-in-4?replies=2
1091
+ if ($number_of_votes < 1) {
1092
+ $number_of_votes = 1;
1093
+ }
1094
1095
foreach ($previous_vote as $vote) {
1096
$old_vote = $vote->vote;
lib/yasr-shortcode-functions.php CHANGED
@@ -49,17 +49,11 @@ function shortcode_overall_rating_callback ($atts) {
49
}
50
51
52
- if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
53
-
54
- $shortcode_html .= "</div>";
55
-
56
- }
57
-
58
//IF show overall rating in loop is disabled use is_singular && is_main query
59
if ( YASR_SHOW_OVERALL_IN_LOOP === 'disabled' ) {
60
61
//If pages are not excluted
62
- if ( YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' ) {
63
64
if( is_singular() && is_main_query() ) {
65
@@ -70,7 +64,7 @@ function shortcode_overall_rating_callback ($atts) {
70
}
71
72
//If page are excluted
73
- elseif ( YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_EXCLUDE_PAGES === 'yes' ) {
74
75
if( is_singular() && is_main_query() && !is_page() )
76
@@ -80,18 +74,18 @@ function shortcode_overall_rating_callback ($atts) {
80
81
} // End if YASR_SHOW_OVERALL_IN_LOOP === 'disabled') {
82
83
- //If overall rating in loop is enabled don't use is_singular && is main_query
84
- elseif ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
85
86
//If pages are not excluted return always
87
- if (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' ) {
88
89
return $shortcode_html;
90
91
}
92
93
//Else if page are excluted return only if is not a page
94
- elseif ( YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_EXCLUDE_PAGES === 'yes' ) {
95
96
if ( !is_page() ) {
97
@@ -115,8 +109,6 @@ function shortcode_visitor_votes_callback ($atts) {
115
//To avoid double visualization, I will insert this only if auto insert is off or if auto insert is set on overall rating.
116
//If auto insert is on visitor rating this shortcode must return nothing
117
118
- //if (YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'overall_rating' )) {
119
-
120
$shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
121
122
if( is_singular() && is_main_query() ) {
@@ -413,7 +405,6 @@ function shortcode_visitor_votes_callback ($atts) {
413
414
} //End if is singular
415
416
- //} //End if auto_insert_enabled
417
418
} //End function shortcode_visitor_votes_callback
419
49
}
50
51
52
//IF show overall rating in loop is disabled use is_singular && is_main query
53
if ( YASR_SHOW_OVERALL_IN_LOOP === 'disabled' ) {
54
55
//If pages are not excluted
56
+ if ( YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' ) {
57
58
if( is_singular() && is_main_query() ) {
59
64
}
65
66
//If page are excluted
67
+ else {
68
69
if( is_singular() && is_main_query() && !is_page() )
70
74
75
} // End if YASR_SHOW_OVERALL_IN_LOOP === 'disabled') {
76
77
+ //If overall rating in loop is enabled don't use is_singular && is main_query
78
+ elseif ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
79
80
//If pages are not excluted return always
81
+ if ( YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no' ) {
82
83
return $shortcode_html;
84
85
}
86
87
//Else if page are excluted return only if is not a page
88
+ else {
89
90
if ( !is_page() ) {
91
109
//To avoid double visualization, I will insert this only if auto insert is off or if auto insert is set on overall rating.
110
//If auto insert is on visitor rating this shortcode must return nothing
111
112
$shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
113
114
if( is_singular() && is_main_query() ) {
405
406
} //End if is singular
407
408
409
} //End function shortcode_visitor_votes_callback
410
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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
Tested up to: 4.0
6
- Stable tag: 0.5.1
7
License: GPL2
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -83,6 +83,9 @@ Of course not: you can easily add it on the visual editor just by clicking on th
83
84
== Changelog ==
85
86
= 0.5.1 =
87
* Added support for wordpress 4.0
88
* Huge code cleanup in [yasr_visitor_votes]
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
Tested up to: 4.0
6
+ Stable tag: 0.5.2
7
License: GPL2
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
83
84
== Changelog ==
85
86
+ = 0.5.2 =
87
+ * Bugfixes
88
+
89
= 0.5.1 =
90
* Added support for wordpress 4.0
91
* Huge code cleanup in [yasr_visitor_votes]
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.5.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.5.1');
32
33
//Plugin absolute path
34
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
@@ -130,6 +130,10 @@ if ( YASR_AUTO_INSERT_ENABLED == 1 ) {
130
131
}
132
133
define ("YASR_SHOW_OVERALL_IN_LOOP", $stored_options['show_overall_in_loop']);
134
define ("YASR_TEXT_BEFORE_STARS", $stored_options['text_before_stars']);
135
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.5.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.5.2');
32
33
//Plugin absolute path
34
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
130
131
}
132
133
+ else {
134
+ define ("YASR_AUTO_INSERT_EXCLUDE_PAGES", "yes"); //Avoide undefined variable in yasr-shortcode-function line 56 and 81
135
+ }
136
+
137
define ("YASR_SHOW_OVERALL_IN_LOOP", $stored_options['show_overall_in_loop']);
138
define ("YASR_TEXT_BEFORE_STARS", $stored_options['text_before_stars']);
139