Version Description
- TWEAKED: Most of work have been done on making Yasr working without jquery. This is still in beta but now supports all shortcodes except "yasr_visitor_multiset" one
- TWEAKED: yasr_visitor_votes_readonly is now just a call to 'yasr_visitor_votes readonly="yes" '
- TWEAKED: Huge code cleanup
- TWEAKED: Php version required is now 5.3 instead 5.4
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.6.9 |
Comparing to | |
See all releases |
Code changes from version 1.6.8 to 1.6.9
- css/yasr.css +3 -0
- img/star_1.svg +5 -12
- img/star_2.svg +12 -0
- js/rater-js.js +6 -0
- js/yasr-front.js +386 -226
- lib/yasr-ajax-functions.php +0 -2
- lib/yasr-db-functions.php +10 -4
- lib/yasr-functions.php +0 -4
- lib/yasr-settings-functions.php +2 -2
- lib/yasr-shortcode-functions.php +245 -384
- readme.txt +12 -4
- yet-another-stars-rating.php +2 -2
css/yasr.css
CHANGED
@@ -302,6 +302,9 @@ div.bigstars .rateit-selected
|
|
302 |
text-align: center;
|
303 |
}
|
304 |
|
|
|
|
|
|
|
305 |
|
306 |
|
307 |
/*** Widgets ***/
|
302 |
text-align: center;
|
303 |
}
|
304 |
|
305 |
+
.yasr-multiset-average-text {
|
306 |
+
vertical-align: super;
|
307 |
+
}
|
308 |
|
309 |
|
310 |
/*** Widgets ***/
|
img/star_1.svg
CHANGED
@@ -1,12 +1,5 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
<
|
4 |
-
|
5 |
-
|
6 |
-
<title>star1</title>
|
7 |
-
<g id="Layer_2" data-name="Layer 2">
|
8 |
-
<g id="Layer_1-2" data-name="Layer 1">
|
9 |
-
<polygon class="cls-1" points="54.4 0 71.3 34.1 108.9 39.6 81.7 66.1 88.1 103.6 54.4 85.9 20.8 103.6 27.2 66.1 0 39.6 37.6 34.1 54.4 0"/>
|
10 |
-
</g>
|
11 |
-
</g>
|
12 |
-
</svg>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 501.28 501.28" style="enable-background:new 0 0 501.28 501.28;" xml:space="preserve" width="512px" height="512px" class=""><g><g>
|
3 |
+
<polygon style="fill:#F1CB32" points="501.28,194.37 335.26,159.33 250.64,12.27 250.64,419.77 405.54,489.01 387.56,320.29 " data-original="#FFCD00" class="active-path" data-old_color="#f1cb32"/>
|
4 |
+
<polygon style="fill:#FFDA44" points="166.02,159.33 0,194.37 113.72,320.29 95.74,489.01 250.64,419.77 250.64,12.27 " data-original="#FFDA44" class=""/>
|
5 |
+
</g></g> </svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
img/star_2.svg
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<svg
|
2 |
+
xmlns="http://www.w3.org/2000/svg" width="108.9" height="103.6" viewBox="0 0 108.9 103.6">
|
3 |
+
<defs>
|
4 |
+
<style>.cls-1{fill:#f1c947;}</style>
|
5 |
+
</defs>
|
6 |
+
<title>star1</title>
|
7 |
+
<g id="Layer_2" data-name="Layer 2">
|
8 |
+
<g id="Layer_1-2" data-name="Layer 1">
|
9 |
+
<polygon class="cls-1" points="54.4 0 71.3 34.1 108.9 39.6 81.7 66.1 88.1 103.6 54.4 85.9 20.8 103.6 27.2 66.1 0 39.6 37.6 34.1 54.4 0"/>
|
10 |
+
</g>
|
11 |
+
</g>
|
12 |
+
</svg>
|
js/rater-js.js
CHANGED
@@ -176,6 +176,11 @@
|
|
176 |
}
|
177 |
|
178 |
function setRating(value) {
|
|
|
|
|
|
|
|
|
|
|
179 |
if (typeof value !== "number" && typeof value !== "undefined") {
|
180 |
throw new Error("Value must be a number or undefined.");
|
181 |
}
|
@@ -210,6 +215,7 @@
|
|
210 |
enable: enable,
|
211 |
dispose: dispose
|
212 |
};
|
|
|
213 |
elem.addEventListener("click", onStarClick.bind(module));
|
214 |
return module;
|
215 |
};
|
176 |
}
|
177 |
|
178 |
function setRating(value) {
|
179 |
+
//Added for Yasr
|
180 |
+
if (value === -1) {
|
181 |
+
value = undefined;
|
182 |
+
}
|
183 |
+
|
184 |
if (typeof value !== "number" && typeof value !== "undefined") {
|
185 |
throw new Error("Value must be a number or undefined.");
|
186 |
}
|
215 |
enable: enable,
|
216 |
dispose: dispose
|
217 |
};
|
218 |
+
|
219 |
elem.addEventListener("click", onStarClick.bind(module));
|
220 |
return module;
|
221 |
};
|
js/yasr-front.js
CHANGED
@@ -1,378 +1,520 @@
|
|
1 |
|
2 |
/*** Constant used by yasr
|
3 |
|
4 |
-
yasrCommonData (postid, ajaxurl, loggedUser, visitorStatsEnabled, loaderHtml, tooltipValues)
|
5 |
|
6 |
yasrMultiSetData (setType, nonce)
|
7 |
|
8 |
|
9 |
***/
|
10 |
|
11 |
-
//this is the function that print the overall rating shortcode, get overall rating and starsize
|
12 |
-
function yasrOverallRatingFront (overallRating, starSize) {
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
starSize = parseInt(starSize);
|
17 |
|
18 |
-
|
19 |
-
starSize: starSize,
|
20 |
-
step: 0.1,
|
21 |
-
showToolTip: false,
|
22 |
-
rating: overallRating,
|
23 |
-
readOnly: true,
|
24 |
-
element: document.querySelector("#yasr-overall-rating-rater"),
|
25 |
-
});
|
26 |
|
27 |
-
|
28 |
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
//Convert string to boolean
|
36 |
-
if (readonly === 'true') {
|
37 |
-
readonly = true;
|
38 |
}
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
starSize: starSize,
|
47 |
-
step: 1,
|
48 |
-
showToolTip: false,
|
49 |
-
rating: mediumRating,
|
50 |
-
readOnly: readonly,
|
51 |
-
element: document.querySelector(yasrVVElementToGet),
|
52 |
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
document.getElementById('yasr_visitor_votes_' + postId).innerHTML=yasrCommonData.loaderHtml;
|
57 |
|
58 |
-
|
59 |
-
var rating = rating.toFixed(1);
|
60 |
-
//Be sure is a number and not a string
|
61 |
-
var rating = parseFloat(rating);
|
62 |
|
63 |
-
|
64 |
-
var data = {
|
65 |
-
action: 'yasr_send_visitor_rating',
|
66 |
-
rating: rating,
|
67 |
-
post_id: postId,
|
68 |
-
size: starSize,
|
69 |
-
nonce_visitor: yasrVisitorsVotesData.nonceVisitor
|
70 |
-
};
|
71 |
|
72 |
-
|
73 |
-
var dataToSend = jsObject_to_URLEncoded(data);
|
74 |
|
75 |
-
//Create a new request
|
76 |
-
var yasrVVAjaxCall = new Request(yasrCommonData.ajaxurl ,{
|
77 |
-
method: 'post',
|
78 |
-
headers: new Headers({
|
79 |
-
"Content-Type": "application/x-www-form-urlencoded"
|
80 |
-
}),
|
81 |
-
body: dataToSend
|
82 |
-
});
|
83 |
|
84 |
-
//Do the ajax call
|
85 |
-
fetch(yasrVVAjaxCall)
|
86 |
-
.then(checkResponse)
|
87 |
-
.then (function(response) {
|
88 |
-
//return the new average rating
|
89 |
-
return response.json();
|
90 |
-
})
|
91 |
|
92 |
-
|
93 |
|
94 |
-
|
95 |
|
96 |
-
|
97 |
-
starSize: starSize,
|
98 |
-
step: 1,
|
99 |
-
showToolTip: false,
|
100 |
-
rating: rating,
|
101 |
-
readOnly: true,
|
102 |
-
element: document.querySelector(yasrVVElementToGet)
|
103 |
-
});
|
104 |
|
105 |
-
|
106 |
-
.then(done)
|
107 |
-
.catch(function(err) {
|
108 |
-
console.log('Error with ajax call', err);
|
109 |
-
});
|
110 |
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
}
|
|
|
118 |
|
|
|
119 |
|
120 |
-
|
|
|
121 |
|
122 |
-
|
|
|
123 |
|
124 |
-
|
125 |
-
|
|
|
126 |
|
127 |
-
|
|
|
|
|
|
|
|
|
128 |
|
129 |
-
|
|
|
|
|
|
|
130 |
|
131 |
-
|
|
|
132 |
|
133 |
-
|
134 |
|
135 |
-
|
136 |
|
137 |
-
|
138 |
|
139 |
-
|
140 |
|
141 |
-
|
142 |
|
143 |
-
|
|
|
|
|
|
|
|
|
144 |
|
145 |
-
|
146 |
|
147 |
-
|
|
|
|
|
|
|
148 |
|
149 |
-
});
|
150 |
|
|
|
151 |
|
152 |
-
/*** Yasr visitor Votes ***/
|
153 |
|
154 |
-
|
155 |
|
156 |
-
|
|
|
157 |
|
158 |
-
|
159 |
-
|
160 |
|
161 |
-
|
162 |
-
var value = el.rateit('value');
|
163 |
-
var value = value.toFixed(1); //
|
164 |
|
165 |
-
|
166 |
-
var classSize = jQuery( this ).attr('class');
|
167 |
|
168 |
-
|
169 |
|
170 |
-
|
171 |
-
jQuery('#yasr_visitor_votes_' + postid).html('You can\'t vote 0');
|
172 |
-
}
|
173 |
|
174 |
-
|
|
|
175 |
|
176 |
-
|
177 |
|
178 |
-
|
179 |
-
action: 'yasr_send_visitor_rating',
|
180 |
-
rating: value,
|
181 |
-
post_id: postid,
|
182 |
-
size: classSize,
|
183 |
-
nonce_visitor: yasrVisitorsVotesData.nonceVisitor
|
184 |
-
};
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
|
192 |
-
}) ;
|
193 |
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
|
196 |
-
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
}
|
200 |
-
/*** End Yasr Visitor Votes ***/
|
201 |
|
|
|
202 |
|
203 |
-
|
|
|
204 |
|
205 |
-
|
206 |
-
var ratingObject = "";
|
207 |
|
208 |
-
|
209 |
-
var ratingArray = [];
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
214 |
|
215 |
-
|
216 |
-
var el = jQuery(this);
|
217 |
-
var value = el.rateit('value');
|
218 |
-
var value = value.toFixed(1);
|
219 |
-
var idField = el.attr('id');
|
220 |
|
221 |
-
|
222 |
|
223 |
-
|
224 |
-
rating: value
|
225 |
|
226 |
-
|
|
|
|
|
|
|
227 |
|
228 |
-
|
229 |
-
|
|
|
|
|
230 |
|
231 |
-
|
232 |
|
233 |
-
|
|
|
|
|
234 |
|
235 |
-
|
|
|
236 |
|
237 |
-
|
238 |
|
239 |
-
|
|
|
|
|
|
|
|
|
240 |
|
241 |
-
|
242 |
-
nonce: nonce,
|
243 |
-
post_id: postId,
|
244 |
-
rating: ratingArray,
|
245 |
-
set_type: setType
|
246 |
|
247 |
-
};
|
248 |
|
249 |
-
//Send value to the Server
|
250 |
-
jQuery.post(yasrCommonData.ajaxurl, data, function(response) {
|
251 |
-
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).text(response);
|
252 |
-
});
|
253 |
|
254 |
-
|
255 |
|
256 |
-
} //End function
|
257 |
|
|
|
|
|
258 |
|
259 |
-
|
260 |
|
261 |
-
|
262 |
-
jQuery('#yasr-highest-rated-posts').hide();
|
263 |
|
264 |
-
//On click on highest, hide most and show highest
|
265 |
-
jQuery('#link-yasr-highest-rated-posts').on("click", function () {
|
266 |
|
267 |
-
jQuery('#yasr-most-rated-posts').hide();
|
268 |
|
269 |
-
|
270 |
|
271 |
-
|
|
|
|
|
|
|
|
|
272 |
|
273 |
-
|
274 |
|
275 |
-
|
276 |
-
|
|
|
|
|
|
|
|
|
277 |
|
278 |
-
|
279 |
|
280 |
-
|
281 |
|
282 |
-
|
283 |
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
}
|
287 |
|
|
|
288 |
|
289 |
-
|
|
|
|
|
|
|
290 |
|
|
|
|
|
291 |
|
292 |
-
|
293 |
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
|
301 |
-
|
|
|
302 |
|
303 |
-
|
304 |
-
|
|
|
|
|
|
|
|
|
|
|
305 |
});
|
306 |
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
}
|
310 |
|
311 |
-
}
|
312 |
|
313 |
-
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
-
|
|
|
|
|
|
|
|
|
319 |
|
320 |
-
|
321 |
-
my: 'center bottom' ,
|
322 |
-
at: 'center top-10',
|
323 |
-
},
|
324 |
|
325 |
-
|
326 |
|
327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
|
329 |
-
|
330 |
|
331 |
-
|
332 |
-
|
333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
};
|
335 |
|
336 |
-
|
337 |
-
|
338 |
-
tipsContent(response);
|
339 |
-
});
|
340 |
|
341 |
-
|
342 |
|
343 |
-
else {
|
344 |
-
return varTipsContent;
|
345 |
}
|
346 |
|
347 |
-
}
|
348 |
-
disabled: true,
|
349 |
|
350 |
-
|
351 |
|
352 |
-
|
353 |
-
jQuery(this).tooltip('enable').tooltip('open');
|
354 |
-
jQuery('.ui-helper-hidden-accessible').children(':first').removeAttr('style');
|
355 |
-
jQuery('.ui-helper-hidden-accessible').children(':last', this).remove();
|
356 |
-
});
|
357 |
|
358 |
-
|
359 |
|
|
|
360 |
|
|
|
|
|
361 |
|
362 |
-
|
363 |
|
|
|
364 |
|
365 |
-
|
366 |
-
|
|
|
|
|
|
|
367 |
|
368 |
-
|
369 |
|
370 |
-
|
|
|
|
|
|
|
371 |
|
|
|
|
|
|
|
|
|
372 |
|
|
|
373 |
|
374 |
-
|
375 |
|
|
|
|
|
|
|
|
|
376 |
function jsObject_to_URLEncoded(element, key, list){
|
377 |
var list = list || [];
|
378 |
if(typeof(element)=='object'){
|
@@ -393,3 +535,21 @@ function checkResponse(res) {
|
|
393 |
|
394 |
return res;
|
395 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
/*** Constant used by yasr
|
3 |
|
4 |
+
yasrCommonData (postid, ajaxurl, loggedUser, visitorStatsEnabled, loaderHtml, tooltipValues, jquery_disabled')
|
5 |
|
6 |
yasrMultiSetData (setType, nonce)
|
7 |
|
8 |
|
9 |
***/
|
10 |
|
|
|
|
|
11 |
|
12 |
+
/****** Do this actions on document load ******/
|
13 |
+
document.addEventListener('DOMContentLoaded', function(event) {
|
|
|
14 |
|
15 |
+
//Functions on load for rater, only if enabled
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
if (yasrCommonData.jquery_disabled === 'yes') {
|
18 |
|
19 |
+
//At pageload, check if there is some shortcode with class yasr-rater-stars
|
20 |
+
var yasrRaterInDom = document.getElementsByClassName('yasr-rater-stars');
|
21 |
+
//If so, call the function to set the rating
|
22 |
+
if (yasrRaterInDom) {
|
23 |
|
24 |
+
//load this on everypageload
|
25 |
+
yasrSetRatingOnLoad(yasrRaterInDom);
|
26 |
|
27 |
+
}
|
28 |
+
|
29 |
+
/*var yasrMultiSetVisitorInDom = document.getElementsByClassName('yasr-multiset-visitors-rater');
|
30 |
+
|
31 |
+
if (yasrMultiSetVisitorInDom) {
|
32 |
+
|
33 |
+
yasrRaterVisitorsMultiSet (yasrMultiSetVisitorInDom)
|
34 |
+
|
35 |
+
}*/
|
36 |
|
|
|
|
|
|
|
37 |
}
|
38 |
+
|
39 |
+
|
40 |
+
//if is defined yasrVisitorsVotesData means that the shortcode is used
|
41 |
+
if (typeof yasrVisitorsVotesData !== 'undefined') {
|
42 |
+
|
43 |
+
yasrVisitorsVotes ();
|
44 |
+
|
45 |
+
if (yasrCommonData.visitorStatsEnabled == 'yes') {
|
46 |
+
|
47 |
+
yasrDrawTipsProgress ();
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
}
|
52 |
|
53 |
+
if (typeof yasrMultiSetData !== 'undefined') {
|
54 |
|
55 |
+
//yasrVisitorsMultiSet ();
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
}
|
58 |
|
59 |
+
if (typeof yasrMostHighestRanking !== 'undefined') {
|
|
|
60 |
|
61 |
+
yasrMostOrHighestRatedChart();
|
|
|
|
|
|
|
62 |
|
63 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
});
|
|
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
+
/***** Functions for rateit shortcode *****/
|
70 |
|
71 |
+
/*** Yasr visitor Votes ***/
|
72 |
|
73 |
+
function yasrVisitorsVotes () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
jQuery('.rateit').bind('over', function (event, value) { jQuery(this).attr('title', yasrCommonData.tooltipValues[value-1]); });
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
//on vote...
|
78 |
+
jQuery('.yasr_visitor_votes_stars_div').on('rated', function() {
|
79 |
+
|
80 |
+
var el = jQuery(this);
|
81 |
+
var value = el.rateit('value');
|
82 |
+
var value = value.toFixed(1); //
|
83 |
+
|
84 |
+
var postid = jQuery( this ).data('postid');
|
85 |
+
var classSize = jQuery( this ).attr('class');
|
86 |
|
87 |
+
var voteIfUserAlredyRated = jQuery('#yasr-user-vote-'+postid).data('yasr-already-voted');
|
88 |
+
|
89 |
+
if (value < 1) {
|
90 |
+
jQuery('#yasr_visitor_votes_' + postid).html('You can\'t vote 0');
|
91 |
}
|
92 |
|
93 |
+
else {
|
94 |
+
|
95 |
+
jQuery('#yasr_visitor_votes_' + postid).html(yasrCommonData.loaderHtml);
|
96 |
+
|
97 |
+
var data = {
|
98 |
+
action: 'yasr_send_visitor_rating',
|
99 |
+
rating: value,
|
100 |
+
post_id: postid,
|
101 |
+
size: classSize,
|
102 |
+
nonce_visitor: yasrVisitorsVotesData.nonceVisitor
|
103 |
+
};
|
104 |
+
|
105 |
+
//Send value to the Server
|
106 |
+
jQuery.post(yasrCommonData.ajaxurl, data, function(response) {
|
107 |
+
//response
|
108 |
+
jQuery('#yasr_visitor_votes_' + postid).html(response);
|
109 |
+
jQuery('.rateit').rateit();
|
110 |
+
|
111 |
+
}) ;
|
112 |
+
|
113 |
+
} //End else value <1
|
114 |
+
|
115 |
+
});//End function insert/update vote
|
116 |
+
|
117 |
|
118 |
}
|
119 |
+
/*** End Yasr Visitor Votes ***/
|
120 |
|
121 |
+
function yasrVisitorsMultiSet () {
|
122 |
|
123 |
+
//will have field id and vote
|
124 |
+
var ratingObject = "";
|
125 |
|
126 |
+
//an array with all the ratingonjects
|
127 |
+
var ratingArray = [];
|
128 |
|
129 |
+
var postId = yasrCommonData.postid;
|
130 |
+
var setType = yasrMultiSetData.setType;
|
131 |
+
var nonce = yasrMultiSetData.nonceVisitor;
|
132 |
|
133 |
+
jQuery('.yasr-visitor-multi-'+postId+'-'+setType).on('rated', function() {
|
134 |
+
var el = jQuery(this);
|
135 |
+
var value = el.rateit('value');
|
136 |
+
var value = value.toFixed(1);
|
137 |
+
var idField = el.attr('id');
|
138 |
|
139 |
+
ratingObject = {
|
140 |
+
field: idField,
|
141 |
+
rating: value
|
142 |
+
};
|
143 |
|
144 |
+
//creating rating array
|
145 |
+
ratingArray.push(ratingObject);
|
146 |
|
147 |
+
});
|
148 |
|
149 |
+
jQuery('#yasr-send-visitor-multiset-'+postId+'-'+setType).on('click', function() {
|
150 |
|
151 |
+
jQuery('#yasr-send-visitor-multiset-'+postId+'-'+setType).hide();
|
152 |
|
153 |
+
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).show();
|
154 |
|
155 |
+
var data = {
|
156 |
|
157 |
+
action: 'yasr_visitor_multiset_field_vote',
|
158 |
+
nonce: nonce,
|
159 |
+
post_id: postId,
|
160 |
+
rating: ratingArray,
|
161 |
+
set_type: setType
|
162 |
|
163 |
+
};
|
164 |
|
165 |
+
//Send value to the Server
|
166 |
+
jQuery.post(yasrCommonData.ajaxurl, data, function(response) {
|
167 |
+
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).text(response);
|
168 |
+
});
|
169 |
|
170 |
+
});
|
171 |
|
172 |
+
} //End function
|
173 |
|
|
|
174 |
|
175 |
+
function yasrMostOrHighestRatedChart () {
|
176 |
|
177 |
+
//By default, hide the highest rated chart
|
178 |
+
jQuery('#yasr-highest-rated-posts').hide();
|
179 |
|
180 |
+
//On click on highest, hide most and show highest
|
181 |
+
jQuery('#link-yasr-highest-rated-posts').on("click", function () {
|
182 |
|
183 |
+
jQuery('#yasr-most-rated-posts').hide();
|
|
|
|
|
184 |
|
185 |
+
jQuery('#yasr-highest-rated-posts').show();
|
|
|
186 |
|
187 |
+
return false; // prevent default click action from happening!
|
188 |
|
189 |
+
});
|
|
|
|
|
190 |
|
191 |
+
//Vice versa
|
192 |
+
jQuery('#link-yasr-most-rated-posts').on("click", function () {
|
193 |
|
194 |
+
jQuery('#yasr-highest-rated-posts').hide();
|
195 |
|
196 |
+
jQuery('#yasr-most-rated-posts').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
+
return false; // prevent default click action from happening!
|
199 |
+
|
200 |
+
});
|
201 |
+
|
202 |
+
}
|
203 |
|
|
|
204 |
|
205 |
+
/****** End Yasr shortcode page ******/
|
206 |
+
|
207 |
+
|
208 |
+
/****** Tooltip function ******/
|
209 |
+
|
210 |
+
//used in ajax page
|
211 |
+
function yasrDrawProgressBars (valueProgressbar, postId) {
|
212 |
|
213 |
+
var i = null;
|
214 |
|
215 |
+
var j = 0; //This is for the array
|
216 |
+
|
217 |
+
for (i=5; i>0; i--) {
|
218 |
+
|
219 |
+
jQuery( "#yasr-progress-bar-postid-"+postId+"-progress-bar-" + i).progressbar({
|
220 |
+
value: valueProgressbar[j]
|
221 |
+
});
|
222 |
+
|
223 |
+
j=j+1;
|
224 |
|
225 |
}
|
|
|
226 |
|
227 |
+
}
|
228 |
|
229 |
+
//used in shortcode page and ajax page
|
230 |
+
function yasrDrawTipsProgress () {
|
231 |
|
232 |
+
var varTipsContent = null;
|
|
|
233 |
|
234 |
+
jQuery('#yasr-total-average-dashicon-' + yasrCommonData.postid).tooltip({
|
|
|
235 |
|
236 |
+
position: {
|
237 |
+
my: 'center bottom' ,
|
238 |
+
at: 'center top-10',
|
239 |
+
},
|
240 |
|
241 |
+
tooltipClass: "yasr-visitors-stats-tooltip",
|
|
|
|
|
|
|
|
|
242 |
|
243 |
+
content: function(tipsContent) {
|
244 |
|
245 |
+
if (!varTipsContent) {
|
|
|
246 |
|
247 |
+
var data = {
|
248 |
+
action: 'yasr_stats_visitors_votes',
|
249 |
+
post_id: yasrCommonData.postid
|
250 |
+
};
|
251 |
|
252 |
+
jQuery.post(yasrCommonData.ajaxurl, data, function(response) {
|
253 |
+
varTipsContent = response;
|
254 |
+
tipsContent(response);
|
255 |
+
});
|
256 |
|
257 |
+
}
|
258 |
|
259 |
+
else {
|
260 |
+
return varTipsContent;
|
261 |
+
}
|
262 |
|
263 |
+
},
|
264 |
+
disabled: true,
|
265 |
|
266 |
+
});
|
267 |
|
268 |
+
jQuery('#yasr-total-average-dashicon-' + yasrCommonData.postid).on("hover", function(){
|
269 |
+
jQuery(this).tooltip('enable').tooltip('open');
|
270 |
+
jQuery('.ui-helper-hidden-accessible').children(':first').removeAttr('style');
|
271 |
+
jQuery('.ui-helper-hidden-accessible').children(':last', this).remove();
|
272 |
+
});
|
273 |
|
274 |
+
}
|
|
|
|
|
|
|
|
|
275 |
|
|
|
276 |
|
|
|
|
|
|
|
|
|
277 |
|
278 |
+
/****** End tooltipfunction ******/
|
279 |
|
|
|
280 |
|
281 |
+
// this should give support for all plugin that add content with ajax
|
282 |
+
jQuery( document ).ajaxComplete(function() {
|
283 |
|
284 |
+
jQuery('.rateit').rateit();
|
285 |
|
286 |
+
});
|
|
|
287 |
|
|
|
|
|
288 |
|
|
|
289 |
|
290 |
+
/**** ****/
|
291 |
|
292 |
+
//this is the function that print the overall rating shortcode, get overall rating and starsize
|
293 |
+
function yasrSetRaterValue (starSize, htmlId, readonly) {
|
294 |
+
//convert to be a number
|
295 |
+
//rating = parseFloat(rating);
|
296 |
+
starSize = parseInt(starSize);
|
297 |
|
298 |
+
readonly = yasrReadonlyConvertion(readonly);
|
299 |
|
300 |
+
raterJs({
|
301 |
+
starSize: starSize,
|
302 |
+
step: 0.1,
|
303 |
+
showToolTip: false,
|
304 |
+
readOnly: readonly,
|
305 |
+
element: document.querySelector("#" + htmlId),
|
306 |
|
307 |
+
});
|
308 |
|
309 |
+
}
|
310 |
|
311 |
+
function yasrSetRatingOnLoad (yasrRatingsInDom) {
|
312 |
|
313 |
+
//Check in the object
|
314 |
+
for (var i = 0; i < yasrRatingsInDom.length; i++) {
|
315 |
+
|
316 |
+
postId = yasrRatingsInDom.item(i).getAttribute('data-rater-postid');
|
317 |
+
htmlId = yasrRatingsInDom.item(i).id;
|
318 |
+
starSize = yasrRatingsInDom.item(i).getAttribute('data-rater-starsize');
|
319 |
+
|
320 |
+
yasrSetRaterValue(starSize, htmlId);
|
321 |
|
322 |
}
|
323 |
|
324 |
+
}
|
325 |
|
326 |
+
function yasrVisitorVotesFront (mediumRating, starSize, readonly, postId) {
|
327 |
+
|
328 |
+
mediumRating = parseFloat(mediumRating);
|
329 |
+
starSize = parseInt(starSize);
|
330 |
|
331 |
+
//Convert string to boolean
|
332 |
+
readonly = yasrReadonlyConvertion(readonly);
|
333 |
|
334 |
+
var yasrVVElementToGet = '#yasr-visitor-votes-rater-'+postId;
|
335 |
|
336 |
+
raterJs({
|
337 |
+
starSize: starSize,
|
338 |
+
step: 1,
|
339 |
+
showToolTip: false,
|
340 |
+
rating: mediumRating,
|
341 |
+
readOnly: readonly,
|
342 |
+
element: document.querySelector(yasrVVElementToGet),
|
343 |
+
|
344 |
+
rateCallback: function rateCallback(rating, done) {
|
345 |
|
346 |
+
//show the loader
|
347 |
+
document.getElementById('yasr_visitor_votes_' + postId).innerHTML=yasrCommonData.loaderHtml;
|
348 |
+
|
349 |
+
//Just leave 1 number after the .
|
350 |
+
var rating = rating.toFixed(1);
|
351 |
+
//Be sure is a number and not a string
|
352 |
+
var rating = parseFloat(rating);
|
353 |
|
354 |
+
//Creating an object with data to send
|
355 |
+
var data = {
|
356 |
+
action: 'yasr_send_visitor_rating',
|
357 |
+
rating: rating,
|
358 |
+
post_id: postId,
|
359 |
+
size: starSize,
|
360 |
+
nonce_visitor: yasrVisitorsVotesData.nonceVisitor
|
361 |
+
};
|
362 |
|
363 |
+
//Convert in a string
|
364 |
+
var dataToSend = jsObject_to_URLEncoded(data);
|
365 |
|
366 |
+
//Create a new request
|
367 |
+
var yasrVVAjaxCall = new Request(yasrCommonData.ajaxurl ,{
|
368 |
+
method: 'post',
|
369 |
+
headers: new Headers({
|
370 |
+
"Content-Type": "application/x-www-form-urlencoded"
|
371 |
+
}),
|
372 |
+
body: dataToSend
|
373 |
});
|
374 |
|
375 |
+
//Do the ajax call
|
376 |
+
fetch(yasrVVAjaxCall)
|
377 |
+
.then(checkResponse)
|
378 |
+
.then (function(response) {
|
379 |
+
//return the new average rating
|
380 |
+
return response.json();
|
381 |
+
})
|
382 |
+
|
383 |
+
.then(function(data) {
|
384 |
+
|
385 |
+
document.getElementById('yasr_visitor_votes_' + postId).innerHTML = data;
|
386 |
+
|
387 |
+
raterJs({
|
388 |
+
starSize: starSize,
|
389 |
+
step: 1,
|
390 |
+
showToolTip: false,
|
391 |
+
rating: rating,
|
392 |
+
readOnly: true,
|
393 |
+
element: document.querySelector(yasrVVElementToGet)
|
394 |
+
});
|
395 |
+
|
396 |
+
})
|
397 |
+
.then(done)
|
398 |
+
.catch(function(err) {
|
399 |
+
console.log('Error with ajax call', err);
|
400 |
+
});
|
401 |
+
|
402 |
+
done();
|
403 |
|
404 |
}
|
405 |
|
406 |
+
});
|
407 |
|
408 |
+
}
|
409 |
+
|
410 |
+
/*function yasrRaterVisitorsMultiSet (yasrMultiSetVisitorInDom) {
|
411 |
+
|
412 |
+
var setIdArray = [];
|
413 |
+
|
414 |
+
//will have field id and vote
|
415 |
+
var ratingObject = "";
|
416 |
+
|
417 |
+
//an array with all the ratings objects
|
418 |
+
ratingArray = [];
|
419 |
|
420 |
+
//Check in the object
|
421 |
+
for (var i = 0; i < yasrMultiSetVisitorInDom.length; i++) {
|
422 |
+
|
423 |
+
(function (i) {
|
424 |
+
|
425 |
+
var postId = yasrMultiSetVisitorInDom.item(i).getAttribute('data-rater-postid');
|
426 |
+
var htmlId = yasrMultiSetVisitorInDom.item(i).id;
|
427 |
+
var readonly = yasrMultiSetVisitorInDom.item(i).getAttribute('data-rater-readonly');
|
428 |
+
var setId = parseInt(yasrMultiSetVisitorInDom.item(i).getAttribute('data-rater-setid'));
|
429 |
+
|
430 |
+
if (setIdArray.length === 0) {
|
431 |
+
setIdArray.push(setId);
|
432 |
+
}
|
433 |
|
434 |
+
//else {
|
435 |
+
// if (i > 0 && setIdArray[i-1] !== setId) {
|
436 |
+
setIdArray.push(setId);
|
437 |
+
//}
|
438 |
+
//}
|
439 |
|
440 |
+
console.log(setIdArray[i]);
|
|
|
|
|
|
|
441 |
|
442 |
+
readonly = yasrReadonlyConvertion(readonly);
|
443 |
|
444 |
+
var elem = document.querySelector("#" + htmlId);
|
445 |
+
raterJs({
|
446 |
+
starSize: 16,
|
447 |
+
step: 0.5,
|
448 |
+
showToolTip: false,
|
449 |
+
readOnly: readonly,
|
450 |
+
element: elem,
|
451 |
|
452 |
+
rateCallback: function rateCallback(rating, done) {
|
453 |
|
454 |
+
setIdField = elem.getAttribute('data-rater-set-field-id');
|
455 |
+
|
456 |
+
//Just leave 1 number after the .
|
457 |
+
rating = rating.toFixed(1);
|
458 |
+
//Be sure is a number and not a string
|
459 |
+
var vote = parseFloat(rating);
|
460 |
+
|
461 |
+
this.setRating(vote); //set the new rating
|
462 |
+
|
463 |
+
ratingObject = {
|
464 |
+
field: setIdField,
|
465 |
+
rating: vote
|
466 |
};
|
467 |
|
468 |
+
//creating rating array
|
469 |
+
ratingArray.push(ratingObject);
|
|
|
|
|
470 |
|
471 |
+
done();
|
472 |
|
|
|
|
|
473 |
}
|
474 |
|
475 |
+
});
|
|
|
476 |
|
477 |
+
if (typeof setIdArray[i] !== 'undefined') {
|
478 |
|
479 |
+
if (document.getElementById('yasr-send-visitor-multiset-' + postId + '-' + setIdArray[i])) {
|
|
|
|
|
|
|
|
|
480 |
|
481 |
+
var yasrButtonVisitorVotes = document.getElementById('yasr-send-visitor-multiset-' + postId + '-' + setIdArray[i]);
|
482 |
|
483 |
+
yasrButtonVisitorVotes.addEventListener('click', function () {
|
484 |
|
485 |
+
//show the loader
|
486 |
+
document.getElementById('yasr-send-visitor-multiset-'+postId+'-'+setType).innerHTML=yasrCommonData.loaderHtml;
|
487 |
|
488 |
+
jQuery('#yasr-send-visitor-multiset-'+postId+'-'+setIdArray[i]).hide();
|
489 |
|
490 |
+
var data = {
|
491 |
|
492 |
+
action: 'yasr_visitor_multiset_field_vote',
|
493 |
+
nonce: nonce,
|
494 |
+
post_id: postId,
|
495 |
+
rating: ratingArray,
|
496 |
+
set_type: setType
|
497 |
|
498 |
+
};
|
499 |
|
500 |
+
//Send value to the Server
|
501 |
+
jQuery.post(yasrCommonData.ajaxurl, data, function(response) {
|
502 |
+
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).text(response);
|
503 |
+
});
|
504 |
|
505 |
+
});
|
506 |
+
}
|
507 |
+
|
508 |
+
}
|
509 |
|
510 |
+
})(i);
|
511 |
|
512 |
+
} //End for
|
513 |
|
514 |
+
}
|
515 |
+
*/
|
516 |
+
|
517 |
+
/***** Function to convert js object (literal object) to string used for ajax calls in vanilla js ****/
|
518 |
function jsObject_to_URLEncoded(element, key, list){
|
519 |
var list = list || [];
|
520 |
if(typeof(element)=='object'){
|
535 |
|
536 |
return res;
|
537 |
}
|
538 |
+
|
539 |
+
function yasrReadonlyConvertion(readonly) {
|
540 |
+
|
541 |
+
if (typeof readonly === 'undefined' || readonly === null) {
|
542 |
+
readonly = true;
|
543 |
+
}
|
544 |
+
|
545 |
+
//Convert string to boolean
|
546 |
+
if (readonly === 'true') {
|
547 |
+
readonly = true;
|
548 |
+
}
|
549 |
+
if (readonly === 'false') {
|
550 |
+
readonly = false;
|
551 |
+
}
|
552 |
+
|
553 |
+
return readonly;
|
554 |
+
|
555 |
+
}
|
lib/yasr-ajax-functions.php
CHANGED
@@ -1265,10 +1265,8 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1265 |
$new_id=0;
|
1266 |
}
|
1267 |
|
1268 |
-
|
1269 |
$new_id=$highest_id + 1;
|
1270 |
|
1271 |
-
|
1272 |
$query_success=$wpdb->replace(
|
1273 |
YASR_MULTI_SET_VALUES_TABLE,
|
1274 |
array (
|
1265 |
$new_id=0;
|
1266 |
}
|
1267 |
|
|
|
1268 |
$new_id=$highest_id + 1;
|
1269 |
|
|
|
1270 |
$query_success=$wpdb->replace(
|
1271 |
YASR_MULTI_SET_VALUES_TABLE,
|
1272 |
array (
|
lib/yasr-db-functions.php
CHANGED
@@ -125,12 +125,17 @@ function yasr_install() {
|
|
125 |
}
|
126 |
|
127 |
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
130 |
function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
131 |
-
global $wpdb;
|
132 |
|
133 |
-
//if values it's not passed get the post id,
|
|
|
134 |
if(!$post_id) {
|
135 |
|
136 |
$post_id=get_the_ID();
|
@@ -145,6 +150,7 @@ function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
|
145 |
|
146 |
$post_id = (int)$post_id;
|
147 |
|
|
|
148 |
$overall_rating = FALSE;
|
149 |
|
150 |
$transient_name = 'yasr_overall_rating_' . $post_id;
|
125 |
}
|
126 |
|
127 |
|
128 |
+
/*
|
129 |
+
* Get overall rating from yasr_votes tableused in
|
130 |
+
* yasr_add_filter_for_schema(), yasr_get_id_value_callback()
|
131 |
+
* and yasr_rest_get_overall_rating
|
132 |
+
*
|
133 |
+
*/
|
134 |
+
|
135 |
function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
|
|
136 |
|
137 |
+
//if values it's not passed get the post id, since version 1.6.9 this is just for yasr_add_schema function
|
138 |
+
//and for a further check
|
139 |
if(!$post_id) {
|
140 |
|
141 |
$post_id=get_the_ID();
|
150 |
|
151 |
$post_id = (int)$post_id;
|
152 |
|
153 |
+
//default value
|
154 |
$overall_rating = FALSE;
|
155 |
|
156 |
$transient_name = 'yasr_overall_rating_' . $post_id;
|
lib/yasr-functions.php
CHANGED
@@ -55,10 +55,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
55 |
|
56 |
//load rater if jquery is disabled
|
57 |
if (YASR_JQUERY_DISABLED === 'yes') {
|
58 |
-
|
59 |
wp_enqueue_script( 'rater', YASR_JS_DIR . 'rater-js.js' , '', '0.6.0', TRUE );
|
60 |
-
|
61 |
-
|
62 |
}
|
63 |
|
64 |
wp_enqueue_script( 'jquery-ui-progressbar' ); //script
|
@@ -803,7 +800,6 @@ function yasr_stars_size ($size) {
|
|
803 |
|
804 |
$size = sanitize_text_field($size);
|
805 |
|
806 |
-
|
807 |
$stars_attribute = array();
|
808 |
|
809 |
if ($size === 'small') {
|
55 |
|
56 |
//load rater if jquery is disabled
|
57 |
if (YASR_JQUERY_DISABLED === 'yes') {
|
|
|
58 |
wp_enqueue_script( 'rater', YASR_JS_DIR . 'rater-js.js' , '', '0.6.0', TRUE );
|
|
|
|
|
59 |
}
|
60 |
|
61 |
wp_enqueue_script( 'jquery-ui-progressbar' ); //script
|
800 |
|
801 |
$size = sanitize_text_field($size);
|
802 |
|
|
|
803 |
$stars_attribute = array();
|
804 |
|
805 |
if ($size === 'small') {
|
lib/yasr-settings-functions.php
CHANGED
@@ -578,8 +578,8 @@ function yasr_settings_tabs($active_tab) {
|
|
578 |
|
579 |
$string = sprintf(__('If you disable jQuery, YASR will work on vanilla javascript. %s
|
580 |
Please note this feature is still in beta. %s
|
581 |
-
For now, this work only with
|
582 |
-
|
583 |
Please report any bug %s', 'yet-another-stars-rating'),
|
584 |
'<br />', '<br />', '<br />', '<br />', '<a href="https://wordpress.org/plugins/yet-another-stars-rating/">here</a>');
|
585 |
|
578 |
|
579 |
$string = sprintf(__('If you disable jQuery, YASR will work on vanilla javascript. %s
|
580 |
Please note this feature is still in beta. %s
|
581 |
+
For now, this work only with all shortcodes except yasr_visitor_multiset. %s
|
582 |
+
For Pro users, you will not able to change star set colors %s
|
583 |
Please report any bug %s', 'yet-another-stars-rating'),
|
584 |
'<br />', '<br />', '<br />', '<br />', '<a href="https://wordpress.org/plugins/yet-another-stars-rating/">here</a>');
|
585 |
|
lib/yasr-shortcode-functions.php
CHANGED
@@ -25,103 +25,74 @@ add_shortcode ('yasr_overall_rating', 'shortcode_overall_rating_callback');
|
|
25 |
|
26 |
function shortcode_overall_rating_callback ($atts) {
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
}
|
33 |
|
34 |
-
|
35 |
array(
|
36 |
'size' => 'large',
|
37 |
'postid' => FALSE
|
38 |
), $atts )
|
39 |
-
|
40 |
-
|
41 |
-
$overall_rating = yasr_get_overall_rating($postid);
|
42 |
-
|
43 |
-
//if still false
|
44 |
-
if (!$overall_rating) {
|
45 |
-
$overall_rating = "-1";
|
46 |
-
}
|
47 |
-
|
48 |
-
$shortcode_html = '
|
49 |
-
<!--Yasr Overall Rating Shortcode-->
|
50 |
-
';
|
51 |
-
|
52 |
-
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
53 |
-
|
54 |
-
$text_before_star = str_replace('%overall_rating%', $overall_rating, YASR_TEXT_BEFORE_OVERALL);
|
55 |
-
|
56 |
-
$shortcode_html = "<div class=\"yasr-container-custom-text-and-overall\">
|
57 |
-
<span id=\"yasr-custom-text-before-overall\">" . $text_before_star . "</span>";
|
58 |
-
|
59 |
-
}
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
if (YASR_JQUERY_DISABLED === 'yes') {
|
66 |
-
|
67 |
-
$shortcode_html .= "<div id=\"yasr-overall-rating-rater\"></div>";
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
|
|
|
|
|
73 |
|
74 |
-
|
75 |
|
76 |
-
|
77 |
|
78 |
-
|
|
|
79 |
|
80 |
-
|
|
|
81 |
|
82 |
-
|
83 |
|
84 |
-
|
|
|
85 |
|
86 |
-
|
87 |
-
$shortcode_html .= '
|
88 |
-
|
89 |
-
<script type="text/javascript">
|
90 |
-
|
91 |
-
document.addEventListener(\'DOMContentLoaded\', function(event) {
|
92 |
-
|
93 |
-
var overallRating=' . json_encode( $overall_rating ) . ';
|
94 |
-
var starSize=' . json_encode( $stars_attribute["px_size"] ) . ';
|
95 |
-
|
96 |
-
yasrOverallRatingFront (overallRating, starSize);
|
97 |
-
|
98 |
-
});
|
99 |
-
|
100 |
-
</script>
|
101 |
-
|
102 |
-
';
|
103 |
|
104 |
-
|
105 |
|
106 |
-
|
107 |
-
if ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
|
108 |
|
109 |
-
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
|
113 |
-
|
114 |
-
else {
|
115 |
|
116 |
-
if( is_singular() && is_main_query() ) {
|
117 |
|
|
|
|
|
118 |
return $shortcode_html;
|
119 |
-
|
120 |
}
|
121 |
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
} //end function
|
125 |
|
126 |
|
127 |
/****** Add shortcode for user vote ******/
|
@@ -131,9 +102,7 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
131 |
function shortcode_visitor_votes_callback ($atts) {
|
132 |
|
133 |
if (YASR_SHOW_OVERALL_IN_LOOP === 'disabled' && !is_singular() && is_main_query()) {
|
134 |
-
|
135 |
return;
|
136 |
-
|
137 |
}
|
138 |
|
139 |
$shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
|
@@ -141,36 +110,26 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
141 |
extract( shortcode_atts (
|
142 |
array(
|
143 |
'size' => 'large',
|
144 |
-
'postid' => FALSE
|
|
|
145 |
), $atts )
|
146 |
);
|
147 |
|
148 |
//If it's not specified use get_the_id
|
149 |
if (!$postid) {
|
150 |
-
|
151 |
$post_id = get_the_ID();
|
152 |
-
|
153 |
}
|
154 |
|
155 |
else {
|
156 |
-
|
157 |
$post_id = $postid;
|
158 |
-
|
159 |
}
|
160 |
|
161 |
-
$ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
|
162 |
-
|
163 |
-
wp_localize_script( 'yasrfront', "yasrVisitorsVotesData", array(
|
164 |
-
'nonceVisitor' => $ajax_nonce_visitor
|
165 |
-
)
|
166 |
-
);
|
167 |
-
|
168 |
$votes=yasr_get_visitor_votes($post_id); //always reference it
|
169 |
|
170 |
$medium_rating=0; //Avoid undefined variable
|
171 |
|
172 |
if (!$votes) {
|
173 |
-
$votes=0; //Avoid undefined variable if there is not
|
174 |
$votes_number=0; //Avoid undefined variable
|
175 |
}
|
176 |
|
@@ -190,13 +149,40 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
190 |
|
191 |
$stars_attribute = yasr_stars_size($size);
|
192 |
|
193 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
$yasr_cookiename = 'yasr_visitor_vote_cookie';
|
195 |
|
196 |
if (isset($_COOKIE[$yasr_cookiename])) {
|
197 |
|
198 |
$cookie_data = stripslashes($_COOKIE[$yasr_cookiename]);
|
199 |
-
|
200 |
$cookie_data = unserialize($cookie_data);
|
201 |
|
202 |
foreach ($cookie_data as $value) {
|
@@ -204,45 +190,31 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
204 |
$cookie_post_id = (int)$value['post_id'];
|
205 |
|
206 |
if ($cookie_post_id === $post_id) {
|
207 |
-
|
208 |
$cookie_value = (int)$value['rating'];
|
209 |
-
|
210 |
//Stop doing foreach, here we've found the rating for current post
|
211 |
break;
|
212 |
-
|
213 |
}
|
214 |
-
|
215 |
else {
|
216 |
-
|
217 |
$cookie_value = FALSE;
|
218 |
-
|
219 |
}
|
220 |
|
221 |
}
|
222 |
|
223 |
if ($cookie_value !== FALSE && $cookie_value > 5) {
|
224 |
-
|
225 |
$cookie_value = 5;
|
226 |
-
|
227 |
}
|
228 |
|
229 |
elseif ($cookie_value !== FALSE && $cookie_value < 1) {
|
230 |
-
|
231 |
$cookie_value = 1;
|
232 |
-
|
233 |
}
|
234 |
|
235 |
}
|
236 |
|
237 |
else {
|
238 |
-
|
239 |
$cookie_value = FALSE;
|
240 |
-
|
241 |
}
|
242 |
|
243 |
-
$shortcode_html = '
|
244 |
-
<!--Yasr Visitor Votes Shortcode-->
|
245 |
-
';
|
246 |
$shortcode_html .= "<div id=\"yasr_visitor_votes_$post_id\" class=\"yasr-visitor-votes\">";
|
247 |
$span_after_rate_it = "";
|
248 |
|
@@ -256,9 +228,7 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
256 |
|
257 |
//If user has already rated
|
258 |
if ($vote_if_user_already_rated) {
|
259 |
-
|
260 |
$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>";
|
261 |
-
|
262 |
}
|
263 |
|
264 |
} //End if user is logged
|
@@ -271,27 +241,17 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
271 |
|
272 |
//if cookie exists
|
273 |
if($cookie_value) {
|
274 |
-
|
275 |
$readonly = 'true';
|
276 |
-
|
277 |
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_CUSTOM_TEXT_USER_VOTED!='') {
|
278 |
-
|
279 |
$span_after_rate_it = $span_after_rate_it="<span class=\"yasr-small-block-bold yasr-already-voted-text\">" . YASR_CUSTOM_TEXT_USER_VOTED . " </span>";;
|
280 |
-
|
281 |
}
|
282 |
-
|
283 |
else {
|
284 |
-
|
285 |
$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>";
|
286 |
-
|
287 |
}
|
288 |
-
|
289 |
}
|
290 |
|
291 |
else {
|
292 |
-
|
293 |
$readonly = 'false';
|
294 |
-
|
295 |
}
|
296 |
|
297 |
}
|
@@ -306,7 +266,6 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
306 |
if(!is_user_logged_in()) {
|
307 |
|
308 |
$readonly = 'true'; //readonly is true if user isn't logged
|
309 |
-
|
310 |
$span_after_rate_it = "<span class=\"yasr-visitor-votes-must-sign-in\">" . __("You must sign in to vote", 'yet-another-stars-rating') . "</span>";
|
311 |
|
312 |
}
|
@@ -314,24 +273,18 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
314 |
}
|
315 |
|
316 |
if (YASR_VISITORS_STATS === 'yes') {
|
317 |
-
|
318 |
$span_dashicon = "<span class=\"dashicons dashicons-chart-bar yasr-dashicons-visitor-stats \" id=\"yasr-total-average-dashicon-$post_id\" title=\"yasr-stats-dashicon\"></span>";
|
319 |
-
|
320 |
}
|
321 |
|
322 |
else {
|
323 |
-
|
324 |
$span_dashicon = "";
|
325 |
-
|
326 |
}
|
327 |
|
328 |
|
329 |
if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_VISITOR_RATING != '') {
|
330 |
|
331 |
$text_before_star = str_replace('%total_count%', $votes_number, YASR_TEXT_BEFORE_VISITOR_RATING);
|
332 |
-
|
333 |
$text_before_star = str_replace('%average%', $medium_rating, $text_before_star);
|
334 |
-
|
335 |
$shortcode_html .= "<div class=\"yasr-container-custom-text-and-visitor-rating\">
|
336 |
<span id=\"yasr-custom-text-before-visitor-rating\">" . $text_before_star . "</span></div>";
|
337 |
|
@@ -340,9 +293,7 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
340 |
if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_AFTER_VISITOR_RATING != '') {
|
341 |
|
342 |
$text_after_star = str_replace('%total_count%', $votes_number, YASR_TEXT_AFTER_VISITOR_RATING);
|
343 |
-
|
344 |
$text_after_star = str_replace('%average%', $medium_rating, $text_after_star);
|
345 |
-
|
346 |
$span_text_after_star = "<span class=\"yasr-total-average-container\" id=\"yasr-total-average-text_$post_id\">" . $text_after_star . "</span>";
|
347 |
|
348 |
}
|
@@ -357,31 +308,12 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
357 |
|
358 |
if (YASR_JQUERY_DISABLED === 'yes') {
|
359 |
|
360 |
-
|
361 |
-
|
362 |
-
}
|
363 |
-
|
364 |
-
else {
|
365 |
-
|
366 |
-
$shortcode_html .= "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_visitor_votes_$post_id\" data-postid=\"$post_id\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"$readonly\"></div>";
|
367 |
-
|
368 |
-
}
|
369 |
-
|
370 |
-
$shortcode_html .= $span_dashicon;
|
371 |
-
|
372 |
-
$shortcode_html .= $span_text_after_star;
|
373 |
-
|
374 |
-
$shortcode_html .= $span_after_rate_it;
|
375 |
-
|
376 |
-
$shortcode_html .= "</div>";
|
377 |
|
378 |
-
|
379 |
-
<!--End Yasr Visitor Votes Shortcode-->
|
380 |
-
';
|
381 |
-
|
382 |
-
if (YASR_JQUERY_DISABLED === 'yes') {
|
383 |
|
384 |
-
|
385 |
|
386 |
<script type="text/javascript">
|
387 |
|
@@ -398,8 +330,22 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
398 |
|
399 |
</script>';
|
400 |
|
|
|
|
|
|
|
401 |
}
|
402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
|
404 |
//If overall rating in loop is enabled don't use is_singular && is main_query
|
405 |
if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
|
@@ -422,93 +368,20 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
|
|
422 |
} //End function shortcode_visitor_votes_callback
|
423 |
|
424 |
|
425 |
-
|
|
|
|
|
426 |
add_shortcode ('yasr_visitor_votes_readonly', 'yasr_visitor_votes_readonly_callback');
|
427 |
|
428 |
function yasr_visitor_votes_readonly_callback ($atts) {
|
429 |
|
430 |
-
$
|
431 |
-
<!-- Yasr Visitor Votes Readonly Shortcode-->
|
432 |
-
';
|
433 |
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
'postid' => FALSE
|
438 |
-
), $atts )
|
439 |
-
);
|
440 |
|
441 |
-
|
442 |
-
if (!$postid) {
|
443 |
-
|
444 |
-
$post_id = get_the_ID();
|
445 |
-
|
446 |
-
}
|
447 |
-
|
448 |
-
else {
|
449 |
-
|
450 |
-
$post_id = $postid;
|
451 |
-
|
452 |
-
}
|
453 |
-
|
454 |
-
$votes=yasr_get_visitor_votes($post_id);
|
455 |
-
|
456 |
-
$medium_rating=0; //Avoid undefined variable
|
457 |
-
|
458 |
-
if (!$votes) {
|
459 |
-
$votes=0; //Avoid undefined variable if there is not overall rating
|
460 |
-
$votes_number=0; //Avoid undefined variable
|
461 |
-
}
|
462 |
-
|
463 |
-
else {
|
464 |
-
foreach ($votes as $user_votes) {
|
465 |
-
$votes_number = $user_votes->number_of_votes;
|
466 |
-
if ($votes_number != 0 ) {
|
467 |
-
$medium_rating = ($user_votes->sum_votes/$votes_number);
|
468 |
-
}
|
469 |
-
else {
|
470 |
-
$medium_rating = 0;
|
471 |
-
}
|
472 |
-
}
|
473 |
-
}
|
474 |
-
|
475 |
-
$medium_rating=round($medium_rating, 1);
|
476 |
-
|
477 |
-
$stars_attribute = yasr_stars_size($size);
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
$shortcode_html .= "<div id=\"yasr_visitor_votes_readonly_$post_id\" class=\"yasr-visitor-votes_readonly\">";
|
482 |
-
$span_after_rate_it = "";
|
483 |
-
|
484 |
-
$shortcode_html .= "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_visitor_votes_readonly_$post_id\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>";
|
485 |
-
|
486 |
-
$shortcode_html .= "</div>";
|
487 |
-
|
488 |
-
$shortcode_html .= '
|
489 |
-
<!--End Yasr Visitor Votes Readonly Shortcode-->
|
490 |
-
';
|
491 |
-
|
492 |
-
|
493 |
-
//IF show visitor votes in loop is disabled use is_singular && is_main query
|
494 |
-
if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'disabled' ) {
|
495 |
-
|
496 |
-
if( is_singular() && is_main_query() ) {
|
497 |
-
|
498 |
-
return $shortcode_html;
|
499 |
-
|
500 |
-
}
|
501 |
-
|
502 |
-
} // End if YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'disabled') {
|
503 |
-
|
504 |
-
//If overall rating in loop is enabled don't use is_singular && is main_query
|
505 |
-
elseif ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
|
506 |
-
|
507 |
-
return $shortcode_html;
|
508 |
-
|
509 |
-
}
|
510 |
-
|
511 |
-
// } //End (!is_feed)
|
512 |
|
513 |
} //End function shortcode_visitor_votes_only_stars_callback
|
514 |
|
@@ -543,9 +416,7 @@ add_shortcode ('yasr_multiset', 'shortcode_multi_set_callback');
|
|
543 |
|
544 |
}
|
545 |
|
546 |
-
$shortcode_html = '
|
547 |
-
<!-- Yasr Multi Set Shortcode-->
|
548 |
-
';
|
549 |
|
550 |
$multiset_vote_sum = 0;
|
551 |
$multiset_rows_number = 0; //
|
@@ -576,31 +447,65 @@ add_shortcode ('yasr_multiset', 'shortcode_multi_set_callback');
|
|
576 |
|
577 |
foreach ($set_name_content as $set_content) {
|
578 |
|
579 |
-
|
580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
</tr>";
|
582 |
|
583 |
-
|
584 |
-
|
|
|
|
|
585 |
|
586 |
}
|
587 |
|
588 |
-
if ($show_average !== FALSE && $show_average !=='no'|| $show_average===FALSE && YASR_MULTI_SHOW_AVERAGE !== 'no') {
|
589 |
|
590 |
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
|
591 |
$multiset_average = round($multiset_average, 1);
|
592 |
|
593 |
$average_txt = __("Average", "yet-another-stars-rating");
|
594 |
|
595 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
|
597 |
}
|
598 |
|
599 |
$shortcode_html.="</table>";
|
600 |
|
601 |
-
$shortcode_html .= '
|
602 |
-
<!--End Yasr Multi Set Shortcode-->
|
603 |
-
';
|
604 |
|
605 |
return $shortcode_html;
|
606 |
|
@@ -628,40 +533,30 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
628 |
|
629 |
//If it's not specified use get_the_id
|
630 |
if (!$postid) {
|
631 |
-
|
632 |
$post_id = get_the_ID();
|
633 |
-
|
634 |
}
|
635 |
|
636 |
else {
|
637 |
-
|
638 |
$post_id = $postid;
|
639 |
-
|
640 |
}
|
641 |
|
642 |
$image = YASR_IMG_DIR . "/loader.gif";
|
643 |
-
|
644 |
$average_txt = __("Average", "yet-another-stars-rating");
|
645 |
-
|
646 |
$loader_html = "<span class=\"yasr-loader-multiset-visitor\" id=\"yasr-loader-multiset-visitor-$post_id-$setid\" > " . __("Loading, please wait",'yet-another-stars-rating') . ' <img src=' . "$image" .' title="yasr-loader" alt="yasr-loader"></span>';
|
647 |
-
|
648 |
-
$button_html = "<input type=\"submit\" name=\"submit\" id=\"yasr-send-visitor-multiset-$post_id-$setid\" class=\"button button-primary\" value=\"" . __('Submit!', 'yet-another-stars-rating') . " \" />";
|
649 |
-
|
650 |
$yasr_cookiename = 'yasr_multi_visitor_cookie';
|
651 |
|
|
|
652 |
if (isset($_COOKIE[$yasr_cookiename])) {
|
653 |
|
654 |
$cookie_data = stripslashes($_COOKIE[$yasr_cookiename]);
|
655 |
-
|
656 |
$cookie_data = unserialize($cookie_data);
|
657 |
|
658 |
foreach ($cookie_data as $value) {
|
659 |
-
|
660 |
$cookie_post_id = (int)$value['post_id'];
|
661 |
$cookie_set_id = (int)$value['set_id'];
|
662 |
|
663 |
if ($cookie_post_id === $post_id && $cookie_set_id == $setid) {
|
664 |
-
|
665 |
$button = "";
|
666 |
$star_readonly = 'true';
|
667 |
$span_message_content = __('Thank you for voting! ', 'yet-another-stars-rating');
|
@@ -672,16 +567,11 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
672 |
}
|
673 |
|
674 |
else {
|
675 |
-
|
676 |
$button = $button_html;
|
677 |
$star_readonly = 'false';
|
678 |
$span_message_content = "";
|
679 |
-
|
680 |
}
|
681 |
-
|
682 |
}
|
683 |
-
|
684 |
-
|
685 |
}
|
686 |
|
687 |
else {
|
@@ -690,70 +580,65 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
690 |
if (!is_user_logged_in()) {
|
691 |
|
692 |
if (YASR_ALLOWED_USER === 'allow_anonymous') {
|
693 |
-
|
694 |
$button = $button_html;
|
695 |
$star_readonly = 'false';
|
696 |
$span_message_content = "";
|
697 |
-
|
698 |
}
|
699 |
|
700 |
elseif (YASR_ALLOWED_USER === 'logged_only') {
|
701 |
-
|
702 |
$button = $button_html;
|
703 |
$star_readonly = 'true';
|
704 |
$span_message_content = "<span class=\"yasr-visitor-votes-must-sign-in\">" . __("You must sign in to vote", 'yet-another-stars-rating') . "</span>";
|
705 |
-
|
706 |
}
|
707 |
|
708 |
-
|
709 |
} //End if user logged in
|
710 |
|
711 |
//Is user is logged in
|
712 |
else {
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
$span_message_content = "";
|
717 |
-
|
718 |
}
|
719 |
|
720 |
}
|
721 |
|
722 |
$set_name_content = yasr_get_multi_set_visitor ($post_id, $setid);
|
723 |
|
724 |
-
$shortcode_html = '
|
725 |
-
|
726 |
-
';
|
727 |
|
728 |
-
|
729 |
|
730 |
$multiset_vote_sum = 0;//avoid undefined variable
|
731 |
$multiset_rows_number = 0;//avoid undefined variable
|
732 |
|
733 |
-
$shortcode_html.="<table class=\"yasr_table_multi_set_shortcode\">";
|
734 |
-
|
735 |
foreach ($set_name_content as $set_content) {
|
736 |
|
737 |
if($set_content->number_of_votes > 0) {
|
738 |
-
|
739 |
$average_rating = $set_content->sum_votes / $set_content->number_of_votes;
|
740 |
-
|
741 |
$average_rating = round($average_rating, 1);
|
742 |
-
|
743 |
}
|
744 |
|
745 |
else {
|
746 |
-
|
747 |
$average_rating = 0;
|
|
|
748 |
|
|
|
|
|
|
|
|
|
749 |
}
|
750 |
|
|
|
|
|
|
|
|
|
751 |
$shortcode_html .= "<tr>
|
752 |
<td>
|
753 |
<span class=\"yasr-multi-set-name-field\">$set_content->name </span>
|
754 |
</td>
|
755 |
<td>
|
756 |
-
|
757 |
<span class=\"yasr-visitor-multiset-vote-count\">$set_content->number_of_votes</span>
|
758 |
</td>
|
759 |
</tr>";
|
@@ -763,29 +648,12 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
763 |
|
764 |
} //End foreach
|
765 |
|
766 |
-
|
767 |
-
|
768 |
-
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
|
769 |
-
$multiset_average = round($multiset_average, 1);
|
770 |
-
|
771 |
-
$shortcode_html .= "<tr>
|
772 |
-
<td colspan=\"2\" class=\"yasr-multiset-average\">
|
773 |
-
$average_txt<div class=\"rateit medium \" data-rateit-value=\"$multiset_average\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
|
774 |
-
</td>
|
775 |
-
</tr>";
|
776 |
|
777 |
-
}
|
778 |
-
|
779 |
-
$shortcode_html.="<tr>
|
780 |
-
<td colspan=\"2\">
|
781 |
-
$button
|
782 |
-
$loader_html
|
783 |
-
<span class=\"yasr-visitor-multiset-message\">$span_message_content</span>
|
784 |
-
</td>
|
785 |
-
</tr>
|
786 |
-
</table>";
|
787 |
}
|
788 |
|
|
|
789 |
else {
|
790 |
|
791 |
$set_name=$wpdb->get_results($wpdb->prepare("SELECT field_name AS name, field_id AS id
|
@@ -794,8 +662,6 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
794 |
ORDER BY field_id ASC", $setid));
|
795 |
|
796 |
|
797 |
-
$shortcode_html.="<table class=\"yasr_table_multi_set_shortcode\">";
|
798 |
-
|
799 |
foreach ($set_name as $set_content) {
|
800 |
|
801 |
$shortcode_html .= "<tr>
|
@@ -808,65 +674,38 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
808 |
</td>
|
809 |
</tr>";
|
810 |
|
811 |
-
|
812 |
-
//First time, initialize all fields to 0
|
813 |
-
|
814 |
-
//Find the highest_id (it's not auto increment on db due to gd star compatibility)
|
815 |
-
$highest_id=$wpdb->get_var("SELECT id FROM " . YASR_MULTI_SET_VALUES_TABLE . " ORDER BY id DESC LIMIT 1 ");
|
816 |
-
|
817 |
-
//highest id is 0 if data is empty
|
818 |
-
if (!$highest_id) {
|
819 |
-
$new_id=0;
|
820 |
-
}
|
821 |
-
|
822 |
-
$new_id=$highest_id + 1;
|
823 |
-
|
824 |
-
$wpdb->replace(
|
825 |
-
YASR_MULTI_SET_VALUES_TABLE,
|
826 |
-
array (
|
827 |
-
'id'=>$new_id,
|
828 |
-
'post_id'=>$post_id,
|
829 |
-
'field_id'=>$set_content->id,
|
830 |
-
'set_type'=>$setid,
|
831 |
-
'number_of_votes' => 0,
|
832 |
-
'sum_votes' => 0
|
833 |
-
),
|
834 |
-
array ("%d", "%d", "%d", "%d", "%d", "%d")
|
835 |
-
);
|
836 |
-
|
837 |
-
|
838 |
} //end foreach ($set_name as $set_content)
|
839 |
|
|
|
|
|
|
|
840 |
|
841 |
-
|
|
|
842 |
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
|
849 |
-
|
850 |
|
851 |
-
|
|
|
852 |
<td colspan=\"2\">
|
853 |
$button
|
854 |
$loader_html
|
855 |
<span class=\"yasr-visitor-multiset-message\">$span_message_content</span>
|
856 |
</td>
|
857 |
</tr>
|
858 |
-
|
859 |
|
860 |
-
|
861 |
|
862 |
-
|
863 |
|
864 |
-
|
865 |
-
$var_ajax_nonce_visitor_multiset = json_encode($ajax_nonce_visitor_multiset);
|
866 |
-
|
867 |
-
$shortcode_html .= '
|
868 |
-
<!-- End Yasr Multi Set Shortcode-->
|
869 |
-
';
|
870 |
|
871 |
wp_localize_script( 'yasrfront', "yasrMultiSetData", array(
|
872 |
'nonceVisitor' => $var_ajax_nonce_visitor_multiset,
|
@@ -879,8 +718,6 @@ add_shortcode ('yasr_visitor_multiset', 'yasr_visitor_multiset_callback');
|
|
879 |
}
|
880 |
|
881 |
|
882 |
-
|
883 |
-
|
884 |
/****** Add top 10 highest rated post *****/
|
885 |
|
886 |
add_shortcode ('yasr_top_ten_highest_rated', 'yasr_top_ten_highest_rated_callback');
|
@@ -897,9 +734,7 @@ add_shortcode ('yasr_top_ten_highest_rated', 'yasr_top_ten_highest_rated_callbac
|
|
897 |
ORDER BY pm.meta_value DESC, pm.post_id ASC LIMIT 10");
|
898 |
|
899 |
|
900 |
-
$shortcode_html = '
|
901 |
-
<!-- Yasr Top 10 highest Rated Shortcode-->
|
902 |
-
';
|
903 |
|
904 |
if ($query_result) {
|
905 |
|
@@ -908,13 +743,25 @@ add_shortcode ('yasr_top_ten_highest_rated', 'yasr_top_ten_highest_rated_callbac
|
|
908 |
foreach ($query_result as $result) {
|
909 |
|
910 |
$post_title = get_the_title($result->post_id);
|
911 |
-
|
912 |
$link = get_permalink($result->post_id); //Get permalink from post it
|
913 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
914 |
$shortcode_html .= "<tr>
|
915 |
-
|
916 |
<td width=\"40%\" class=\"yasr-top-10-overall-right\">
|
917 |
-
|
918 |
<span class=\"yasr-highest-rated-text\">" . __("Rating", 'yet-another-stars-rating') . " $result->overall_rating </span>
|
919 |
</td>
|
920 |
</tr>";
|
@@ -924,9 +771,7 @@ add_shortcode ('yasr_top_ten_highest_rated', 'yasr_top_ten_highest_rated_callbac
|
|
924 |
|
925 |
$shortcode_html .= "</table>";
|
926 |
|
927 |
-
$shortcode_html .= '
|
928 |
-
<!--End Yasr Top 10 highest Rated Shortcode-->
|
929 |
-
';
|
930 |
|
931 |
return $shortcode_html;
|
932 |
|
@@ -945,10 +790,7 @@ add_shortcode ('yasr_most_or_highest_rated_posts', 'yasr_most_or_highest_rated_p
|
|
945 |
|
946 |
function yasr_most_or_highest_rated_posts_callback () {
|
947 |
|
948 |
-
|
949 |
-
$shortcode_html = '
|
950 |
-
<!-- Yasr Most Or Highest Rated Shortcode-->
|
951 |
-
';
|
952 |
|
953 |
global $wpdb;
|
954 |
|
@@ -997,15 +839,28 @@ add_shortcode ('yasr_most_or_highest_rated_posts', 'yasr_most_or_highest_rated_p
|
|
997 |
|
998 |
$link = get_permalink($result->post_id); //Get permalink from post it
|
999 |
|
1000 |
-
|
1001 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1002 |
<td width=\"40%\" class=\"yasr-top-10-most-highest-right\">
|
1003 |
-
|
1004 |
-
<br /> [" .
|
1005 |
</td>
|
1006 |
</tr>";
|
1007 |
|
1008 |
-
|
1009 |
} //End foreach
|
1010 |
|
1011 |
$shortcode_html .= "</table>" ;
|
@@ -1036,9 +891,24 @@ add_shortcode ('yasr_most_or_highest_rated_posts', 'yasr_most_or_highest_rated_p
|
|
1036 |
|
1037 |
$link = get_permalink($result->post_id); //Get permalink from post it
|
1038 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
$shortcode_html .= "<tr>
|
1040 |
<td width=\"60%\" class=\"yasr-top-10-most-highest-left\"><a href=\"$link\">$post_title</a></td>
|
1041 |
-
<td width=\"40%\" class=\"yasr-top-10-most-highest-right\"
|
|
|
1042 |
<br /> [" . __("Total:" , 'yet-another-stars-rating') . "$result->number_of_votes " . __("Average" , 'yet-another-stars-rating') . " $rating]
|
1043 |
</td>
|
1044 |
</tr>";
|
@@ -1054,14 +924,14 @@ add_shortcode ('yasr_most_or_highest_rated_posts', 'yasr_most_or_highest_rated_p
|
|
1054 |
$shortcode_html = __("You've not enought data",'yet-another-stars-rating') . "<br />";
|
1055 |
}
|
1056 |
|
1057 |
-
$shortcode_html .= '
|
1058 |
-
<!-- End Yasr Most Or Highest Rated Shortcode-->
|
1059 |
-
';
|
1060 |
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
|
|
|
|
1065 |
|
1066 |
return $shortcode_html;
|
1067 |
|
@@ -1143,13 +1013,9 @@ add_shortcode ('yasr_top_5_reviewers', 'yasr_top_5_reviewers_callback');
|
|
1143 |
|
1144 |
}
|
1145 |
|
1146 |
-
|
1147 |
} //End top 5 reviewers function
|
1148 |
|
1149 |
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
/****** Add top 10 most active user *****/
|
1154 |
|
1155 |
add_shortcode ('yasr_top_ten_active_users', 'yasr_top_ten_active_users_callback');
|
@@ -1168,9 +1034,7 @@ add_shortcode ('yasr_top_ten_active_users', 'yasr_top_ten_active_users_callback'
|
|
1168 |
|
1169 |
if ($query_result) {
|
1170 |
|
1171 |
-
$shortcode_html = '
|
1172 |
-
<!-- Yasr Top 10 Active Users Shortcode-->
|
1173 |
-
';
|
1174 |
|
1175 |
$shortcode_html .= "
|
1176 |
<table class=\"yasr-table-chart\">
|
@@ -1206,9 +1070,7 @@ add_shortcode ('yasr_top_ten_active_users', 'yasr_top_ten_active_users_callback'
|
|
1206 |
|
1207 |
$shortcode_html .= "</table>";
|
1208 |
|
1209 |
-
$shortcode_html .= '
|
1210 |
-
<!--End Yasr Top 10 Active Users Shortcode-->
|
1211 |
-
';
|
1212 |
|
1213 |
return $shortcode_html;
|
1214 |
|
@@ -1276,8 +1138,7 @@ function yasr_highest_rated_visitor_multi_set_callback ($atts) {
|
|
1276 |
$average" . sprintf(__(' based on %d votes', 'yet-another-stars-rating'), $results->number_of_votes); "
|
1277 |
</td>
|
1278 |
</tr>";
|
1279 |
-
|
1280 |
-
|
1281 |
$field_name = $results->field_name;
|
1282 |
|
1283 |
}
|
25 |
|
26 |
function shortcode_overall_rating_callback ($atts) {
|
27 |
|
28 |
+
if (YASR_SHOW_OVERALL_IN_LOOP === 'disabled' && !is_singular() && is_main_query()) {
|
29 |
+
return;
|
30 |
+
}
|
|
|
|
|
31 |
|
32 |
+
extract( shortcode_atts (
|
33 |
array(
|
34 |
'size' => 'large',
|
35 |
'postid' => FALSE
|
36 |
), $atts )
|
37 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
/** If postid is not passed as an element, get the current post id **/
|
40 |
+
if ($postid === FALSE) {
|
41 |
+
$postid = get_the_ID();
|
42 |
+
}
|
|
|
|
|
|
|
43 |
|
44 |
+
$overall_rating = yasr_get_overall_rating($postid);
|
45 |
|
46 |
+
//if still false
|
47 |
+
if (!$overall_rating) {
|
48 |
+
$overall_rating = "-1";
|
49 |
+
}
|
50 |
|
51 |
+
$shortcode_html = '<!--Yasr Overall Rating Shortcode-->';
|
52 |
|
53 |
+
$stars_attribute = yasr_stars_size($size);
|
54 |
|
55 |
+
//IF jquery is disabled, use rater
|
56 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
57 |
|
58 |
+
$overall_rating_html_id = 'yasr-overall-rating-rater-' . $postid;
|
59 |
+
$html_stars = "<div class=\"yasr-rater-stars\" id=\"$overall_rating_html_id\" data-rater-postid=\"$postid\" data-rating=\"$overall_rating\" data-rater-starsize=\"$stars_attribute[px_size]\" ></div>";
|
60 |
|
61 |
+
}
|
62 |
|
63 |
+
//by default, use jquery
|
64 |
+
else {
|
65 |
|
66 |
+
$html_stars = "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
}
|
69 |
|
70 |
+
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
|
|
71 |
|
72 |
+
$text_before_star = str_replace('%overall_rating%', $overall_rating, YASR_TEXT_BEFORE_OVERALL);
|
73 |
+
$shortcode_html = "<div class=\"yasr-container-custom-text-and-overall\">
|
74 |
+
<span id=\"yasr-custom-text-before-overall\">" . $text_before_star . "</span>
|
75 |
+
$html_stars
|
76 |
+
</div>";
|
77 |
|
78 |
+
}
|
79 |
|
80 |
+
$shortcode_html .= '<!--End Yasr Overall Rating Shortcode-->';
|
|
|
81 |
|
|
|
82 |
|
83 |
+
//If overall rating in loop is enabled don't use is_singular && is main_query
|
84 |
+
if ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
|
85 |
return $shortcode_html;
|
|
|
86 |
}
|
87 |
|
88 |
+
//default
|
89 |
+
else {
|
90 |
+
if( is_singular() && is_main_query() ) {
|
91 |
+
return $shortcode_html;
|
92 |
+
}
|
93 |
+
}
|
94 |
|
95 |
+
} //end function
|
96 |
|
97 |
|
98 |
/****** Add shortcode for user vote ******/
|
102 |
function shortcode_visitor_votes_callback ($atts) {
|
103 |
|
104 |
if (YASR_SHOW_OVERALL_IN_LOOP === 'disabled' && !is_singular() && is_main_query()) {
|
|
|
105 |
return;
|
|
|
106 |
}
|
107 |
|
108 |
$shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
|
110 |
extract( shortcode_atts (
|
111 |
array(
|
112 |
'size' => 'large',
|
113 |
+
'postid' => FALSE,
|
114 |
+
'readonly' => FALSE
|
115 |
), $atts )
|
116 |
);
|
117 |
|
118 |
//If it's not specified use get_the_id
|
119 |
if (!$postid) {
|
|
|
120 |
$post_id = get_the_ID();
|
|
|
121 |
}
|
122 |
|
123 |
else {
|
|
|
124 |
$post_id = $postid;
|
|
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
$votes=yasr_get_visitor_votes($post_id); //always reference it
|
128 |
|
129 |
$medium_rating=0; //Avoid undefined variable
|
130 |
|
131 |
if (!$votes) {
|
132 |
+
$votes=0; //Avoid undefined variable if there is not rating
|
133 |
$votes_number=0; //Avoid undefined variable
|
134 |
}
|
135 |
|
149 |
|
150 |
$stars_attribute = yasr_stars_size($size);
|
151 |
|
152 |
+
//if this come from yasr_visitor_votes_readonly...
|
153 |
+
if ($readonly === TRUE || $readonly === "yes") {
|
154 |
+
|
155 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
156 |
+
|
157 |
+
$htmlid = 'yasr-visitor-votes-readonly-rater-'.$post_id;
|
158 |
+
$shortcode_html = "<div class=\"yasr-rater-stars\" id=\"$htmlid\" data-rater-value=\"$medium_rating\" data-rater-starsize=\"$stars_attribute[px_size]\" data-rater-postid=\"$post_id\"></div>";
|
159 |
+
|
160 |
+
}
|
161 |
+
else {
|
162 |
+
$shortcode_html = "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_visitor_votes_$post_id\" data-postid=\"$post_id\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>";
|
163 |
+
}
|
164 |
+
|
165 |
+
return $shortcode_html;
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
$ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
|
170 |
+
|
171 |
+
if (YASR_JQUERY_DISABLED !== 'yes') {
|
172 |
+
|
173 |
+
wp_localize_script( 'yasrfront', "yasrVisitorsVotesData", array(
|
174 |
+
'nonceVisitor' => $ajax_nonce_visitor
|
175 |
+
)
|
176 |
+
);
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
//name of cookie to check
|
181 |
$yasr_cookiename = 'yasr_visitor_vote_cookie';
|
182 |
|
183 |
if (isset($_COOKIE[$yasr_cookiename])) {
|
184 |
|
185 |
$cookie_data = stripslashes($_COOKIE[$yasr_cookiename]);
|
|
|
186 |
$cookie_data = unserialize($cookie_data);
|
187 |
|
188 |
foreach ($cookie_data as $value) {
|
190 |
$cookie_post_id = (int)$value['post_id'];
|
191 |
|
192 |
if ($cookie_post_id === $post_id) {
|
|
|
193 |
$cookie_value = (int)$value['rating'];
|
|
|
194 |
//Stop doing foreach, here we've found the rating for current post
|
195 |
break;
|
|
|
196 |
}
|
|
|
197 |
else {
|
|
|
198 |
$cookie_value = FALSE;
|
|
|
199 |
}
|
200 |
|
201 |
}
|
202 |
|
203 |
if ($cookie_value !== FALSE && $cookie_value > 5) {
|
|
|
204 |
$cookie_value = 5;
|
|
|
205 |
}
|
206 |
|
207 |
elseif ($cookie_value !== FALSE && $cookie_value < 1) {
|
|
|
208 |
$cookie_value = 1;
|
|
|
209 |
}
|
210 |
|
211 |
}
|
212 |
|
213 |
else {
|
|
|
214 |
$cookie_value = FALSE;
|
|
|
215 |
}
|
216 |
|
217 |
+
$shortcode_html = '<!--Yasr Visitor Votes Shortcode-->';
|
|
|
|
|
218 |
$shortcode_html .= "<div id=\"yasr_visitor_votes_$post_id\" class=\"yasr-visitor-votes\">";
|
219 |
$span_after_rate_it = "";
|
220 |
|
228 |
|
229 |
//If user has already rated
|
230 |
if ($vote_if_user_already_rated) {
|
|
|
231 |
$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>";
|
|
|
232 |
}
|
233 |
|
234 |
} //End if user is logged
|
241 |
|
242 |
//if cookie exists
|
243 |
if($cookie_value) {
|
|
|
244 |
$readonly = 'true';
|
|
|
245 |
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_CUSTOM_TEXT_USER_VOTED!='') {
|
|
|
246 |
$span_after_rate_it = $span_after_rate_it="<span class=\"yasr-small-block-bold yasr-already-voted-text\">" . YASR_CUSTOM_TEXT_USER_VOTED . " </span>";;
|
|
|
247 |
}
|
|
|
248 |
else {
|
|
|
249 |
$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>";
|
|
|
250 |
}
|
|
|
251 |
}
|
252 |
|
253 |
else {
|
|
|
254 |
$readonly = 'false';
|
|
|
255 |
}
|
256 |
|
257 |
}
|
266 |
if(!is_user_logged_in()) {
|
267 |
|
268 |
$readonly = 'true'; //readonly is true if user isn't logged
|
|
|
269 |
$span_after_rate_it = "<span class=\"yasr-visitor-votes-must-sign-in\">" . __("You must sign in to vote", 'yet-another-stars-rating') . "</span>";
|
270 |
|
271 |
}
|
273 |
}
|
274 |
|
275 |
if (YASR_VISITORS_STATS === 'yes') {
|
|
|
276 |
$span_dashicon = "<span class=\"dashicons dashicons-chart-bar yasr-dashicons-visitor-stats \" id=\"yasr-total-average-dashicon-$post_id\" title=\"yasr-stats-dashicon\"></span>";
|
|
|
277 |
}
|
278 |
|
279 |
else {
|
|
|
280 |
$span_dashicon = "";
|
|
|
281 |
}
|
282 |
|
283 |
|
284 |
if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_VISITOR_RATING != '') {
|
285 |
|
286 |
$text_before_star = str_replace('%total_count%', $votes_number, YASR_TEXT_BEFORE_VISITOR_RATING);
|
|
|
287 |
$text_before_star = str_replace('%average%', $medium_rating, $text_before_star);
|
|
|
288 |
$shortcode_html .= "<div class=\"yasr-container-custom-text-and-visitor-rating\">
|
289 |
<span id=\"yasr-custom-text-before-visitor-rating\">" . $text_before_star . "</span></div>";
|
290 |
|
293 |
if(YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_AFTER_VISITOR_RATING != '') {
|
294 |
|
295 |
$text_after_star = str_replace('%total_count%', $votes_number, YASR_TEXT_AFTER_VISITOR_RATING);
|
|
|
296 |
$text_after_star = str_replace('%average%', $medium_rating, $text_after_star);
|
|
|
297 |
$span_text_after_star = "<span class=\"yasr-total-average-container\" id=\"yasr-total-average-text_$post_id\">" . $text_after_star . "</span>";
|
298 |
|
299 |
}
|
308 |
|
309 |
if (YASR_JQUERY_DISABLED === 'yes') {
|
310 |
|
311 |
+
$shortcode_html .= "<div id=\"yasr-visitor-votes-rater-$post_id\"></div>";
|
312 |
+
$shortcode_html .= '<!--End Yasr Visitor Votes Shortcode-->';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
|
|
|
|
|
|
|
|
315 |
|
316 |
+
$shortcode_html .= '
|
317 |
|
318 |
<script type="text/javascript">
|
319 |
|
330 |
|
331 |
</script>';
|
332 |
|
333 |
+
}
|
334 |
+
|
335 |
+
|
336 |
}
|
337 |
|
338 |
+
else {
|
339 |
+
|
340 |
+
$shortcode_html .= "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_visitor_votes_$post_id\" data-postid=\"$post_id\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"$readonly\"></div>";
|
341 |
+
|
342 |
+
}
|
343 |
+
|
344 |
+
$shortcode_html .= $span_dashicon;
|
345 |
+
$shortcode_html .= $span_text_after_star;
|
346 |
+
$shortcode_html .= $span_after_rate_it;
|
347 |
+
$shortcode_html .= "</div>";
|
348 |
+
$shortcode_html .= '<!--End Yasr Visitor Votes Shortcode-->';
|
349 |
|
350 |
//If overall rating in loop is enabled don't use is_singular && is main_query
|
351 |
if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
|
368 |
} //End function shortcode_visitor_votes_callback
|
369 |
|
370 |
|
371 |
+
/*
|
372 |
+
* Show visitor votes average, READ ONLY
|
373 |
+
*/
|
374 |
add_shortcode ('yasr_visitor_votes_readonly', 'yasr_visitor_votes_readonly_callback');
|
375 |
|
376 |
function yasr_visitor_votes_readonly_callback ($atts) {
|
377 |
|
378 |
+
$atts['readonly'] = TRUE;
|
|
|
|
|
379 |
|
380 |
+
//Here I call the same function that draw the same function for yasr_visitor_votes,
|
381 |
+
//passing the attribute readonly = TRUE
|
382 |
+
$shortcode_html = shortcode_visitor_votes_callback($atts);
|
|
|
|
|
|
|
383 |
|
384 |
+
return $shortcode_html;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
} //End function shortcode_visitor_votes_only_stars_callback
|
387 |
|
416 |
|
417 |
}
|
418 |
|
419 |
+
$shortcode_html = '<!-- Yasr Multi Set Shortcode-->';
|
|
|
|
|
420 |
|
421 |
$multiset_vote_sum = 0;
|
422 |
$multiset_rows_number = 0; //
|
447 |
|
448 |
foreach ($set_name_content as $set_content) {
|
449 |
|
450 |
+
//Avoid undefined if vote does not exists
|
451 |
+
if(!isset($set_content->vote)) {
|
452 |
+
$set_content->vote = 0;
|
453 |
+
}
|
454 |
+
|
455 |
+
$shortcode_html .= "<tr><td><span class=\"yasr-multi-set-name-field\">$set_content->name </span></td>";
|
456 |
+
|
457 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
458 |
+
|
459 |
+
$unique_id_identifier = $post_id . '_' . $setid . '_' . $set_content->id;
|
460 |
+
|
461 |
+
$shortcode_html .= "<td><div class=\"yasr-rater-stars\" id=\"yasr-rater-multiset-$unique_id_identifier\" data-rater-postid=\"$post_id\" data-rating=\"$set_content->vote\" data-rater-starsize=\"16\"></div></td>
|
462 |
+
</tr>";
|
463 |
+
}
|
464 |
+
|
465 |
+
else {
|
466 |
+
|
467 |
+
$shortcode_html .= "<td><div class=\"rateit\" id=\"$set_content->id\" data-rateit-value=\"$set_content->vote\" data-rateit-step=\"0.5\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td>
|
468 |
</tr>";
|
469 |
|
470 |
+
}
|
471 |
+
|
472 |
+
$multiset_vote_sum = $multiset_vote_sum + $set_content->vote;
|
473 |
+
$multiset_rows_number++;
|
474 |
|
475 |
}
|
476 |
|
477 |
+
if ($show_average !== FALSE && $show_average !=='no' || $show_average === FALSE && YASR_MULTI_SHOW_AVERAGE !== 'no') {
|
478 |
|
479 |
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
|
480 |
$multiset_average = round($multiset_average, 1);
|
481 |
|
482 |
$average_txt = __("Average", "yet-another-stars-rating");
|
483 |
|
484 |
+
|
485 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
486 |
+
|
487 |
+
$average_unique_id_identifier = 'yasr-multiset-average_' . $post_id . '_' . $setid;
|
488 |
+
|
489 |
+
$shortcode_html .= "<tr>
|
490 |
+
<td colspan='2' class='yasr-multiset-average'>
|
491 |
+
<span class='yasr-multiset-average-text'>$average_txt</span>
|
492 |
+
<div class='yasr-rater-stars' id=\"$average_unique_id_identifier\" data-rater-postid=\"$post_id\" data-rating=\"$multiset_average\" data-rater-starsize=\"24\"></div>
|
493 |
+
</td>
|
494 |
+
</tr>";
|
495 |
+
|
496 |
+
}
|
497 |
+
|
498 |
+
else {
|
499 |
+
|
500 |
+
$shortcode_html .= "<tr><td colspan=\"2\" class=\"yasr-multiset-average\">$average_txt<div class=\"rateit medium \" data-rateit-value=\"$multiset_average\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td></tr>";
|
501 |
+
|
502 |
+
}
|
503 |
|
504 |
}
|
505 |
|
506 |
$shortcode_html.="</table>";
|
507 |
|
508 |
+
$shortcode_html .= '<!--End Yasr Multi Set Shortcode-->';
|
|
|
|
|
509 |
|
510 |
return $shortcode_html;
|
511 |
|
533 |
|
534 |
//If it's not specified use get_the_id
|
535 |
if (!$postid) {
|
|
|
536 |
$post_id = get_the_ID();
|
|
|
537 |
}
|
538 |
|
539 |
else {
|
|
|
540 |
$post_id = $postid;
|
|
|
541 |
}
|
542 |
|
543 |
$image = YASR_IMG_DIR . "/loader.gif";
|
|
|
544 |
$average_txt = __("Average", "yet-another-stars-rating");
|
|
|
545 |
$loader_html = "<span class=\"yasr-loader-multiset-visitor\" id=\"yasr-loader-multiset-visitor-$post_id-$setid\" > " . __("Loading, please wait",'yet-another-stars-rating') . ' <img src=' . "$image" .' title="yasr-loader" alt="yasr-loader"></span>';
|
546 |
+
$button_html = "<input type=\"submit\" name=\"submit\" id=\"yasr-send-visitor-multiset-$post_id-$setid\" class=\"button button-primary \" value=\"" . __('Submit!', 'yet-another-stars-rating') . " \" />";
|
|
|
|
|
547 |
$yasr_cookiename = 'yasr_multi_visitor_cookie';
|
548 |
|
549 |
+
//Check cookie and if voting is allowed only to logged in users
|
550 |
if (isset($_COOKIE[$yasr_cookiename])) {
|
551 |
|
552 |
$cookie_data = stripslashes($_COOKIE[$yasr_cookiename]);
|
|
|
553 |
$cookie_data = unserialize($cookie_data);
|
554 |
|
555 |
foreach ($cookie_data as $value) {
|
|
|
556 |
$cookie_post_id = (int)$value['post_id'];
|
557 |
$cookie_set_id = (int)$value['set_id'];
|
558 |
|
559 |
if ($cookie_post_id === $post_id && $cookie_set_id == $setid) {
|
|
|
560 |
$button = "";
|
561 |
$star_readonly = 'true';
|
562 |
$span_message_content = __('Thank you for voting! ', 'yet-another-stars-rating');
|
567 |
}
|
568 |
|
569 |
else {
|
|
|
570 |
$button = $button_html;
|
571 |
$star_readonly = 'false';
|
572 |
$span_message_content = "";
|
|
|
573 |
}
|
|
|
574 |
}
|
|
|
|
|
575 |
}
|
576 |
|
577 |
else {
|
580 |
if (!is_user_logged_in()) {
|
581 |
|
582 |
if (YASR_ALLOWED_USER === 'allow_anonymous') {
|
|
|
583 |
$button = $button_html;
|
584 |
$star_readonly = 'false';
|
585 |
$span_message_content = "";
|
|
|
586 |
}
|
587 |
|
588 |
elseif (YASR_ALLOWED_USER === 'logged_only') {
|
|
|
589 |
$button = $button_html;
|
590 |
$star_readonly = 'true';
|
591 |
$span_message_content = "<span class=\"yasr-visitor-votes-must-sign-in\">" . __("You must sign in to vote", 'yet-another-stars-rating') . "</span>";
|
|
|
592 |
}
|
593 |
|
|
|
594 |
} //End if user logged in
|
595 |
|
596 |
//Is user is logged in
|
597 |
else {
|
598 |
+
$button = $button_html;
|
599 |
+
$star_readonly = 'false';
|
600 |
+
$span_message_content = "";
|
|
|
|
|
601 |
}
|
602 |
|
603 |
}
|
604 |
|
605 |
$set_name_content = yasr_get_multi_set_visitor ($post_id, $setid);
|
606 |
|
607 |
+
$shortcode_html = '<!-- Yasr Visitor Multi Set Shortcode-->';
|
608 |
+
$shortcode_html.="<table class=\"yasr_table_multi_set_shortcode\">";
|
|
|
609 |
|
610 |
+
if ($set_name_content) {
|
611 |
|
612 |
$multiset_vote_sum = 0;//avoid undefined variable
|
613 |
$multiset_rows_number = 0;//avoid undefined variable
|
614 |
|
|
|
|
|
615 |
foreach ($set_name_content as $set_content) {
|
616 |
|
617 |
if($set_content->number_of_votes > 0) {
|
|
|
618 |
$average_rating = $set_content->sum_votes / $set_content->number_of_votes;
|
|
|
619 |
$average_rating = round($average_rating, 1);
|
|
|
620 |
}
|
621 |
|
622 |
else {
|
|
|
623 |
$average_rating = 0;
|
624 |
+
}
|
625 |
|
626 |
+
//print stars
|
627 |
+
/*if (YASR_JQUERY_DISABLED === 'yes') {
|
628 |
+
$unique_id_identifier = 'yasr-visitor-multi-set-' . $post_id . '_' . $setid . '_' . $set_content->id;
|
629 |
+
$html_stars = "<div class=\"yasr-multiset-visitors-rater\" id=\"$unique_id_identifier\" data-rater-postid=\"$post_id\" data-rater-setid=\"$setid\" data-rater-set-field-id=\"$set_content->id\" data-rating=\"$average_rating\" data-rater-readonly=\"$star_readonly\" ></div>";
|
630 |
}
|
631 |
|
632 |
+
else{*/
|
633 |
+
$html_stars = "<div class=\"rateit yasr-visitor-multi-$post_id-$setid\" id=\"$set_content->id \" data-rateit-value=\"$average_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"$star_readonly\"></div>";
|
634 |
+
//}
|
635 |
+
|
636 |
$shortcode_html .= "<tr>
|
637 |
<td>
|
638 |
<span class=\"yasr-multi-set-name-field\">$set_content->name </span>
|
639 |
</td>
|
640 |
<td>
|
641 |
+
$html_stars
|
642 |
<span class=\"yasr-visitor-multiset-vote-count\">$set_content->number_of_votes</span>
|
643 |
</td>
|
644 |
</tr>";
|
648 |
|
649 |
} //End foreach
|
650 |
|
651 |
+
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
|
652 |
+
$multiset_average = round($multiset_average, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
653 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
}
|
655 |
|
656 |
+
//if this post has no data....
|
657 |
else {
|
658 |
|
659 |
$set_name=$wpdb->get_results($wpdb->prepare("SELECT field_name AS name, field_id AS id
|
662 |
ORDER BY field_id ASC", $setid));
|
663 |
|
664 |
|
|
|
|
|
665 |
foreach ($set_name as $set_content) {
|
666 |
|
667 |
$shortcode_html .= "<tr>
|
674 |
</td>
|
675 |
</tr>";
|
676 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
} //end foreach ($set_name as $set_content)
|
678 |
|
679 |
+
$multiset_average = 0;
|
680 |
+
|
681 |
+
}
|
682 |
|
683 |
+
//Show average row
|
684 |
+
if ($show_average !== FALSE && $show_average !=='no'|| $show_average===FALSE && YASR_MULTI_SHOW_AVERAGE !== 'no') {
|
685 |
|
686 |
+
$shortcode_html .= "<tr>
|
687 |
+
<td colspan=\"2\" class=\"yasr-multiset-average\">
|
688 |
+
$average_txt<div class=\"rateit medium \" data-rateit-value=\"$multiset_average\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
|
689 |
+
</td>
|
690 |
+
</tr>";
|
691 |
|
692 |
+
}
|
693 |
|
694 |
+
//Submit row and button
|
695 |
+
$shortcode_html.="<tr>
|
696 |
<td colspan=\"2\">
|
697 |
$button
|
698 |
$loader_html
|
699 |
<span class=\"yasr-visitor-multiset-message\">$span_message_content</span>
|
700 |
</td>
|
701 |
</tr>
|
702 |
+
";
|
703 |
|
704 |
+
$shortcode_html.="</table>";
|
705 |
|
706 |
+
$var_ajax_nonce_visitor_multiset = json_encode($ajax_nonce_visitor_multiset);
|
707 |
|
708 |
+
$shortcode_html .= '<!-- End Yasr Multi Set Visitor Shortcode-->';
|
|
|
|
|
|
|
|
|
|
|
709 |
|
710 |
wp_localize_script( 'yasrfront', "yasrMultiSetData", array(
|
711 |
'nonceVisitor' => $var_ajax_nonce_visitor_multiset,
|
718 |
}
|
719 |
|
720 |
|
|
|
|
|
721 |
/****** Add top 10 highest rated post *****/
|
722 |
|
723 |
add_shortcode ('yasr_top_ten_highest_rated', 'yasr_top_ten_highest_rated_callback');
|
734 |
ORDER BY pm.meta_value DESC, pm.post_id ASC LIMIT 10");
|
735 |
|
736 |
|
737 |
+
$shortcode_html = '<!-- Yasr Top 10 highest Rated Shortcode-->';
|
|
|
|
|
738 |
|
739 |
if ($query_result) {
|
740 |
|
743 |
foreach ($query_result as $result) {
|
744 |
|
745 |
$post_title = get_the_title($result->post_id);
|
|
|
746 |
$link = get_permalink($result->post_id); //Get permalink from post it
|
747 |
|
748 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
749 |
+
|
750 |
+
$yasr_top_ten_html_id = 'yasr-top-ten-rater-' . $result->post_id;
|
751 |
+
$html_stars = "<div class=\"yasr-rater-stars\" id=\"$yasr_top_ten_html_id\" data-rater-postid=\"$result->post_id\" data-rater-starsize=\"24\" data-rating=\"$result->overall_rating\"></div>";
|
752 |
+
|
753 |
+
}
|
754 |
+
|
755 |
+
else {
|
756 |
+
|
757 |
+
$html_stars = "<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>";
|
758 |
+
|
759 |
+
}
|
760 |
+
|
761 |
$shortcode_html .= "<tr>
|
762 |
+
<td width=\"60%\" class=\"yasr-top-10-overall-left\"><a href=\"$link\">$post_title</a></td>
|
763 |
<td width=\"40%\" class=\"yasr-top-10-overall-right\">
|
764 |
+
$html_stars
|
765 |
<span class=\"yasr-highest-rated-text\">" . __("Rating", 'yet-another-stars-rating') . " $result->overall_rating </span>
|
766 |
</td>
|
767 |
</tr>";
|
771 |
|
772 |
$shortcode_html .= "</table>";
|
773 |
|
774 |
+
$shortcode_html .= '<!--End Yasr Top 10 highest Rated Shortcode-->';
|
|
|
|
|
775 |
|
776 |
return $shortcode_html;
|
777 |
|
790 |
|
791 |
function yasr_most_or_highest_rated_posts_callback () {
|
792 |
|
793 |
+
$shortcode_html = '<!-- Yasr Most Or Highest Rated Shortcode-->';
|
|
|
|
|
|
|
794 |
|
795 |
global $wpdb;
|
796 |
|
839 |
|
840 |
$link = get_permalink($result->post_id); //Get permalink from post it
|
841 |
|
842 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
843 |
+
|
844 |
+
$yasr_top_ten_html_id = 'yasr-10-most-rater' . $result->post_id;
|
845 |
+
|
846 |
+
$html_stars = "<div class=\"yasr-rater-stars\" id=\"$yasr_top_ten_html_id\" data-rater-postid=\"$result->post_id\" data-rater-starsize=\"24\" data-rating=\"$rating\"></div>";
|
847 |
+
|
848 |
+
}
|
849 |
+
|
850 |
+
else {
|
851 |
+
|
852 |
+
$html_stars ="<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>";
|
853 |
+
|
854 |
+
}
|
855 |
+
|
856 |
+
$shortcode_html .= "<tr>
|
857 |
+
<td width=\"60%\" class=\"yasr-top-10-most-highest-left\"><a href=\"$link\">$post_title</a></td>
|
858 |
<td width=\"40%\" class=\"yasr-top-10-most-highest-right\">
|
859 |
+
$html_stars
|
860 |
+
<br /> [" . __( "Total:", 'yet-another-stars-rating' ) . "$result->number_of_votes " . __( "Average", 'yet-another-stars-rating' ) . " $rating]
|
861 |
</td>
|
862 |
</tr>";
|
863 |
|
|
|
864 |
} //End foreach
|
865 |
|
866 |
$shortcode_html .= "</table>" ;
|
891 |
|
892 |
$link = get_permalink($result->post_id); //Get permalink from post it
|
893 |
|
894 |
+
if (YASR_JQUERY_DISABLED === 'yes') {
|
895 |
+
|
896 |
+
$yasr_top_ten_html_id = 'yasr-10-highest-rater-' . $result->post_id;
|
897 |
+
|
898 |
+
$html_stars = "<div class=\"yasr-rater-stars\" id=\"$yasr_top_ten_html_id\" data-rater-postid=\"$result->post_id\" data-rater-starsize=\"24\" data-rating=\"$rating\"></div>";
|
899 |
+
|
900 |
+
}
|
901 |
+
|
902 |
+
else {
|
903 |
+
|
904 |
+
$html_stars ="<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>";
|
905 |
+
|
906 |
+
}
|
907 |
+
|
908 |
$shortcode_html .= "<tr>
|
909 |
<td width=\"60%\" class=\"yasr-top-10-most-highest-left\"><a href=\"$link\">$post_title</a></td>
|
910 |
+
<td width=\"40%\" class=\"yasr-top-10-most-highest-right\">
|
911 |
+
$html_stars
|
912 |
<br /> [" . __("Total:" , 'yet-another-stars-rating') . "$result->number_of_votes " . __("Average" , 'yet-another-stars-rating') . " $rating]
|
913 |
</td>
|
914 |
</tr>";
|
924 |
$shortcode_html = __("You've not enought data",'yet-another-stars-rating') . "<br />";
|
925 |
}
|
926 |
|
927 |
+
$shortcode_html .= '<!-- End Yasr Most Or Highest Rated Shortcode-->';
|
|
|
|
|
928 |
|
929 |
+
//if (YASR_JQUERY_DISABLED !== 'yes') {
|
930 |
+
wp_localize_script( 'yasrfront', "yasrMostHighestRanking", array(
|
931 |
+
'enable' => 'yes'
|
932 |
+
)
|
933 |
+
);
|
934 |
+
//}
|
935 |
|
936 |
return $shortcode_html;
|
937 |
|
1013 |
|
1014 |
}
|
1015 |
|
|
|
1016 |
} //End top 5 reviewers function
|
1017 |
|
1018 |
|
|
|
|
|
|
|
1019 |
/****** Add top 10 most active user *****/
|
1020 |
|
1021 |
add_shortcode ('yasr_top_ten_active_users', 'yasr_top_ten_active_users_callback');
|
1034 |
|
1035 |
if ($query_result) {
|
1036 |
|
1037 |
+
$shortcode_html = '<!-- Yasr Top 10 Active Users Shortcode-->';
|
|
|
|
|
1038 |
|
1039 |
$shortcode_html .= "
|
1040 |
<table class=\"yasr-table-chart\">
|
1070 |
|
1071 |
$shortcode_html .= "</table>";
|
1072 |
|
1073 |
+
$shortcode_html .= '<!--End Yasr Top 10 Active Users Shortcode-->';
|
|
|
|
|
1074 |
|
1075 |
return $shortcode_html;
|
1076 |
|
1138 |
$average" . sprintf(__(' based on %d votes', 'yet-another-stars-rating'), $results->number_of_votes); "
|
1139 |
</td>
|
1140 |
</tr>";
|
1141 |
+
|
|
|
1142 |
$field_name = $results->field_name;
|
1143 |
|
1144 |
}
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Tags: ratings, rating, postrating, google rating, 5 star, review, reviews, star
|
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.0
|
7 |
-
Requires PHP: 5.
|
8 |
-
Stable tag: 1.6.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
@@ -108,6 +108,13 @@ Of course not: you can easily add it on the visual editor just by clicking the "
|
|
108 |
|
109 |
The full changelog can be found in the plugin's directory. Recent entries:
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
= 1.6.8 =
|
112 |
* Fixed css for tooltip stats
|
113 |
|
@@ -146,5 +153,6 @@ You can enable/disable this in every moment in the settings
|
|
146 |
* FIXED: star disappear after user rating in some circumstances
|
147 |
* FIXED: javascript noticies
|
148 |
|
149 |
-
|
150 |
-
|
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.0
|
7 |
+
Requires PHP: 5.3
|
8 |
+
Stable tag: 1.6.9
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
108 |
|
109 |
The full changelog can be found in the plugin's directory. Recent entries:
|
110 |
|
111 |
+
= 1.6.9 =
|
112 |
+
* TWEAKED: Most of work have been done on making Yasr working without jquery. This is still in beta but now supports all shortcodes
|
113 |
+
except "yasr_visitor_multiset" one
|
114 |
+
* TWEAKED: yasr_visitor_votes_readonly is now just a call to 'yasr_visitor_votes readonly="yes" '
|
115 |
+
* TWEAKED: Huge code cleanup
|
116 |
+
* TWEAKED: Php version required is now 5.3 instead 5.4
|
117 |
+
|
118 |
= 1.6.8 =
|
119 |
* Fixed css for tooltip stats
|
120 |
|
153 |
* FIXED: star disappear after user rating in some circumstances
|
154 |
* FIXED: javascript noticies
|
155 |
|
156 |
+
= Additional Info =
|
157 |
+
Svg star icon made by [Freepik](http://www.freepik.com)
|
158 |
+
from [www.flaticon.com](https://www.flaticon.com/)is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
|
yet-another-stars-rating.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
|
7 |
-
* Version: 1.6.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -74,7 +74,7 @@ function yasr_fs()
|
|
74 |
yasr_fs();
|
75 |
// Signal that SDK was initiated.
|
76 |
do_action( 'yasr_fs_loaded' );
|
77 |
-
define( 'YASR_VERSION_NUM', '1.6.
|
78 |
//Plugin relative path
|
79 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
80 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
|
7 |
+
* Version: 1.6.9
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
74 |
yasr_fs();
|
75 |
// Signal that SDK was initiated.
|
76 |
do_action( 'yasr_fs_loaded' );
|
77 |
+
define( 'YASR_VERSION_NUM', '1.6.9' );
|
78 |
//Plugin relative path
|
79 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
80 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|