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 | 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 +11 -7
- css/yasr-table-dark.css +1 -0
- css/yasr-table-light.css +1 -0
- css/yasr.css +2 -1
- js/yasr-admin.js +48 -0
- js/yasr-front.js +5 -7
- lib/yasr-ajax-functions.php +197 -44
- lib/yasr-db-functions.php +206 -63
- lib/yasr-functions.php +1 -1
- lib/yasr-shortcode-functions.php +12 -13
- readme.txt +8 -1
- yet-another-stars-rating.php +2 -2
css/yasr-admin.css
CHANGED
@@ -505,7 +505,7 @@ div.bigstars .rateit-selected
|
|
505 |
|
506 |
|
507 |
|
508 |
-
|
509 |
width: 98%;
|
510 |
}
|
511 |
|
@@ -515,13 +515,13 @@ div.bigstars .rateit-selected
|
|
515 |
padding-bottom: 20px;
|
516 |
}
|
517 |
|
518 |
-
|
519 |
list-style-type: none;
|
520 |
display: inline-block;
|
521 |
float:left;
|
522 |
}
|
523 |
|
524 |
-
|
525 |
padding-left: 37px;
|
526 |
}
|
527 |
|
@@ -529,20 +529,24 @@ div.bigstars .rateit-selected
|
|
529 |
color: red;
|
530 |
}
|
531 |
|
532 |
-
#yasr-log-
|
|
|
|
|
|
|
|
|
533 |
color: #2683AE;
|
534 |
}
|
535 |
|
536 |
-
|
537 |
padding-top: 5px;
|
538 |
}
|
539 |
|
540 |
-
|
541 |
float:left;
|
542 |
padding-left: 5px;
|
543 |
}
|
544 |
|
545 |
-
|
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:
|
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,
|
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 |
-
//
|
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 &&
|
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
|
834 |
$avatar
|
835 |
</div>
|
836 |
|
837 |
-
<div
|
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
|
842 |
|
843 |
-
<span
|
844 |
|
845 |
-
<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 |
-
|
|
|
|
|
858 |
|
859 |
-
|
860 |
|
861 |
-
|
862 |
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
|
871 |
-
|
872 |
-
|
873 |
|
|
|
|
|
874 |
}
|
875 |
-
|
|
|
|
|
876 |
}
|
877 |
|
878 |
-
|
879 |
|
880 |
-
|
881 |
|
882 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
883 |
|
884 |
-
|
|
|
|
|
885 |
|
886 |
-
|
|
|
|
|
887 |
|
888 |
-
if ($start_for <= 0) {
|
889 |
-
$start_for = 1;
|
890 |
}
|
891 |
|
892 |
-
|
893 |
|
894 |
-
if ($
|
895 |
-
|
896 |
}
|
897 |
|
898 |
-
|
899 |
-
|
900 |
}
|
901 |
|
902 |
-
|
903 |
|
904 |
-
|
905 |
-
|
906 |
-
|
|
|
|
|
|
|
|
|
907 |
|
908 |
-
|
909 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
910 |
}
|
911 |
|
912 |
-
}
|
913 |
|
914 |
-
|
915 |
|
916 |
-
if ($page_num != $num_of_pages && $page_num != $num_of_page_less_one) {
|
917 |
-
echo "... <button class=\"yasr-log-page-num\" value=\"$num_of_pages\">Last »</button> ";
|
918 |
}
|
919 |
|
920 |
-
|
921 |
|
922 |
-
|
|
|
|
|
|
|
|
|
923 |
|
924 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
925 |
|
926 |
</div>
|
927 |
|
928 |
-
|
929 |
|
930 |
-
|
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) ";
|
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> ";
|
872 |
+
}
|
873 |
|
874 |
+
else {
|
875 |
+
echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button> ";
|
876 |
|
877 |
+
}
|
878 |
+
|
879 |
}
|
880 |
+
|
881 |
+
echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\"> <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\">« First </button> ... ";
|
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> ";
|
907 |
+
}
|
908 |
|
909 |
+
else {
|
910 |
+
echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button> ";
|
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 "... <button class=\"yasr-log-page-num\" value=\"$num_of_pages\">Last »</button> ";
|
919 |
}
|
920 |
|
921 |
+
echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\" > <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) ";
|
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> ";
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
else {
|
1025 |
+
echo "<button class=\"yasr-user-log-page-num\" value=\"$i\">$i</button> ";
|
1026 |
+
|
1027 |
+
}
|
1028 |
+
|
1029 |
}
|
1030 |
|
|
|
1031 |
|
1032 |
+
echo "<span id=\"yasr-loader-user-log-metabox\" style=\"display:none;\"> <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\">« First </button> ... ";
|
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> ";
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
else {
|
1061 |
+
echo "<button class=\"yasr-user-log-page-num\" value=\"$i\">$i</button> ";
|
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 "... <button class=\"yasr-user-log-page-num\" value=\"$num_of_pages\">Last »</button> ";
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
echo "<span id=\"yasr-user-log-container\" style=\"display:none;\" > <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
|
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 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
|
310 |
}
|
311 |
|
312 |
|
313 |
-
function
|
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 |
-
|
331 |
-
|
332 |
-
|
333 |
|
334 |
-
|
335 |
-
|
336 |
|
337 |
-
|
338 |
-
|
339 |
|
340 |
-
|
341 |
|
342 |
-
|
343 |
|
344 |
-
|
345 |
-
|
346 |
|
347 |
-
|
348 |
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
|
361 |
-
|
362 |
|
363 |
-
|
364 |
|
365 |
-
|
366 |
|
367 |
-
|
368 |
|
369 |
-
|
|
|
|
|
370 |
|
371 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
-
|
|
|
|
|
376 |
|
377 |
-
|
378 |
|
379 |
-
|
380 |
|
381 |
-
|
382 |
|
383 |
-
|
384 |
-
|
385 |
-
for ($i=1; $i<=$num_of_pages; $i++) {
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
|
391 |
-
|
392 |
-
|
|
|
393 |
|
394 |
}
|
395 |
|
|
|
|
|
|
|
|
|
396 |
}
|
397 |
|
398 |
-
echo "
|
399 |
|
400 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
|
402 |
-
else {
|
403 |
|
404 |
-
|
|
|
|
|
405 |
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
|
408 |
-
|
409 |
-
|
410 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
|
412 |
-
else {
|
413 |
-
echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button> ";
|
414 |
}
|
415 |
|
|
|
|
|
416 |
}
|
417 |
|
418 |
-
|
419 |
|
420 |
-
|
421 |
|
422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
|
424 |
-
|
425 |
|
426 |
-
|
|
|
|
|
|
|
|
|
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) ";
|
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> ";
|
400 |
+
}
|
401 |
+
|
402 |
+
else {
|
403 |
+
echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button> ";
|
404 |
|
405 |
+
}
|
406 |
+
|
407 |
+
}
|
408 |
|
409 |
+
echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\"> <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> ";
|
419 |
+
}
|
420 |
|
421 |
+
else {
|
422 |
+
echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button> ";
|
423 |
+
}
|
424 |
|
425 |
}
|
426 |
|
427 |
+
echo "... <button class=\"yasr-log-pagenum\" id=\"yasr-log-total-pages\" value=\"$num_of_pages\">Last »</button> ";
|
428 |
+
|
429 |
+
echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\"> <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) ";
|
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> ";
|
533 |
+
}
|
534 |
+
|
535 |
+
else {
|
536 |
+
echo "<button class=\"yasr-user-log-pagenum\" value=\"$i\">$i</button> ";
|
537 |
+
|
538 |
+
}
|
539 |
|
|
|
|
|
540 |
}
|
541 |
|
542 |
+
echo "<span id=\"yasr-loader-user-log-metabox\" style=\"display:none;\"> <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> ";
|
552 |
+
}
|
553 |
+
|
554 |
+
else {
|
555 |
+
echo "<button class=\"yasr-user-log-pagenum\" value=\"$i\">$i</button> ";
|
556 |
+
}
|
557 |
+
|
558 |
+
}
|
559 |
+
|
560 |
+
echo "... <button class=\"yasr-user-log-pagenum\" id=\"yasr-user-log-total-pages\" value=\"$num_of_pages\">Last »</button> ";
|
561 |
|
562 |
+
echo "<span id=\"yasr-loader-user-log-metabox\" style=\"display:none;\"> <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
|
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
|
212 |
|
213 |
}
|
214 |
|
215 |
else {
|
216 |
|
217 |
-
$span_after_rate_it="<span class=\"yasr-small-block-bold
|
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
|
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') .": <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 " . __("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') .": <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 " . __("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') .": <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 " . __("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') .": <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 " . __("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.
|
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.
|
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.
|
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__) );
|