Yasr – Yet Another Stars Rating - Version 1.1.3

Version Description

  • NEW FEATURE: New widget in the dashboard: all the logged in user can now see the logs of their votes
  • FIXED: Insert new vote instead of update the old one if a logged in user try to vote an already rated post on archive pages
  • TWEAKED: Speed improvment on dashboard widget
  • TWEAKED: added html class on rankings
  • TWEAKED: improved feature with the user reviews extension
Download this release

Release Info

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

Code changes from version 1.1.2 to 1.1.3

css/yasr-admin.css CHANGED
@@ -505,7 +505,7 @@ div.bigstars .rateit-selected
505
506
507
508
- #yasr-log-container {
509
width: 98%;
510
}
511
@@ -515,13 +515,13 @@ div.bigstars .rateit-selected
515
padding-bottom: 20px;
516
}
517
518
- #yasr-log-image {
519
list-style-type: none;
520
display: inline-block;
521
float:left;
522
}
523
524
- #yasr-log-child-head {
525
padding-left: 37px;
526
}
527
@@ -529,20 +529,24 @@ div.bigstars .rateit-selected
529
color: red;
530
}
531
532
- #yasr-log-post {
533
color: #2683AE;
534
}
535
536
- #yasr-log-ip-date {
537
padding-top: 5px;
538
}
539
540
- #yasr-log-ip {
541
float:left;
542
padding-left: 5px;
543
}
544
545
- #yasr-log-date {
546
float: right;
547
}
548
505
506
507
508
+ .yasr-log-container {
509
width: 98%;
510
}
511
515
padding-bottom: 20px;
516
}
517
518
+ .yasr-log-image {
519
list-style-type: none;
520
display: inline-block;
521
float:left;
522
}
523
524
+ .yasr-log-child-head {
525
padding-left: 37px;
526
}
527
529
color: red;
530
}
531
532
+ #yasr-log-vote-users {
533
+ color: green;
534
+ }
535
+
536
+ .yasr-log-post {
537
color: #2683AE;
538
}
539
540
+ .yasr-log-ip-date {
541
padding-top: 5px;
542
}
543
544
+ .yasr-log-ip {
545
float:left;
546
padding-left: 5px;
547
}
548
549
+ .yasr-log-date {
550
float: right;
551
}
552
css/yasr-table-dark.css CHANGED
@@ -36,6 +36,7 @@
36
.yasr-table-chart td {
37
padding: 8px;
38
width: 50%;
39
}
40
41
.yasr-table-chart tr:nth-child(odd) {
36
.yasr-table-chart td {
37
padding: 8px;
38
width: 50%;
39
+ vertical-align: middle;
40
}
41
42
.yasr-table-chart tr:nth-child(odd) {
css/yasr-table-light.css CHANGED
@@ -35,6 +35,7 @@
35
.yasr-table-chart td {
36
padding: 8px;
37
width: 50%;
38
}
39
40
.yasr-table-chart tr:nth-child(odd) {
35
.yasr-table-chart td {
36
padding: 8px;
37
width: 50%;
38
+ vertical-align: middle;
39
}
40
41
.yasr-table-chart tr:nth-child(odd) {
css/yasr.css CHANGED
@@ -85,6 +85,7 @@
85
}
86
87
88
/*** RTL RULES, thank's to Arik Numlock ***/
89
90
.rateit .rateit-hover.rateit-hover-rtl, .rateit .rateit-selected.rateit-selected-rtl {
@@ -95,7 +96,7 @@
95
-webkit-transform: scaleX(-1);
96
transform: scaleX(-1);
97
filter: FlipH;
98
- -ms-filter: FlipH”;
99
right: 0;
100
left: auto;
101
85
}
86
87
88
+
89
/*** RTL RULES, thank's to Arik Numlock ***/
90
91
.rateit .rateit-hover.rateit-hover-rtl, .rateit .rateit-selected.rateit-selected-rtl {
96
-webkit-transform: scaleX(-1);
97
transform: scaleX(-1);
98
filter: FlipH;
99
+ -ms-filter: "FlipH";
100
right: 0;
101
left: auto;
102
js/yasr-admin.js CHANGED
@@ -758,6 +758,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
758
var data = {
759
action : 'yasr_change_log_page',
760
pagenum: jQuery(this).val(),
761
762
};
763
@@ -777,6 +778,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
777
var data = {
778
action : 'yasr_change_log_page',
779
pagenum: jQuery(this).val(),
780
};
781
782
jQuery.post(ajaxurl, data, function(response) {
@@ -789,4 +791,50 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
789
790
});
791
792
/****** End yasr db functions ******/
758
var data = {
759
action : 'yasr_change_log_page',
760
pagenum: jQuery(this).val(),
761
+ totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
762
763
};
764
778
var data = {
779
action : 'yasr_change_log_page',
780
pagenum: jQuery(this).val(),
781
+ totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
782
};
783
784
jQuery.post(ajaxurl, data, function(response) {
791
792
});
793
794
+
795
+
796
+ //Vote user log
797
+ jQuery(document).ready(function() {
798
+
799
+ //Log
800
+ jQuery('.yasr-user-log-pagenum').on('click', function() {
801
+
802
+ jQuery('#yasr-loader-user-log-metabox').show();
803
+
804
+ var data = {
805
+ action : 'yasr_change_user_log_page',
806
+ pagenum: jQuery(this).val(),
807
+ totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-user-log-total-pages')
808
+
809
+ };
810
+
811
+ jQuery.post(ajaxurl, data, function(response) {
812
+ jQuery('#yasr-loader-log-metabox').hide();
813
+ jQuery('#yasr-user-log-container').html(response);
814
+ });
815
+
816
+ });
817
+
818
+ jQuery(document).ajaxComplete(function() {
819
+
820
+ jQuery('.yasr-user-log-page-num').on('click', function() {
821
+
822
+ jQuery('#yasr-loader-user-log-metabox').show();
823
+
824
+ var data = {
825
+ action : 'yasr_change_user_log_page',
826
+ pagenum: jQuery(this).val(),
827
+ totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-user-log-total-pages')
828
+ };
829
+
830
+ jQuery.post(ajaxurl, data, function(response) {
831
+ jQuery('#yasr-user-log-container').html(response); //This will hide the loader gif too
832
+ });
833
+
834
+ });
835
+
836
+ });
837
+
838
+ });
839
+
840
/****** End yasr db functions ******/
js/yasr-front.js CHANGED
@@ -3,7 +3,7 @@
3
4
yasrCommonData (postid, ajaxurl, loggedUser, visitorStatsEnabled, loaderHtml, tooltipValues)
5
6
- yasrVisitorsVotesData (, postid, starSize, voteIfUserAlredyRated, nonceVisitor, )
7
8
yasrMultiSetData (setType, nonce)
9
@@ -44,11 +44,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
44
45
jQuery('.rateit').bind('over', function (event, value) { jQuery(this).attr('title', yasrCommonData.tooltipValues[value-1]); });
46
47
- //Should be useless from version 0.7.9, just to be safe
48
- if (yasrVisitorsVotesData.voteIfUserAlredyRated == "0" ) {
49
- yasrVisitorsVotesData.voteIfUserAlredyRated = false;
50
- }
51
-
52
jQuery('.rateit').on('rated', function() {
53
54
var el = jQuery(this);
@@ -58,6 +54,8 @@ document.addEventListener('DOMContentLoaded', function(event) {
58
var postid = jQuery( this ).data('postid');
59
var classSize = jQuery( this ).attr('class');
60
61
if (value < 1) {
62
jQuery('#yasr_visitor_votes_' + postid).html('You can\'t vote 0');
63
}
@@ -67,7 +65,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
67
jQuery('#yasr_visitor_votes_' + postid).html(yasrCommonData.loaderHtml);
68
69
//If logged in user and has already rated for a post/page update the vote
70
- if (yasrCommonData.loggedUser && yasrVisitorsVotesData.voteIfUserAlredyRated) {
71
72
var data = {
73
action: 'yasr_update_visitor_rating',
3
4
yasrCommonData (postid, ajaxurl, loggedUser, visitorStatsEnabled, loaderHtml, tooltipValues)
5
6
+ yasrVisitorsVotesData (, postid, starSize, nonceVisitor, )
7
8
yasrMultiSetData (setType, nonce)
9
44
45
jQuery('.rateit').bind('over', function (event, value) { jQuery(this).attr('title', yasrCommonData.tooltipValues[value-1]); });
46
47
+ //on vote...
48
jQuery('.rateit').on('rated', function() {
49
50
var el = jQuery(this);
54
var postid = jQuery( this ).data('postid');
55
var classSize = jQuery( this ).attr('class');
56
57
+ var voteIfUserAlredyRated = jQuery('#yasr-user-vote-'+postid).data('yasr-already-voted');
58
+
59
if (value < 1) {
60
jQuery('#yasr_visitor_votes_' + postid).html('You can\'t vote 0');
61
}
65
jQuery('#yasr_visitor_votes_' + postid).html(yasrCommonData.loaderHtml);
66
67
//If logged in user and has already rated for a post/page update the vote
68
+ if (yasrCommonData.loggedUser && voteIfUserAlredyRated) {
69
70
var data = {
71
action: 'yasr_update_visitor_rating',
lib/yasr-ajax-functions.php CHANGED
@@ -786,6 +786,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
786
if (isset($_POST['pagenum'])) {
787
788
$page_num = $_POST['pagenum'];
789
790
}
791
@@ -830,19 +831,19 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
830
831
<div class=\"yasr-log-div-child\">
832
833
- <div id=\"yasr-log-image\">
834
$avatar
835
</div>
836
837
- <div id=\"yasr-log-child-head\">
838
<span id=\"yasr-log-vote\">$yasr_log_vote_text<span id=\"yasr-log-post\"><a href=\"$link\"> $title_post</a></span>
839
</div>
840
841
- <div id=\"yasr-log-ip-date\">
842
843
- <span id=\"yasr-log-ip\">" . __("Ip address" , 'yet-another-stars-rating') . ": <span style=\"color:blue\">$column->ip</span></span>
844
845
- <span id=\"yasr-log-date\">$column->date</span>
846
847
</div>
848
@@ -854,80 +855,231 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
854
855
echo "<div id=\"yasr-log-page-navigation\">";
856
857
- $wpdb->get_results ("SELECT id FROM " . YASR_LOG_TABLE );
858
859
- $n_rows = $wpdb->num_rows; //Number of rows in YASR LOG TABLE
860
861
- $num_of_pages = ceil($n_rows/$limit); //Number of page
862
863
- if ($num_of_pages <= 3) {
864
-
865
- for ($i=1; $i<=$num_of_pages; $i++) {
866
867
- if ($i == $page_num) {
868
- echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
869
- }
870
871
- else {
872
- echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
873
874
}
875
-
876
}
877
878
- echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
879
880
- }
881
882
- else {
883
884
- _e("Pages", 'yet-another-stars-rating'); echo ": ($num_of_pages) &nbsp;&nbsp;&nbsp;";
885
886
- $start_for = $page_num - 1;
887
888
- if ($start_for <= 0) {
889
- $start_for = 1;
890
}
891
892
- $end_for = $page_num + 1;
893
894
- if ($end_for >= $num_of_pages) {
895
- $end_for = $num_of_pages;
896
}
897
898
- if ($page_num >= 3) {
899
- echo "<button class=\"yasr-log-page-num\" value=\"1\">&laquo; First </button>&nbsp;&nbsp;...&nbsp;&nbsp;";
900
}
901
902
- for ($i=$start_for; $i<=$end_for; $i++) {
903
904
- if ($i == $page_num) {
905
- echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
906
- }
907
908
- else {
909
- echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
910
}
911
912
- }
913
914
- $num_of_page_less_one = $num_of_pages-1;
915
916
- if ($page_num != $num_of_pages && $page_num != $num_of_page_less_one) {
917
- echo "...&nbsp;&nbsp;<button class=\"yasr-log-page-num\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
918
}
919
920
- echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\" >&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
921
922
- }
923
924
- echo "
925
926
</div>
927
928
- </div>";
929
930
- } // End else if !$log result
931
932
die();
933
@@ -1152,6 +1304,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
1152
add_action( 'wp_ajax_nopriv_yasr_update_visitor_rating', 'yasr_update_visitor_rating_callback' );
1153
1154
function yasr_update_visitor_rating_callback () {
1155
if(isset($_POST['rating']) && isset($_POST['post_id']) && isset($_POST['size']) && isset($_POST['nonce_visitor']) ) {
1156
$new_rating = $_POST['rating'];
1157
$post_id = $_POST['post_id'];
786
if (isset($_POST['pagenum'])) {
787
788
$page_num = $_POST['pagenum'];
789
+ $num_of_pages = $_POST['totalpages'];
790
791
}
792
831
832
<div class=\"yasr-log-div-child\">
833
834
+ <div class=\"yasr-log-image\">
835
$avatar
836
</div>
837
838
+ <div class=\"yasr-log-child-head\">
839
<span id=\"yasr-log-vote\">$yasr_log_vote_text<span id=\"yasr-log-post\"><a href=\"$link\"> $title_post</a></span>
840
</div>
841
842
+ <div class=\"yasr-log-ip-date\">
843
844
+ <span class=\"yasr-log-ip\">" . __("Ip address" , 'yet-another-stars-rating') . ": <span style=\"color:blue\">$column->ip</span></span>
845
846
+ <span class=\"yasr-log-date\">$column->date</span>
847
848
</div>
849
855
856
echo "<div id=\"yasr-log-page-navigation\">";
857
858
+ //use data attribute instead of value of #yasr-log-total-pages, because, on ajaxresponse,
859
+ //the "last" button coul not exists
860
+ echo "<span id=\"yasr-log-total-pages\" data-yasr-log-total-pages=\"$num_of_pages\">";
861
862
+ _e("Pages", 'yet-another-stars-rating'); echo ": ($num_of_pages) &nbsp;&nbsp;&nbsp;";
863
864
+ echo "</span>";
865
866
+ if ($num_of_pages <= 3) {
867
+
868
+ for ($i=1; $i<=$num_of_pages; $i++) {
869
870
+ if ($i == $page_num) {
871
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
872
+ }
873
874
+ else {
875
+ echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
876
877
+ }
878
+
879
}
880
+
881
+ echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
882
+
883
}
884
885
+ else {
886
887
+ $start_for = $page_num - 1;
888
889
+ if ($start_for <= 0) {
890
+ $start_for = 1;
891
+ }
892
+
893
+ $end_for = $page_num + 1;
894
+
895
+ if ($end_for >= $num_of_pages) {
896
+ $end_for = $num_of_pages;
897
+ }
898
+
899
+ if ($page_num >= 3) {
900
+ echo "<button class=\"yasr-log-page-num\" value=\"1\">&laquo; First </button>&nbsp;&nbsp;...&nbsp;&nbsp;";
901
+ }
902
+
903
+ for ($i=$start_for; $i<=$end_for; $i++) {
904
905
+ if ($i == $page_num) {
906
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
907
+ }
908
909
+ else {
910
+ echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
911
+ }
912
913
}
914
915
+ $num_of_page_less_one = $num_of_pages-1;
916
917
+ if ($page_num != $num_of_pages && $page_num != $num_of_page_less_one) {
918
+ echo "...&nbsp;&nbsp;<button class=\"yasr-log-page-num\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
919
}
920
921
+ echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\" >&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
922
+
923
}
924
925
+ echo "
926
927
+ </div>
928
+
929
+ </div>";
930
+
931
+ } // End else if !$log result
932
+
933
+ die();
934
935
+ }
936
+
937
+
938
+ add_action( 'wp_ajax_yasr_change_user_log_page', 'yasr_change_user_log_page_callback' );
939
+
940
+
941
+ function yasr_change_user_log_page_callback () {
942
+
943
+ if (isset($_POST['pagenum'])) {
944
+
945
+ $page_num = $_POST['pagenum'];
946
+ $num_of_pages = $_POST['totalpages'];
947
+
948
+ }
949
+
950
+ else {
951
+ $page_num = 1;
952
+ }
953
+
954
+ $limit = 8; //max number of row to echo
955
+
956
+ $offset = ( $page_num - 1 ) * $limit;
957
+
958
+ $user_id = get_current_user_id();
959
+
960
+ global $wpdb;
961
+
962
+ $log_result = $wpdb->get_results ("SELECT * FROM ". YASR_LOG_TABLE . " WHERE user_id = $user_id ORDER BY date DESC LIMIT $offset, $limit ");
963
+
964
+ if (!$log_result) {
965
+ _e("No Recenet votes yet", 'yet-another-stars-rating');
966
+ }
967
+
968
+ else {
969
+
970
+ foreach ($log_result as $column) {
971
+
972
+ $avatar = get_avatar($user_id, '32'); //Get avatar from user id
973
+
974
+ $title_post = get_the_title( $column->post_id ); //Get post title from post id
975
+ $link = get_permalink( $column->post_id ); //Get post link from post id
976
+
977
+ $yasr_log_vote_text = sprintf(__('You rated %s on ', 'yet-another-stars-rating'), '<strong style="color: blue">'.$column->vote.'</strong>');
978
+
979
+ echo "
980
+
981
+ <div class=\"yasr-log-div-child\">
982
+
983
+ <div class=\"yasr-log-image\">
984
+ $avatar
985
+ </div>
986
+
987
+ <div class=\"yasr-log-child-head\">
988
+ <span id=\"yasr-log-vote\">$yasr_log_vote_text</span><span class=\"yasr-log-post\"><a href=\"$link\">$title_post</a></span>
989
+ </div>
990
+
991
+ <div class=\"yasr-log-ip-date\">
992
+
993
+ <span class=\"yasr-log-ip\">" . __("Ip address" , 'yet-another-stars-rating') . ": <span style=\"color:blue\">$column->ip</span></span>
994
+
995
+ <span class=\"yasr-log-date\">$column->date</span>
996
+
997
+ </div>
998
+
999
+ </div>
1000
+
1001
+ ";
1002
+
1003
+ } //End foreach
1004
+
1005
+ echo "<div id=\"yasr-log-page-navigation\">";
1006
+
1007
+ //use data attribute instead of value of #yasr-log-total-pages, because, on ajaxresponse,
1008
+ //the "last" button coul not exists
1009
+ //This is required on ajax, not here, but still doing it here to take it simple
1010
+ echo "<span id=\"yasr-user-log-total-pages\" data-yasr-user-log-total-pages=\"$num_of_pages\">";
1011
+
1012
+ _e("Pages", 'yet-another-stars-rating'); echo ": ($num_of_pages) &nbsp;&nbsp;&nbsp;";
1013
+
1014
+ echo "</span>";
1015
+
1016
+ if ($num_of_pages <= 3) {
1017
+
1018
+ for ($i=1; $i<=$num_of_pages; $i++) {
1019
+
1020
+ if ($i == $page_num) {
1021
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
1022
+ }
1023
+
1024
+ else {
1025
+ echo "<button class=\"yasr-user-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
1026
+
1027
+ }
1028
+
1029
}
1030
1031
1032
+ echo "<span id=\"yasr-loader-user-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
1033
1034
}
1035
1036
+ else {
1037
1038
+ $start_for = $page_num - 1;
1039
+
1040
+ if ($start_for <= 0) {
1041
+ $start_for = 1;
1042
+ }
1043
1044
+ $end_for = $page_num + 1;
1045
+
1046
+ if ($end_for >= $num_of_pages) {
1047
+ $end_for = $num_of_pages;
1048
+ }
1049
+
1050
+ if ($page_num >= 3) {
1051
+ echo "<button class=\"yasr-user-log-page-num\" value=\"1\">&laquo; First </button>&nbsp;&nbsp;...&nbsp;&nbsp;";
1052
+ }
1053
+
1054
+ for ($i=$start_for; $i<=$end_for; $i++) {
1055
+
1056
+ if ($i == $page_num) {
1057
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
1058
+ }
1059
+
1060
+ else {
1061
+ echo "<button class=\"yasr-user-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
1062
+ }
1063
+
1064
+ }
1065
+
1066
+ $num_of_page_less_one = $num_of_pages-1;
1067
+
1068
+ if ($page_num != $num_of_pages && $page_num != $num_of_page_less_one) {
1069
+ echo "...&nbsp;&nbsp;<button class=\"yasr-user-log-page-num\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
1070
+ }
1071
+
1072
+ echo "<span id=\"yasr-user-log-container\" style=\"display:none;\" >&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
1073
+
1074
+ }
1075
+
1076
+ echo "
1077
1078
</div>
1079
1080
+ </div>";
1081
1082
+ } // End else if !$log result
1083
1084
die();
1085
1304
add_action( 'wp_ajax_nopriv_yasr_update_visitor_rating', 'yasr_update_visitor_rating_callback' );
1305
1306
function yasr_update_visitor_rating_callback () {
1307
+
1308
if(isset($_POST['rating']) && isset($_POST['post_id']) && isset($_POST['size']) && isset($_POST['nonce_visitor']) ) {
1309
$new_rating = $_POST['rating'];
1310
$post_id = $_POST['post_id'];
lib/yasr-db-functions.php CHANGED
@@ -287,37 +287,43 @@ function yasr_get_visitor_votes ($post_id_referenced=FALSE) {
287
288
289
290
- /****** Adding log's widget to the dashboard ******/
291
292
add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
293
294
function add_action_dashboard_widget_log() {
295
296
if ( current_user_can( 'manage_options' ) ) {
297
add_action ('wp_dashboard_setup', 'yasr_add_dashboard_widget_log');
298
}
299
300
}
301
302
function yasr_add_dashboard_widget_log () {
303
304
wp_add_dashboard_widget (
305
- 'yasr_widget_log_dashboard', //slug for widget
306
- 'Recent Ratings', //widget name
307
- 'yasr_display_dashboard_log_wiget' //function callback
308
- );
309
310
}
311
312
313
- function yasr_display_dashboard_log_wiget () {
314
315
316
$limit = 8; //max number of row to echo
317
318
global $wpdb;
319
320
- $log_result = $wpdb->get_results ("SELECT * FROM ". YASR_LOG_TABLE . " ORDER BY date DESC LIMIT 0, $limit ");
321
322
if (!$log_result) {
323
_e("No recenet votes yet", 'yet-another-stars-rating');
@@ -325,105 +331,241 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
325
326
else {
327
328
- echo "<div id=\"yasr-log-container\">";
329
330
- foreach ($log_result as $column) {
331
-
332
- $user = get_user_by( 'id', $column->user_id );
333
334
- //If ! user means that the vote are anonymous
335
- if ($user == FALSE) {
336
337
- $user = (object) array('user_login');
338
- $user->user_login = __('anonymous');
339
340
- }
341
342
- $avatar = get_avatar($column->user_id, '32');
343
344
- $title_post = get_the_title( $column->post_id );
345
- $link = get_permalink( $column->post_id );
346
347
- $yasr_log_vote_text = sprintf(__('Vote %d from %s on ', 'yet-another-stars-rating'), $column->vote, '<strong style="color: blue">'.$user->user_login.'</strong>' );
348
349
- echo "
350
-
351
- <div class=\"yasr-log-div-child\">
352
353
- <div id=\"yasr-log-image\">
354
- $avatar
355
- </div>
356
357
- <div id=\"yasr-log-child-head\">
358
- <span id=\"yasr-log-vote\">$yasr_log_vote_text</span><span id=\"yasr-log-post\"><a href=\"$link\">$title_post</a></span>
359
- </div>
360
361
- <div id=\"yasr-log-ip-date\">
362
363
- <span id=\"yasr-log-ip\">" . __("Ip address" , 'yet-another-stars-rating') . ": <span style=\"color:blue\">$column->ip</span></span>
364
365
- <span id=\"yasr-log-date\">$column->date</span>
366
367
- </div>
368
369
- </div>
370
371
- ";
372
373
- } //End foreach
374
375
- echo "<div id=\"yasr-log-page-navigation\">";
376
377
- $wpdb->get_results ("SELECT id FROM " . YASR_LOG_TABLE );
378
379
- $n_rows = $wpdb->num_rows;
380
381
- $num_of_pages= ceil($n_rows/$limit);
382
383
- if ($num_of_pages <= 3) {
384
-
385
- for ($i=1; $i<=$num_of_pages; $i++) {
386
387
- if ($i == 1) {
388
- echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
389
- }
390
391
- else {
392
- echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
393
394
}
395
396
}
397
398
- echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
399
400
- }
401
402
- else {
403
404
- _e("Pages", 'yet-another-stars-rating'); echo ": ($num_of_pages) &nbsp;&nbsp;&nbsp;";
405
406
- for ($i=1; $i<=3; $i++) {
407
408
- if ($i == 1) {
409
- echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
410
- }
411
412
- else {
413
- echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
414
}
415
416
}
417
418
- echo "...&nbsp;&nbsp;<button class=\"yasr-log-pagenum\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
419
420
- echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
421
422
- }
423
424
- echo "
425
426
- </div>
427
428
</div>";
429
@@ -432,6 +574,7 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
432
} //End callback function
433
434
435
/****** Delete data value from yasr tabs when a post or page is deleted
436
Added since yasr 0.3.3
437
******/
287
288
289
290
+ /****** Adding logs widget to the dashboard ******/
291
292
add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
293
294
function add_action_dashboard_widget_log() {
295
296
+ //This is for the admins (show all votes in the site)
297
if ( current_user_can( 'manage_options' ) ) {
298
add_action ('wp_dashboard_setup', 'yasr_add_dashboard_widget_log');
299
}
300
301
+ //This is for all the users to see where they've voted
302
+ add_action ('wp_dashboard_setup', 'yasr_add_dashboard_widget_user_log');
303
+
304
}
305
306
function yasr_add_dashboard_widget_log () {
307
308
wp_add_dashboard_widget (
309
+ 'yasr_widget_log_dashboard', //slug for widget
310
+ 'Recent Ratings', //widget name
311
+ 'yasr_widget_log_dashboard_callback' //function callback
312
+ );
313
314
}
315
316
317
+ function yasr_widget_log_dashboard_callback () {
318
319
320
$limit = 8; //max number of row to echo
321
322
global $wpdb;
323
324
+ $log_result = $wpdb->get_results ("SELECT * FROM ". YASR_LOG_TABLE . " ORDER BY date DESC LIMIT 0, $limit");
325
+
326
+ $n_rows = $wpdb->get_var("SELECT COUNT(*) FROM ". YASR_LOG_TABLE );
327
328
if (!$log_result) {
329
_e("No recenet votes yet", 'yet-another-stars-rating');
331
332
else {
333
334
+ echo "<div class=\"yasr-log-container\" id=\"yasr-log-container\">";
335
336
+ foreach ($log_result as $column) {
337
+
338
+ $user = get_user_by( 'id', $column->user_id );
339
340
+ //If ! user means that the vote are anonymous
341
+ if ($user == FALSE) {
342
343
+ $user = (object) array('user_login');
344
+ $user->user_login = __('anonymous');
345
346
+ }
347
348
+ $avatar = get_avatar($column->user_id, '32');
349
350
+ $title_post = get_the_title( $column->post_id );
351
+ $link = get_permalink( $column->post_id );
352
353
+ $yasr_log_vote_text = sprintf(__('Vote %d from %s on ', 'yet-another-stars-rating'), $column->vote, '<strong style="color: blue">'.$user->user_login.'</strong>' );
354
355
+ echo "
356
+
357
+ <div class=\"yasr-log-div-child\">
358
359
+ <div class=\"yasr-log-image\">
360
+ $avatar
361
+ </div>
362
363
+ <div class=\"yasr-log-child-head\">
364
+ <span id=\"yasr-log-vote\">$yasr_log_vote_text</span><span class=\"yasr-log-post\"><a href=\"$link\">$title_post</a></span>
365
+ </div>
366
367
+ <div class=\"yasr-log-ip-date\">
368
369
+ <span class=\"yasr-log-ip\">" . __("Ip address" , 'yet-another-stars-rating') . ": <span style=\"color:blue\">$column->ip</span></span>
370
371
+ <span class=\"yasr-log-date\">$column->date</span>
372
373
+ </div>
374
375
+ </div>
376
+
377
+ ";
378
379
+ } //End foreach
380
+
381
+ echo "<div id=\"yasr-log-page-navigation\">";
382
+
383
+ $num_of_pages = ceil($n_rows/$limit);
384
+
385
+ //use data attribute instead of value of #yasr-log-total-pages, because, on ajaxresponse,
386
+ //the "last" button coul not exists
387
+ //This is required on ajax, not here, but still doing it here to take it simple
388
+ echo "<span id=\"yasr-log-total-pages\" data-yasr-log-total-pages=\"$num_of_pages\">";
389
+
390
+ _e("Pages", 'yet-another-stars-rating'); echo ": ($num_of_pages) &nbsp;&nbsp;&nbsp;";
391
+
392
+ echo "</span>";
393
+
394
+ if ($num_of_pages <= 3) {
395
396
+ for ($i=1; $i<=$num_of_pages; $i++) {
397
+
398
+ if ($i == 1) {
399
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
400
+ }
401
+
402
+ else {
403
+ echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
404
405
+ }
406
+
407
+ }
408
409
+ echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
410
411
+ }
412
413
+ else {
414
415
+ for ($i=1; $i<=3; $i++) {
416
417
+ if ($i == 1) {
418
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
419
+ }
420
421
+ else {
422
+ echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
423
+ }
424
425
}
426
427
+ echo "...&nbsp;&nbsp;<button class=\"yasr-log-pagenum\" id=\"yasr-log-total-pages\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
428
+
429
+ echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
430
+
431
}
432
433
+ echo "
434
435
+ </div>
436
+
437
+ </div>";
438
+
439
+ } //End else
440
+
441
+ } //End callback function
442
443
444
+ //This add a dashboard log for every users
445
+ //Add action is above
446
+ function yasr_add_dashboard_widget_user_log () {
447
448
+ wp_add_dashboard_widget (
449
+ 'yasr_users_dashboard_widget', //slug for widget
450
+ 'Your Ratings', //widget name
451
+ 'yasr_users_dashboard_widget_callback' //function callback
452
+ );
453
+
454
+ }
455
+
456
+
457
+ function yasr_users_dashboard_widget_callback () {
458
+
459
+
460
+ $limit = 8; //max number of row to echo
461
+
462
+ //Get current user id: don't need to check if is >0 cause user is logged in here
463
+ $user_id = get_current_user_id();
464
+
465
+ global $wpdb;
466
467
+ $log_result = $wpdb->get_results ("SELECT * FROM ". YASR_LOG_TABLE . " WHERE user_id = $user_id ORDER BY date DESC LIMIT 0, $limit");
468
+
469
+ $n_rows = $wpdb->get_var("SELECT COUNT(*) FROM ". YASR_LOG_TABLE . " WHERE user_id = $user_id" );
470
+
471
+ if (!$log_result) {
472
+ _e("No recenet votes yet", 'yet-another-stars-rating');
473
+ }
474
+
475
+ else {
476
+
477
+ echo "<div class=\"yasr-log-container\" id=\"yasr-user-log-container\">";
478
+
479
+ foreach ($log_result as $column) {
480
+
481
+ $avatar = get_avatar($user_id, '32');
482
+
483
+ $title_post = get_the_title( $column->post_id );
484
+ $link = get_permalink( $column->post_id );
485
+
486
+ $yasr_log_vote_text = sprintf(__('You rated %s on ', 'yet-another-stars-rating'), '<strong style="color: blue">'.$column->vote.'</strong>');
487
+
488
+ echo "
489
+
490
+ <div class=\"yasr-log-div-child\">
491
+
492
+ <div class=\"yasr-log-image\">
493
+ $avatar
494
+ </div>
495
+
496
+ <div class=\"yasr-log-child-head\">
497
+ <span id=\"yasr-log-vote\">$yasr_log_vote_text</span><span class=\"yasr-log-post\"><a href=\"$link\">$title_post</a></span>
498
+ </div>
499
+
500
+ <div class=\"yasr-log-ip-date\">
501
+
502
+ <span class=\"yasr-log-ip\">" . __("Ip address" , 'yet-another-stars-rating') . ": <span style=\"color:blue\">$column->ip</span></span>
503
+
504
+ <span class=\"yasr-log-date\">$column->date</span>
505
+
506
+ </div>
507
+
508
+ </div>
509
+
510
+ ";
511
+
512
+ } //End foreach
513
+
514
+ echo "<div id=\"yasr-log-page-navigation\">";
515
+
516
+ $num_of_pages = ceil($n_rows/$limit);
517
+
518
+ //use data attribute instead of value of #yasr-log-total-pages, because, on ajaxresponse,
519
+ //the "last" button coul not exists
520
+ //This is required on ajax, not here, but still doing it here to take it simple
521
+ echo "<span id=\"yasr-user-log-total-pages\" data-yasr-user-log-total-pages=\"$num_of_pages\">";
522
+
523
+ _e("Pages", 'yet-another-stars-rating'); echo ": ($num_of_pages) &nbsp;&nbsp;&nbsp;";
524
+
525
+ echo "</span>";
526
+
527
+ if ($num_of_pages <= 3) {
528
+
529
+ for ($i=1; $i<=$num_of_pages; $i++) {
530
+
531
+ if ($i == 1) {
532
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
533
+ }
534
+
535
+ else {
536
+ echo "<button class=\"yasr-user-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
537
+
538
+ }
539
540
}
541
542
+ echo "<span id=\"yasr-loader-user-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
543
+
544
}
545
546
+ else {
547
548
+ for ($i=1; $i<=3; $i++) {
549
550
+ if ($i == 1) {
551
+ echo "<button class=\"button-primary\" value=\"$i\">$i</button>&nbsp;&nbsp;";
552
+ }
553
+
554
+ else {
555
+ echo "<button class=\"yasr-user-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
556
+ }
557
+
558
+ }
559
+
560
+ echo "...&nbsp;&nbsp;<button class=\"yasr-user-log-pagenum\" id=\"yasr-user-log-total-pages\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
561
562
+ echo "<span id=\"yasr-loader-user-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
563
564
+ }
565
+
566
+ echo "
567
+
568
+ </div>
569
570
</div>";
571
574
} //End callback function
575
576
577
+
578
/****** Delete data value from yasr tabs when a post or page is deleted
579
Added since yasr 0.3.3
580
******/
lib/yasr-functions.php CHANGED
@@ -77,7 +77,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
77
78
global $yasr_settings_page;
79
80
- if($hook == 'index.php' || $hook == 'edit.php' || $hook == 'post.php' || $hook == 'post-new.php' || $hook == $yasr_settings_page) {
81
82
do_action('yasr_add_admin_scripts_begin');
83
77
78
global $yasr_settings_page;
79
80
+ if($hook == 'index.php' || $hook == 'edit.php' || $hook == 'post.php' || $hook == 'post-new.php' || $hook == 'edit-comments.php' || $hook == $yasr_settings_page) {
81
82
do_action('yasr_add_admin_scripts_begin');
83
lib/yasr-shortcode-functions.php CHANGED
@@ -193,7 +193,7 @@ function shortcode_visitor_votes_callback ($atts) {
193
//If user has already rated
194
if ($vote_if_user_already_rated) {
195
196
- $span_after_rate_it="<span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", 'yet-another-stars-rating') . " $vote_if_user_already_rated </span>";
197
198
}
199
@@ -208,13 +208,13 @@ function shortcode_visitor_votes_callback ($atts) {
208
209
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_CUSTOM_TEXT_USER_VOTED!='') {
210
211
- $span_after_rate_it = $span_after_rate_it="<span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . YASR_CUSTOM_TEXT_USER_VOTED . " </span>";;
212
213
}
214
215
else {
216
217
- $span_after_rate_it="<span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", 'yet-another-stars-rating') . " $cookie_value </span>";
218
219
}
220
@@ -244,7 +244,7 @@ function shortcode_visitor_votes_callback ($atts) {
244
245
if ($vote_if_user_already_rated) {
246
247
- $span_after_rate_it="<span class=\"yasr-small-block-bold\" id=\"yasr-already-voted-text\">" . __("You've already voted this article with", 'yet-another-stars-rating') . " $vote_if_user_already_rated </span>";
248
249
}
250
@@ -313,7 +313,6 @@ function shortcode_visitor_votes_callback ($atts) {
313
$shortcode_html .= "</div>";
314
315
wp_localize_script( 'yasrfront', "yasrVisitorsVotesData", array(
316
- 'voteIfUserAlredyRated' => $vote_if_user_already_rated,
317
'nonceVisitor' => $ajax_nonce_visitor
318
)
319
);
@@ -719,8 +718,8 @@ function yasr_top_ten_highest_rated_callback () {
719
$link = get_permalink($result->post_id); //Get permalink from post it
720
721
$shortcode_html .= "<tr>
722
- <td width=\"60%\"><a href=\"$link\">$post_title</a></td>
723
- <td width=\"40%\">
724
<div class=\"rateit medium\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$result->overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
725
<span class=\"yasr-highest-rated-text\">" . __("Rating", 'yet-another-stars-rating') . " $result->overall_rating </span>
726
</td>
@@ -771,7 +770,7 @@ function yasr_most_or_highest_rated_posts_callback () {
771
if ($query_result_most_rated) {
772
773
$shortcode_html .= "<table class=\"yasr-table-chart\" id=\"yasr-most-rated-posts\">
774
- <tr>
775
<th>" . __("Post / Page" , 'yet-another-stars-rating') ." </th>
776
<th>". __("Order By" , 'yet-another-stars-rating') .":&nbsp;&nbsp;<span id=\"yasr_multi_chart_link_to_nothing\">" . __("Most Rated" , 'yet-another-stars-rating') ."</span> | <a href=\"#\" id=\"yasr_multi_chart_highest\">" . __("Highest Rated" , 'yet-another-stars-rating') ."</a></th>
777
</tr>"
@@ -788,8 +787,8 @@ function yasr_most_or_highest_rated_posts_callback () {
788
$link = get_permalink($result->post_id); //Get permalink from post it
789
790
$shortcode_html .= "<tr>
791
- <td width=\"60%\"><a href=\"$link\">$post_title</a></td>
792
- <td width=\"40%\"><div id=\"yasr_visitor_votes\">
793
<div class=\"rateit medium\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
794
<br /> [" . __("Total:" , 'yet-another-stars-rating') . "$result->number_of_votes &nbsp;&nbsp;&nbsp;" . __("Average" , 'yet-another-stars-rating') . " $rating]
795
</td>
@@ -810,7 +809,7 @@ function yasr_most_or_highest_rated_posts_callback () {
810
if ($query_result_highest) {
811
812
$shortcode_html .= "<table class=\"yasr-table-chart\" id=\"yasr-highest-rated-posts\">
813
- <tr>
814
<th>" . __("Post / Page" , 'yet-another-stars-rating') ." </th>
815
<th>". __("Order By" , 'yet-another-stars-rating') .":&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_most\">". __("Most Rated" , 'yet-another-stars-rating') ."</a> | <span id=\"yasr_multi_chart_link_to_nothing\">". __("Highest Rated" , 'yet-another-stars-rating') ."</span></th>
816
</tr>";
@@ -824,8 +823,8 @@ function yasr_most_or_highest_rated_posts_callback () {
824
$link = get_permalink($result->post_id); //Get permalink from post it
825
826
$shortcode_html .= "<tr>
827
- <td width=\"60%\"><a href=\"$link\">$post_title</a></td>
828
- <td width=\"40%\"><div id=\"yasr_visitor_votes\"><div class=\"rateit medium\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
829
<br /> [" . __("Total:" , 'yet-another-stars-rating') . "$result->number_of_votes &nbsp;&nbsp;&nbsp;" . __("Average" , 'yet-another-stars-rating') . " $rating]
830
</td>
831
</tr>";
193
//If user has already rated
194
if ($vote_if_user_already_rated) {
195
196
+ $span_after_rate_it="<span class=\"yasr-small-block-bold yasr-already-voted-text \" id=\"yasr-user-vote-$post_id\" data-yasr-already-voted=\"$vote_if_user_already_rated\">" . __("You've already voted this article with", 'yet-another-stars-rating') . " $vote_if_user_already_rated </span>";
197
198
}
199
208
209
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_CUSTOM_TEXT_USER_VOTED!='') {
210
211
+ $span_after_rate_it = $span_after_rate_it="<span class=\"yasr-small-block-bold yasr-already-voted-text\">" . YASR_CUSTOM_TEXT_USER_VOTED . " </span>";;
212
213
}
214
215
else {
216
217
+ $span_after_rate_it="<span class=\"yasr-small-block-bold yasr-already-voted-text \">" . __("You've already voted this article with", 'yet-another-stars-rating') . " $cookie_value </span>";
218
219
}
220
244
245
if ($vote_if_user_already_rated) {
246
247
+ $span_after_rate_it="<span class=\"yasr-small-block-bold yasr-already-voted-text \" id=\"yasr-user-vote-$post_id\" data-yasr-already-voted=\"$vote_if_user_already_rated\">" . __("You've already voted this article with", 'yet-another-stars-rating') . " $vote_if_user_already_rated </span>";
248
249
}
250
313
$shortcode_html .= "</div>";
314
315
wp_localize_script( 'yasrfront', "yasrVisitorsVotesData", array(
316
'nonceVisitor' => $ajax_nonce_visitor
317
)
318
);
718
$link = get_permalink($result->post_id); //Get permalink from post it
719
720
$shortcode_html .= "<tr>
721
+ <td width=\"60%\" class=\"yasr-top-10-overall-left\"><a href=\"$link\">$post_title</a></td>
722
+ <td width=\"40%\" class=\"yasr-top-10-overall-right\">
723
<div class=\"rateit medium\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$result->overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
724
<span class=\"yasr-highest-rated-text\">" . __("Rating", 'yet-another-stars-rating') . " $result->overall_rating </span>
725
</td>
770
if ($query_result_most_rated) {
771
772
$shortcode_html .= "<table class=\"yasr-table-chart\" id=\"yasr-most-rated-posts\">
773
+ <tr class=\"yasr-visitor-votes-title\">
774
<th>" . __("Post / Page" , 'yet-another-stars-rating') ." </th>
775
<th>". __("Order By" , 'yet-another-stars-rating') .":&nbsp;&nbsp;<span id=\"yasr_multi_chart_link_to_nothing\">" . __("Most Rated" , 'yet-another-stars-rating') ."</span> | <a href=\"#\" id=\"yasr_multi_chart_highest\">" . __("Highest Rated" , 'yet-another-stars-rating') ."</a></th>
776
</tr>"
787
$link = get_permalink($result->post_id); //Get permalink from post it
788
789
$shortcode_html .= "<tr>
790
+ <td width=\"60%\" class=\"yasr-top-10-most-highest-left\"><a href=\"$link\">$post_title</a></td>
791
+ <td width=\"40%\" class=\"yasr-top-10-most-highest-right\"><div id=\"yasr_visitor_votes\">
792
<div class=\"rateit medium\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
793
<br /> [" . __("Total:" , 'yet-another-stars-rating') . "$result->number_of_votes &nbsp;&nbsp;&nbsp;" . __("Average" , 'yet-another-stars-rating') . " $rating]
794
</td>
809
if ($query_result_highest) {
810
811
$shortcode_html .= "<table class=\"yasr-table-chart\" id=\"yasr-highest-rated-posts\">
812
+ <tr class=\"yasr-visitor-votes-title\">
813
<th>" . __("Post / Page" , 'yet-another-stars-rating') ." </th>
814
<th>". __("Order By" , 'yet-another-stars-rating') .":&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_most\">". __("Most Rated" , 'yet-another-stars-rating') ."</a> | <span id=\"yasr_multi_chart_link_to_nothing\">". __("Highest Rated" , 'yet-another-stars-rating') ."</span></th>
815
</tr>";
823
$link = get_permalink($result->post_id); //Get permalink from post it
824
825
$shortcode_html .= "<tr>
826
+ <td width=\"60%\" class=\"yasr-top-10-most-highest-left\"><a href=\"$link\">$post_title</a></td>
827
+ <td width=\"40%\" class=\"yasr-top-10-most-highest-right\"><div id=\"yasr_visitor_votes\"><div class=\"rateit medium\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
828
<br /> [" . __("Total:" , 'yet-another-stars-rating') . "$result->number_of_votes &nbsp;&nbsp;&nbsp;" . __("Average" , 'yet-another-stars-rating') . " $rating]
829
</td>
830
</tr>";
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.4
7
- Stable tag: 1.1.2
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
@@ -110,6 +110,13 @@ Of course not: you can easily add it on the visual editor just by clicking on th
110
111
== Changelog ==
112
113
= 1.1.2 =
114
* FIXED: Yasr Stylish compatibility
115
* TWEAKED: Minor changes.
4
Requires at least: 3.5
5
Contributors: Dudo
6
Tested up to: 4.4
7
+ Stable tag: 1.1.3
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
110
111
== Changelog ==
112
113
+ = 1.1.3 =
114
+ * NEW FEATURE: New widget in the dashboard: all the logged in user can now see the logs of their votes
115
+ * FIXED: Insert new vote instead of update the old one if a logged in user try to vote an already rated post on archive pages
116
+ * TWEAKED: Speed improvment on dashboard widget
117
+ * TWEAKED: added html class on rankings
118
+ * TWEAKED: improved feature with the user reviews extension
119
+
120
= 1.1.2 =
121
* FIXED: Yasr Stylish compatibility
122
* TWEAKED: Minor changes.
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: Yet Another Stars Rating turn your WordPress into a complete review website.
6
- * Version: 1.1.2
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
35
- define('YASR_VERSION_NUM', '1.1.2');
36
37
//Plugin relative path
38
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: Yet Another Stars Rating turn your WordPress into a complete review website.
6
+ * Version: 1.1.3
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
35
+ define('YASR_VERSION_NUM', '1.1.3');
36
37
//Plugin relative path
38
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );