Yasr – Yet Another Stars Rating - Version 0.4.4

Version Description

  • Code cleanup on chart Top 10 by visitors: on first load load it should be about 30% faster
  • Showing a spinning image while chart Top 10 by visitors is loading
Download this release

Release Info

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

Code changes from version 0.4.3 to 0.4.4

css/yasr-table-dark.css CHANGED
@@ -44,6 +44,13 @@
44
background: #161616;
45
}
46
47
48
.yasr-most-or-highest-rated-posts {
49
color: #ffffff;
44
background: #161616;
45
}
46
47
+ #loader-most-highest-chart {
48
+ color: #ffffff;
49
+ background-color: #161616;
50
+ text-align: center;
51
+ width: 100%;
52
+ margin: 0 auto;
53
+ }
54
55
.yasr-most-or-highest-rated-posts {
56
color: #ffffff;
css/yasr-table-light.css CHANGED
@@ -44,6 +44,14 @@
44
background: #FFFFFF;
45
}
46
47
.yasr-most-or-highest-rated-posts {
48
border-spacing: 1px;
49
margin-top: 10px;
44
background: #FFFFFF;
45
}
46
47
+
48
+ #loader-most-highest-chart {
49
+ background-color: #FFFFec;
50
+ text-align: center;
51
+ width: 100%;
52
+ margin: 0 auto;
53
+ }
54
+
55
.yasr-most-or-highest-rated-posts {
56
border-spacing: 1px;
57
margin-top: 10px;
css/yasr.css CHANGED
@@ -339,13 +339,6 @@
339
340
/****** NON ADMIN RULES ******/
341
342
- .loader-visitor-rating-chart {
343
- display: none;
344
- text-align: center;
345
- width: 50%;
346
- margin: 0 auto;
347
- }
348
-
349
.yasr_schema{
350
font-size: small;
351
}
339
340
/****** NON ADMIN RULES ******/
341
342
.yasr_schema{
343
font-size: small;
344
}
lib/yasr-shortcode-functions.php CHANGED
@@ -692,114 +692,72 @@ add_shortcode ('yasr_most_or_highest_rated_posts', 'yasr_most_or_highest_rated_p
692
693
function yasr_most_or_highest_rated_posts_callback () {
694
695
- $chart_type = 'most'; //default value;
696
697
- if (isset($_GET['yasr-order-by'])) {
698
699
- $chart_type = $_GET['yasr-order-by'];
700
701
- if ($chart_type != 'most' && $chart_type != 'highest') {
702
703
- $chart_type = 'most';
704
705
- }
706
-
707
- }
708
-
709
- global $wpdb;
710
-
711
- $post_url = get_permalink();
712
-
713
- if ($chart_type === 'most' ) {
714
-
715
- $query_result_most_rated = $wpdb->get_results("SELECT post_id, number_of_votes, sum_votes
716
- FROM " . YASR_VOTES_TABLE . ", $wpdb->posts AS p
717
- WHERE post_id = p.ID
718
- AND p.post_status = 'publish'
719
- ORDER BY number_of_votes DESC, sum_votes DESC LIMIT 10");
720
-
721
- if ($query_result_most_rated) {
722
-
723
- $shortcode_html = "<div class=\"yasr-most-or-highest-rated-posts\" ></div>";
724
-
725
- foreach ($query_result_most_rated as $result) {
726
-
727
- $rating = $result->sum_votes / $result->number_of_votes;
728
-
729
- $rating = round($rating, 1);
730
-
731
- $post_title = get_the_title($result->post_id);
732
-
733
- $link = get_permalink($result->post_id); //Get permalink from post it
734
735
- } //End foreach
736
737
- ?>
738
739
- <script>
740
741
- jQuery(document).ready(function() {
742
-
743
- //Link do nothing
744
- jQuery('#yasr_multi_chart_link_to_nothing').on("click", function () {
745
-
746
- return false; // prevent default click action from happening!
747
-
748
- });
749
750
- var data = {
751
- action : 'yasr_multi_chart_most_highest' //declared in yasr-ajax-functions
752
- };
753
754
- var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
755
756
- jQuery.post(ajaxurl, data, function(response) {
757
758
- jQuery('.yasr-most-or-highest-rated-posts').html(response);
759
- jQuery('.rateit').rateit();
760
761
- //By default, hide the highest rated chart
762
- jQuery('.yasr-highest-rated-posts').hide();
763
764
- //On click on highest, hide most and show highest
765
- jQuery('#yasr_multi_chart_highest').on("click", function () {
766
767
- jQuery('.yasr-most-rated-posts').hide();
768
-
769
- jQuery('.yasr-highest-rated-posts').show();
770
-
771
- return false; // prevent default click action from happening!
772
-
773
- });
774
775
- //Vice versa
776
- jQuery('#yasr_multi_chart_most').on("click", function () {
777
778
- jQuery('.yasr-highest-rated-posts').hide();
779
780
- jQuery('.yasr-most-rated-posts').show();
781
782
- return false; // prevent default click action from happening!
783
784
- });
785
786
- });
787
788
});
789
790
- </script>
791
792
- <?php
793
794
- return $shortcode_html;
795
796
- } //end if $query_result
797
798
- else {
799
- _e("You don't have any user votes stored", "yasr");
800
- }
801
802
- }
803
804
} //End function
805
692
693
function yasr_most_or_highest_rated_posts_callback () {
694
695
+ $image = YASR_IMG_DIR . "/loader.gif";
696
697
+ $loader_html = "<div id=\"loader-most-highest-chart\" >&nbsp; " . __("Chart is loading, please wait","yasr") . " <img src= \" $image \"></div>";
698
699
+ $shortcode_html = "<div class=\"yasr-most-or-highest-rated-posts\" >" . $loader_html . "</div>";
700
701
+ ?>
702
703
+ <script>
704
705
+ jQuery(document).ready(function() {
706
707
+ //Link do nothing
708
+ jQuery('#yasr_multi_chart_link_to_nothing').on("click", function () {
709
710
+ return false; // prevent default click action from happening!
711
712
+ });
713
714
+ var data = {
715
+ action : 'yasr_multi_chart_most_highest' //declared in yasr-ajax-functions
716
+ };
717
718
+ var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
719
720
+ jQuery.post(ajaxurl, data, function(response) {
721
722
+ jQuery('.yasr-most-or-highest-rated-posts').html(response);
723
+ jQuery('.rateit').rateit();
724
725
+ //By default, hide the highest rated chart
726
+ jQuery('.yasr-highest-rated-posts').hide();
727
728
+ //On click on highest, hide most and show highest
729
+ jQuery('#yasr_multi_chart_highest').on("click", function () {
730
731
+ jQuery('.yasr-most-rated-posts').hide();
732
733
+ jQuery('.yasr-highest-rated-posts').show();
734
735
+ return false; // prevent default click action from happening!
736
737
+ });
738
739
+ //Vice versa
740
+ jQuery('#yasr_multi_chart_most').on("click", function () {
741
742
+ jQuery('.yasr-highest-rated-posts').hide();
743
744
+ jQuery('.yasr-most-rated-posts').show();
745
746
+ return false; // prevent default click action from happening!
747
748
});
749
750
+ });
751
752
+ });
753
754
755
+ </script>
756
757
+ <?php
758
+
759
+ return $shortcode_html;
760
761
762
} //End function
763
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, Schema.org, Serp
4
Requires at least: 3.5
5
Tested up to: 3.9.1
6
- Stable tag: 0.4.3
7
License: GPL2
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -73,9 +73,16 @@ Of course not: you can easily add it on the visual editor just by clicking on th
73
== Screenshots ==
74
1. Example of yasr in a videogame review
75
2. Another example of a restaurant review
76
77
== Changelog ==
78
79
= 0.4.3 =
80
* Chart Top 10 by visitors have been rewritten. Now it's much much faster
81
* Added text on chart Top 10 overall ratings
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, Schema.org, Serp
4
Requires at least: 3.5
5
Tested up to: 3.9.1
6
+ Stable tag: 0.4.4
7
License: GPL2
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
73
== Screenshots ==
74
1. Example of yasr in a videogame review
75
2. Another example of a restaurant review
76
+ 3. Chart Top 10 by visitors showing most rated posts
77
+ 4. Chart Top 10 by visitors showing highest rated posts
78
+ 5. Chart Top 10 overall ratings
79
80
== Changelog ==
81
82
+ = 0.4.4 =
83
+ * Code cleanup on chart Top 10 by visitors: on first load load it should be about 30% faster
84
+ * Showing a spinning image while chart Top 10 by visitors is loading
85
+
86
= 0.4.3 =
87
* Chart Top 10 by visitors have been rewritten. Now it's much much faster
88
* Added text on chart Top 10 overall ratings
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.4.3
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.4.3');
32
33
//Plugin absolute path
34
define( "YASR_ABSOLUTE_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.4.4
7
* Author: Dario Curvino
8
* Author URI: http://profiles.wordpress.org/dudo/
9
* License: GPL2
28
*/
29
30
31
+ define('YASR_VERSION_NUM', '0.4.4');
32
33
//Plugin absolute path
34
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );