Version Description
- TWEAKED: settings redesigned
- TWEAKED: code cleanup
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.9.5 |
Comparing to | |
See all releases |
Code changes from version 1.9.4 to 1.9.5
- css/yasr-admin.css +125 -94
- img/yasr-pro-stars.png +0 -0
- js/yasr-admin.js +441 -476
- lib/admin/editor/yasr-metabox-top-right.php +9 -12
- lib/admin/settings/yasr-settings-functions-misc.php +87 -40
- lib/admin/settings/yasr-settings-functions.php +169 -162
- lib/yasr-ajax-functions.php +36 -108
- lib/yasr-db-functions.php +32 -33
- lib/yasr-functions.php +534 -586
- readme.txt +7 -8
- yasr-settings-page.php +144 -151
- yasr-stats-page.php +3 -4
- yet-another-stars-rating.php +3 -3
css/yasr-admin.css
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
.star-rating {
|
2 |
width: 0;
|
3 |
position: relative;
|
4 |
-
display:inline-block;
|
5 |
background-image: url(../img/star_0.svg);
|
6 |
background-position: 0 0;
|
7 |
background-repeat: repeat-x;
|
@@ -23,7 +23,7 @@
|
|
23 |
-webkit-box-shadow: 0px 0px 4px #222;
|
24 |
box-shadow: 0px 0px 4px #222;
|
25 |
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
26 |
-
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
|
27 |
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
|
28 |
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
29 |
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
@@ -39,7 +39,7 @@
|
|
39 |
position: absolute;
|
40 |
height: 100%;
|
41 |
width: 100%;
|
42 |
-
background: url('../img/star_1.svg')
|
43 |
background-repeat: repeat-x;
|
44 |
}
|
45 |
|
@@ -72,9 +72,8 @@
|
|
72 |
|
73 |
/*** End metabox overall rating ***/
|
74 |
|
75 |
-
#multi_rating_table
|
76 |
-
|
77 |
-
vertical-align: text-top;
|
78 |
}
|
79 |
|
80 |
.yasr-form-result {
|
@@ -83,7 +82,7 @@
|
|
83 |
|
84 |
/**** Metabox multi ****/
|
85 |
#yasr-multi-set-admin-choose-text {
|
86 |
-
display:none;
|
87 |
margin-bottom: 15px;
|
88 |
margin-top: 10px;
|
89 |
}
|
@@ -123,30 +122,41 @@
|
|
123 |
}
|
124 |
|
125 |
.nav-tab-active, .nav-tab-active:hover {
|
126 |
-
background-color: white
|
127 |
}
|
128 |
|
129 |
/*** End top navigation ***/
|
130 |
|
131 |
|
132 |
-
|
133 |
/*** On / Off Switch ***/
|
134 |
|
135 |
.yasr-onoffswitch-big {
|
136 |
-
position: relative;
|
137 |
-
|
|
|
|
|
|
|
138 |
}
|
|
|
139 |
.yasr-onoffswitch-checkbox {
|
140 |
display: none !important;
|
141 |
}
|
|
|
142 |
.yasr-onoffswitch-label {
|
143 |
-
display: block;
|
144 |
-
|
|
|
|
|
|
|
145 |
}
|
|
|
146 |
.yasr-onoffswitch-inner {
|
147 |
-
display: block;
|
|
|
|
|
148 |
transition: margin 0.3s ease-in 0s;
|
149 |
}
|
|
|
150 |
.yasr-onoffswitch-inner:before, .yasr-onoffswitch-inner:after {
|
151 |
display: block;
|
152 |
float: left;
|
@@ -161,31 +171,40 @@
|
|
161 |
box-sizing: border-box !important; /*important for Gutenberg compatibility*/
|
162 |
|
163 |
}
|
|
|
164 |
.yasr-onoffswitch-inner:before {
|
165 |
content: "YES";
|
166 |
padding-left: 9px;
|
167 |
-
background-color: #EEEEEE;
|
|
|
168 |
}
|
|
|
169 |
.yasr-onoffswitch-inner:after {
|
170 |
content: "NO";
|
171 |
padding-right: 15px;
|
172 |
-
background-color: #EEEEEE;
|
|
|
173 |
text-align: right;
|
174 |
}
|
|
|
175 |
.yasr-onoffswitch-switch {
|
176 |
display: block;
|
177 |
width: 30px;
|
178 |
margin: 0px;
|
179 |
background: #A1A1A1;
|
180 |
-
position: absolute;
|
|
|
|
|
181 |
right: 51px;
|
182 |
-
border: 2px solid #FFFFFF;
|
|
|
183 |
transition: all 0.1s ease-in 0s;
|
184 |
}
|
185 |
|
186 |
.yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-inner {
|
187 |
margin-left: 0;
|
188 |
}
|
|
|
189 |
.yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-switch {
|
190 |
right: 0px;
|
191 |
background-color: #34A7C1;
|
@@ -195,12 +214,15 @@
|
|
195 |
.yasr-onoffswitch-onoff-inner:before {
|
196 |
content: "ON";
|
197 |
padding-left: 15px;
|
198 |
-
background-color: #EEEEEE;
|
|
|
199 |
}
|
|
|
200 |
.yasr-onoffswitch-onoff-inner:after {
|
201 |
content: "OFF";
|
202 |
padding-right: 9px;
|
203 |
-
background-color: #EEEEEE;
|
|
|
204 |
text-align: right;
|
205 |
}
|
206 |
|
@@ -208,72 +230,46 @@
|
|
208 |
.yasr-onoffswitch-notext-inner:before {
|
209 |
content: "";
|
210 |
padding-left: 9px;
|
211 |
-
background-color: #EEEEEE;
|
|
|
212 |
}
|
|
|
213 |
.yasr-onoffswitch-notext-inner:after {
|
214 |
content: "";
|
215 |
padding-right: 15px;
|
216 |
-
background-color: #EEEEEE;
|
|
|
217 |
text-align: right;
|
218 |
}
|
219 |
|
220 |
-
|
221 |
/*** End on of switch ***/
|
222 |
|
223 |
-
|
224 |
@media (min-width: 1177px) {
|
225 |
|
226 |
.yasr-settingsdiv {
|
227 |
-
|
228 |
-
display:block;
|
229 |
-
width:60%;
|
230 |
-
background-color
|
231 |
border: 1px solid #DDD;
|
232 |
padding-left: 25px;
|
233 |
padding-right: 25px;
|
234 |
padding-bottom: 10px;
|
|
|
235 |
}
|
236 |
|
237 |
.yasr-donatedivdx {
|
238 |
-
float:right;
|
239 |
-
display:block !important;
|
240 |
min-width: 290px;
|
241 |
-
width:15%;
|
242 |
margin-bottom: 10px;
|
243 |
-
background-color
|
244 |
border: 1px solid #DDD;
|
245 |
-
|
246 |
-
|
247 |
-
}
|
248 |
-
|
249 |
-
.yasr-upgrade-to-pro {
|
250 |
-
|
251 |
font-size: 14px;
|
252 |
-
|
253 |
-
}
|
254 |
-
|
255 |
-
.yasr-upgrade-to-pro li::before {
|
256 |
-
|
257 |
-
margin-right: 7px;
|
258 |
-
left: 0;
|
259 |
-
font-weight: 700;
|
260 |
-
content: "+";
|
261 |
-
|
262 |
-
}
|
263 |
-
|
264 |
-
.yasr-ask-five-stars {
|
265 |
-
|
266 |
-
float:right;
|
267 |
-
display:block;
|
268 |
-
min-width: 290px;
|
269 |
-
width:15%;
|
270 |
-
margin-bottom: 10px;
|
271 |
-
background-color:#FFF;
|
272 |
-
border-left: 3px solid #7AD03A;
|
273 |
-
padding: 25px;
|
274 |
-
font-size: 14px;
|
275 |
-
/*color: #015316;*/
|
276 |
-
|
277 |
}
|
278 |
|
279 |
}
|
@@ -283,10 +279,10 @@
|
|
283 |
@media (max-width: 1176px) {
|
284 |
|
285 |
.yasr-settingsdiv {
|
286 |
-
float:left;
|
287 |
-
display:block;
|
288 |
-
width:95%;
|
289 |
-
background-color
|
290 |
border: 1px solid #DDD;
|
291 |
padding-left: 10px;
|
292 |
padding-right: 10px;
|
@@ -294,9 +290,9 @@
|
|
294 |
}
|
295 |
|
296 |
.yasr-donatedivbottom {
|
297 |
-
display:block !important;
|
298 |
-
width:95%;
|
299 |
-
background-color
|
300 |
margin-top: 10px;
|
301 |
border: 1px solid #DDD;
|
302 |
padding: 10px;
|
@@ -305,6 +301,47 @@
|
|
305 |
|
306 |
}
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
.yasr-option-size {
|
309 |
vertical-align: bottom;
|
310 |
display: block;
|
@@ -335,7 +372,7 @@
|
|
335 |
}
|
336 |
|
337 |
.yasr-list-set-table {
|
338 |
-
margin-left:5px;
|
339 |
}
|
340 |
|
341 |
.yasr-space-settings-div {
|
@@ -349,7 +386,6 @@
|
|
349 |
}
|
350 |
|
351 |
|
352 |
-
|
353 |
/*** Rules for Multi set page ***/
|
354 |
|
355 |
.yasr-multi-set-form-headers {
|
@@ -357,12 +393,12 @@
|
|
357 |
}
|
358 |
|
359 |
.yasr-multi-set-left {
|
360 |
-
float:left;
|
361 |
width: 40%;
|
362 |
}
|
363 |
|
364 |
.yasr-multi-set-right {
|
365 |
-
float:right;
|
366 |
width: 55%;
|
367 |
}
|
368 |
|
@@ -391,7 +427,7 @@
|
|
391 |
}
|
392 |
|
393 |
|
394 |
-
.yasr-input-text-multi-set{
|
395 |
margin-left: 30px;
|
396 |
margin-bottom: 10px;
|
397 |
}
|
@@ -456,17 +492,18 @@
|
|
456 |
}
|
457 |
}
|
458 |
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
|
463 |
.yasr_table_multi_set_admin tr:nth-child(odd) {
|
464 |
-
|
465 |
-
|
466 |
-
|
|
|
467 |
.yasr_table_multi_set_admin tr:nth-child(even) {
|
468 |
-
|
469 |
-
|
470 |
|
471 |
|
472 |
.yasr-multi-set-choose-theme {
|
@@ -477,8 +514,6 @@
|
|
477 |
}
|
478 |
|
479 |
|
480 |
-
|
481 |
-
|
482 |
/*** End rules for multi set admin page ***/
|
483 |
|
484 |
/**** Yasr Aspect & Styles tab ***/
|
@@ -492,8 +527,8 @@
|
|
492 |
|
493 |
#yasr-settings-stylish-image {
|
494 |
|
495 |
-
max-width:100%;
|
496 |
-
height:auto;
|
497 |
|
498 |
}
|
499 |
|
@@ -543,12 +578,9 @@
|
|
543 |
}
|
544 |
|
545 |
|
546 |
-
|
547 |
/**** End Yasr Aspect & Styles tab ***/
|
548 |
|
549 |
|
550 |
-
|
551 |
-
|
552 |
/*** Popup in tinymce ***/
|
553 |
|
554 |
|
@@ -587,8 +619,7 @@
|
|
587 |
/*** End popup tinymce***/
|
588 |
|
589 |
|
590 |
-
|
591 |
-
.yasr-log-container {
|
592 |
width: 98%;
|
593 |
}
|
594 |
|
@@ -601,7 +632,7 @@
|
|
601 |
.yasr-log-image {
|
602 |
list-style-type: none;
|
603 |
display: inline-block;
|
604 |
-
float:left;
|
605 |
}
|
606 |
|
607 |
.yasr-log-child-head {
|
@@ -625,7 +656,7 @@
|
|
625 |
}
|
626 |
|
627 |
.yasr-log-ip {
|
628 |
-
float:left;
|
629 |
padding-left: 5px;
|
630 |
}
|
631 |
|
1 |
.star-rating {
|
2 |
width: 0;
|
3 |
position: relative;
|
4 |
+
display: inline-block;
|
5 |
background-image: url(../img/star_0.svg);
|
6 |
background-position: 0 0;
|
7 |
background-repeat: repeat-x;
|
23 |
-webkit-box-shadow: 0px 0px 4px #222;
|
24 |
box-shadow: 0px 0px 4px #222;
|
25 |
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
26 |
+
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #eeeeee), color-stop(1, #cccccc));
|
27 |
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
|
28 |
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
29 |
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
39 |
position: absolute;
|
40 |
height: 100%;
|
41 |
width: 100%;
|
42 |
+
background: url('../img/star_1.svg');
|
43 |
background-repeat: repeat-x;
|
44 |
}
|
45 |
|
72 |
|
73 |
/*** End metabox overall rating ***/
|
74 |
|
75 |
+
#multi_rating_table {
|
76 |
+
vertical-align: text-top;
|
|
|
77 |
}
|
78 |
|
79 |
.yasr-form-result {
|
82 |
|
83 |
/**** Metabox multi ****/
|
84 |
#yasr-multi-set-admin-choose-text {
|
85 |
+
display: none;
|
86 |
margin-bottom: 15px;
|
87 |
margin-top: 10px;
|
88 |
}
|
122 |
}
|
123 |
|
124 |
.nav-tab-active, .nav-tab-active:hover {
|
125 |
+
background-color: white;
|
126 |
}
|
127 |
|
128 |
/*** End top navigation ***/
|
129 |
|
130 |
|
|
|
131 |
/*** On / Off Switch ***/
|
132 |
|
133 |
.yasr-onoffswitch-big {
|
134 |
+
position: relative;
|
135 |
+
width: 85px;
|
136 |
+
-webkit-user-select: none;
|
137 |
+
-moz-user-select: none;
|
138 |
+
-ms-user-select: none;
|
139 |
}
|
140 |
+
|
141 |
.yasr-onoffswitch-checkbox {
|
142 |
display: none !important;
|
143 |
}
|
144 |
+
|
145 |
.yasr-onoffswitch-label {
|
146 |
+
display: block;
|
147 |
+
overflow: hidden;
|
148 |
+
cursor: pointer;
|
149 |
+
border: 2px solid #FFFFFF;
|
150 |
+
border-radius: 35px;
|
151 |
}
|
152 |
+
|
153 |
.yasr-onoffswitch-inner {
|
154 |
+
display: block;
|
155 |
+
width: 200%;
|
156 |
+
margin-left: -100%;
|
157 |
transition: margin 0.3s ease-in 0s;
|
158 |
}
|
159 |
+
|
160 |
.yasr-onoffswitch-inner:before, .yasr-onoffswitch-inner:after {
|
161 |
display: block;
|
162 |
float: left;
|
171 |
box-sizing: border-box !important; /*important for Gutenberg compatibility*/
|
172 |
|
173 |
}
|
174 |
+
|
175 |
.yasr-onoffswitch-inner:before {
|
176 |
content: "YES";
|
177 |
padding-left: 9px;
|
178 |
+
background-color: #EEEEEE;
|
179 |
+
color: #34A7C1;
|
180 |
}
|
181 |
+
|
182 |
.yasr-onoffswitch-inner:after {
|
183 |
content: "NO";
|
184 |
padding-right: 15px;
|
185 |
+
background-color: #EEEEEE;
|
186 |
+
color: #999999;
|
187 |
text-align: right;
|
188 |
}
|
189 |
+
|
190 |
.yasr-onoffswitch-switch {
|
191 |
display: block;
|
192 |
width: 30px;
|
193 |
margin: 0px;
|
194 |
background: #A1A1A1;
|
195 |
+
position: absolute;
|
196 |
+
top: 0;
|
197 |
+
bottom: 0;
|
198 |
right: 51px;
|
199 |
+
border: 2px solid #FFFFFF;
|
200 |
+
border-radius: 35px;
|
201 |
transition: all 0.1s ease-in 0s;
|
202 |
}
|
203 |
|
204 |
.yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-inner {
|
205 |
margin-left: 0;
|
206 |
}
|
207 |
+
|
208 |
.yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-switch {
|
209 |
right: 0px;
|
210 |
background-color: #34A7C1;
|
214 |
.yasr-onoffswitch-onoff-inner:before {
|
215 |
content: "ON";
|
216 |
padding-left: 15px;
|
217 |
+
background-color: #EEEEEE;
|
218 |
+
color: #34A7C1;
|
219 |
}
|
220 |
+
|
221 |
.yasr-onoffswitch-onoff-inner:after {
|
222 |
content: "OFF";
|
223 |
padding-right: 9px;
|
224 |
+
background-color: #EEEEEE;
|
225 |
+
color: #999999;
|
226 |
text-align: right;
|
227 |
}
|
228 |
|
230 |
.yasr-onoffswitch-notext-inner:before {
|
231 |
content: "";
|
232 |
padding-left: 9px;
|
233 |
+
background-color: #EEEEEE;
|
234 |
+
color: #34A7C1;
|
235 |
}
|
236 |
+
|
237 |
.yasr-onoffswitch-notext-inner:after {
|
238 |
content: "";
|
239 |
padding-right: 15px;
|
240 |
+
background-color: #EEEEEE;
|
241 |
+
color: #999999;
|
242 |
text-align: right;
|
243 |
}
|
244 |
|
|
|
245 |
/*** End on of switch ***/
|
246 |
|
|
|
247 |
@media (min-width: 1177px) {
|
248 |
|
249 |
.yasr-settingsdiv {
|
250 |
+
float: left;
|
251 |
+
display: block;
|
252 |
+
width: 60%;
|
253 |
+
background-color: #FFF;
|
254 |
border: 1px solid #DDD;
|
255 |
padding-left: 25px;
|
256 |
padding-right: 25px;
|
257 |
padding-bottom: 10px;
|
258 |
+
min-height: 560px;
|
259 |
}
|
260 |
|
261 |
.yasr-donatedivdx {
|
262 |
+
float: right;
|
263 |
+
display: block !important;
|
264 |
min-width: 290px;
|
265 |
+
width: 15%;
|
266 |
margin-bottom: 10px;
|
267 |
+
background-color: #FFF;
|
268 |
border: 1px solid #DDD;
|
269 |
+
border-radius: 9px;
|
270 |
+
padding: 20px;
|
|
|
|
|
|
|
|
|
271 |
font-size: 14px;
|
272 |
+
box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.15);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
}
|
274 |
|
275 |
}
|
279 |
@media (max-width: 1176px) {
|
280 |
|
281 |
.yasr-settingsdiv {
|
282 |
+
float: left;
|
283 |
+
display: block;
|
284 |
+
width: 95%;
|
285 |
+
background-color: #FFF;
|
286 |
border: 1px solid #DDD;
|
287 |
padding-left: 10px;
|
288 |
padding-right: 10px;
|
290 |
}
|
291 |
|
292 |
.yasr-donatedivbottom {
|
293 |
+
display: block !important;
|
294 |
+
width: 95%;
|
295 |
+
background-color: #FFF;
|
296 |
margin-top: 10px;
|
297 |
border: 1px solid #DDD;
|
298 |
padding: 10px;
|
301 |
|
302 |
}
|
303 |
|
304 |
+
.yasr-donate-title{
|
305 |
+
margin-top: 0px;
|
306 |
+
margin-bottom: 20px;
|
307 |
+
padding-bottom: 10px;
|
308 |
+
border-bottom: 1px solid #ddd;
|
309 |
+
font-size: 1.3em;
|
310 |
+
color: #23282d;
|
311 |
+
display: block;
|
312 |
+
font-weight: 600;
|
313 |
+
}
|
314 |
+
|
315 |
+
.yasr-donate-single-resource{
|
316 |
+
margin-bottom: 12px;
|
317 |
+
padding-bottom: 4px;
|
318 |
+
border-bottom: 1px solid #ddd;
|
319 |
+
display: block;
|
320 |
+
}
|
321 |
+
|
322 |
+
.yasr-donate-single-resource:last-child {
|
323 |
+
border: none;
|
324 |
+
margin-bottom: 0px;
|
325 |
+
padding-bottom: 0px;
|
326 |
+
}
|
327 |
+
|
328 |
+
.yasr-donate-single-resource a{
|
329 |
+
text-decoration: none;
|
330 |
+
font-size: 15px;
|
331 |
+
vertical-align: bottom;
|
332 |
+
}
|
333 |
+
|
334 |
+
.yasr-upgrade-to-pro {
|
335 |
+
font-size: 14px;
|
336 |
+
}
|
337 |
+
|
338 |
+
.yasr-upgrade-to-pro li::before {
|
339 |
+
margin-right: 7px;
|
340 |
+
left: 0;
|
341 |
+
font-weight: 700;
|
342 |
+
content: "+";
|
343 |
+
}
|
344 |
+
|
345 |
.yasr-option-size {
|
346 |
vertical-align: bottom;
|
347 |
display: block;
|
372 |
}
|
373 |
|
374 |
.yasr-list-set-table {
|
375 |
+
margin-left: 5px;
|
376 |
}
|
377 |
|
378 |
.yasr-space-settings-div {
|
386 |
}
|
387 |
|
388 |
|
|
|
389 |
/*** Rules for Multi set page ***/
|
390 |
|
391 |
.yasr-multi-set-form-headers {
|
393 |
}
|
394 |
|
395 |
.yasr-multi-set-left {
|
396 |
+
float: left;
|
397 |
width: 40%;
|
398 |
}
|
399 |
|
400 |
.yasr-multi-set-right {
|
401 |
+
float: right;
|
402 |
width: 55%;
|
403 |
}
|
404 |
|
427 |
}
|
428 |
|
429 |
|
430 |
+
.yasr-input-text-multi-set {
|
431 |
margin-left: 30px;
|
432 |
margin-bottom: 10px;
|
433 |
}
|
492 |
}
|
493 |
}
|
494 |
|
495 |
+
.yasr_table_multi_set_admin td {
|
496 |
+
width: 50%
|
497 |
+
}
|
498 |
|
499 |
.yasr_table_multi_set_admin tr:nth-child(odd) {
|
500 |
+
background: #feffd3;
|
501 |
+
}
|
502 |
+
|
503 |
+
/* Define the background color for all the EVEN background rows */
|
504 |
.yasr_table_multi_set_admin tr:nth-child(even) {
|
505 |
+
background: #FFFFFF;
|
506 |
+
}
|
507 |
|
508 |
|
509 |
.yasr-multi-set-choose-theme {
|
514 |
}
|
515 |
|
516 |
|
|
|
|
|
517 |
/*** End rules for multi set admin page ***/
|
518 |
|
519 |
/**** Yasr Aspect & Styles tab ***/
|
527 |
|
528 |
#yasr-settings-stylish-image {
|
529 |
|
530 |
+
max-width: 100%;
|
531 |
+
height: auto;
|
532 |
|
533 |
}
|
534 |
|
578 |
}
|
579 |
|
580 |
|
|
|
581 |
/**** End Yasr Aspect & Styles tab ***/
|
582 |
|
583 |
|
|
|
|
|
584 |
/*** Popup in tinymce ***/
|
585 |
|
586 |
|
619 |
/*** End popup tinymce***/
|
620 |
|
621 |
|
622 |
+
.yasr-log-container {
|
|
|
623 |
width: 98%;
|
624 |
}
|
625 |
|
632 |
.yasr-log-image {
|
633 |
list-style-type: none;
|
634 |
display: inline-block;
|
635 |
+
float: left;
|
636 |
}
|
637 |
|
638 |
.yasr-log-child-head {
|
656 |
}
|
657 |
|
658 |
.yasr-log-ip {
|
659 |
+
float: left;
|
660 |
padding-left: 5px;
|
661 |
}
|
662 |
|
img/yasr-pro-stars.png
CHANGED
Binary file
|
js/yasr-admin.js
CHANGED
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
25 |
|
26 |
/****** Yasr Metabox overall rating, used for classic editor ******/
|
27 |
|
28 |
-
function yasrPrintMetaBoxOverall(
|
29 |
|
30 |
//Convert string to number
|
31 |
overallRating = parseFloat(overallRating);
|
@@ -62,7 +62,7 @@ function yasrPrintMetaBoxOverall(postid, overallRating) {
|
|
62 |
|
63 |
/****** Yasr Metabox Multiple Rating ******/
|
64 |
|
65 |
-
function yasrAdminMultiSet(nMultiSet, postid, setId, nonceMulti){
|
66 |
|
67 |
nMultiSet = parseInt(nMultiSet);
|
68 |
|
@@ -70,9 +70,7 @@ function yasrAdminMultiSet(nMultiSet, postid, setId, nonceMulti){
|
|
70 |
|
71 |
yasrPrintAdminMultiSet(setId, postid, nonceMulti, nMultiSet);
|
72 |
|
73 |
-
}
|
74 |
-
|
75 |
-
else {
|
76 |
|
77 |
jQuery('#yasr-button-select-set').on("click", function () {
|
78 |
|
@@ -90,7 +88,7 @@ function yasrAdminMultiSet(nMultiSet, postid, setId, nonceMulti){
|
|
90 |
}
|
91 |
|
92 |
//print the table
|
93 |
-
function yasrPrintAdminMultiSet
|
94 |
|
95 |
var data_id = {
|
96 |
action: 'yasr_send_id_nameset',
|
@@ -98,7 +96,7 @@ function yasrPrintAdminMultiSet (setId, postid, nonceMulti, nMultiSet) {
|
|
98 |
post_id: postid
|
99 |
};
|
100 |
|
101 |
-
jQuery.post(ajaxurl, data_id, function(response) {
|
102 |
|
103 |
//Hide the loader near the select only if more multiset are used
|
104 |
if (nMultiSet !== 1) {
|
@@ -117,9 +115,9 @@ function yasrPrintAdminMultiSet (setId, postid, nonceMulti, nMultiSet) {
|
|
117 |
|
118 |
content += '<tr>';
|
119 |
content += '<td>' + valueName + '</td>';
|
120 |
-
content += '<td><div class="yasr-multiset-admin" id="yasr-multiset-admin-' + valueID + '" data-rating="' + valueRating + '" data-multi-idfield="'+valueID+'"></div>';
|
121 |
content += '<span id="yasr-loader-multi-set-field-' + valueID + '" style="display: none">';
|
122 |
-
content += '<img src="'+yasrCommonDataAdmin.loaderHtml+'"></span>';
|
123 |
content += '</span>';
|
124 |
content += '</td>';
|
125 |
content += '</tr>';
|
@@ -131,16 +129,16 @@ function yasrPrintAdminMultiSet (setId, postid, nonceMulti, nMultiSet) {
|
|
131 |
}
|
132 |
|
133 |
//Show the text "Choose a vote"
|
134 |
-
document.getElementById('yasr-multi-set-admin-choose-text').style.display='block';
|
135 |
|
136 |
//Set rater for divs
|
137 |
-
yasrSetRaterAdminMulti
|
138 |
|
139 |
//Show shortcode
|
140 |
-
document.getElementById('yasr-multi-set-admin-explain').style.display='block';
|
141 |
|
142 |
-
document.getElementById('yasr-multi-set-admin-explain-with-id-readonly').innerHTML = '<strong>[yasr_multiset setid='+setId+']</strong>';
|
143 |
-
document.getElementById('yasr-multi-set-admin-explain-with-id-visitor').innerHTML = '<strong>[yasr_visitor_multiset setid='+setId+']</strong>';
|
144 |
|
145 |
});
|
146 |
|
@@ -149,13 +147,13 @@ function yasrPrintAdminMultiSet (setId, postid, nonceMulti, nMultiSet) {
|
|
149 |
}
|
150 |
|
151 |
//Rater for multiset
|
152 |
-
function yasrSetRaterAdminMulti
|
153 |
|
154 |
var yasrMultiSetAdmin = document.getElementsByClassName('yasr-multiset-admin');
|
155 |
|
156 |
-
for (var i=0; i<yasrMultiSetAdmin.length; i++) {
|
157 |
|
158 |
-
(function(i) {
|
159 |
|
160 |
var htmlId = yasrMultiSetAdmin.item(i).id;
|
161 |
var idField = yasrMultiSetAdmin.item(i).getAttribute('data-multi-idfield');
|
@@ -211,244 +209,240 @@ function yasrSetRaterAdminMulti (postid, setId, nonceMulti) {
|
|
211 |
|
212 |
/****** Yasr Settings Page ******/
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
//-------------------General Settings Code---------------------
|
217 |
|
218 |
-
|
219 |
|
220 |
-
|
221 |
-
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
222 |
-
}
|
223 |
|
224 |
-
|
225 |
-
jQuery('
|
226 |
-
|
227 |
-
jQuery('.yasr-auto-insert-options-class').prop('disabled', false);
|
228 |
-
}
|
229 |
-
else {
|
230 |
-
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
231 |
-
}
|
232 |
-
});
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
|
|
|
|
237 |
}
|
|
|
238 |
|
239 |
-
|
240 |
-
|
|
|
|
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
|
245 |
-
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
|
246 |
-
jQuery('#yasr-general-options-custom-text-must-sign-in').val('You must sign in to vote');
|
247 |
-
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
|
248 |
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
});
|
256 |
|
|
|
257 |
|
258 |
-
/*if (jQuery('#yasr_text_before_star_off').is(':checked')) {
|
259 |
-
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
260 |
-
}
|
261 |
|
262 |
-
|
|
|
|
|
263 |
|
264 |
-
|
265 |
-
jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
|
266 |
-
jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
|
267 |
-
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
|
268 |
-
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
|
269 |
|
270 |
-
|
|
|
|
|
|
|
|
|
271 |
|
272 |
-
|
273 |
-
jQuery('#yasr-doc-custom-text-div').toggle('slow');
|
274 |
-
return false;
|
275 |
-
});
|
276 |
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
|
|
|
|
|
|
|
|
|
282 |
|
283 |
-
/*//If on document ready "BlogPosting" is checked show the additional fields
|
284 |
-
if (jQuery('#yasr_choose_snippet_blogposting').is(':checked')) {
|
285 |
-
jQuery('#yasr-blogPosting-additional-info').show();
|
286 |
-
jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', false);
|
287 |
-
}
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
292 |
|
293 |
-
|
|
|
|
|
294 |
|
295 |
-
|
296 |
-
jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', false);
|
297 |
|
298 |
-
|
|
|
299 |
|
300 |
-
|
301 |
-
jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', true);
|
302 |
-
jQuery('#yasr-blogPosting-additional-info').hide();
|
303 |
|
304 |
-
|
|
|
|
|
305 |
|
306 |
-
|
307 |
|
308 |
-
|
309 |
|
310 |
-
|
311 |
|
312 |
-
|
313 |
|
314 |
-
|
315 |
|
316 |
-
|
317 |
-
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
318 |
-
});
|
319 |
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
|
324 |
-
|
|
|
|
|
325 |
|
326 |
-
|
327 |
|
328 |
-
|
329 |
|
330 |
-
|
331 |
|
332 |
-
|
333 |
-
jQuery('#yasr-element-limit').show();
|
334 |
-
jQuery('#yasr-add-field-edit-multiset').hide();
|
335 |
-
return false;
|
336 |
-
}
|
337 |
|
338 |
-
|
|
|
|
|
|
|
|
|
339 |
|
340 |
-
|
341 |
|
342 |
-
|
343 |
|
344 |
-
|
345 |
|
346 |
-
|
347 |
|
|
|
348 |
|
349 |
-
} //End if ($n_multi_set == 1)
|
350 |
|
351 |
-
|
352 |
|
353 |
-
|
354 |
-
jQuery('#yasr-button-select-set-edit-form').on("click", function() {
|
355 |
|
356 |
-
|
357 |
-
|
358 |
-
set_id : jQuery('#yasr_select_edit_set').val()
|
359 |
-
}
|
360 |
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
|
366 |
-
|
|
|
|
|
|
|
367 |
|
368 |
-
|
369 |
|
370 |
-
|
371 |
|
372 |
-
|
373 |
|
374 |
-
|
375 |
|
376 |
-
|
377 |
|
378 |
-
|
379 |
-
jQuery('#yasr-element-limit').show();
|
380 |
-
jQuery('#yasr-add-field-edit-multiset').hide();
|
381 |
-
return false;
|
382 |
-
}
|
383 |
|
384 |
-
|
|
|
|
|
|
|
|
|
385 |
|
386 |
-
|
387 |
|
388 |
-
|
389 |
|
390 |
-
|
391 |
|
392 |
-
|
393 |
|
394 |
-
|
395 |
|
396 |
-
|
397 |
|
|
|
398 |
|
399 |
|
400 |
-
|
401 |
|
402 |
|
403 |
-
|
404 |
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
|
410 |
-
|
411 |
|
412 |
|
413 |
-
|
414 |
|
415 |
-
|
416 |
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
|
421 |
-
|
422 |
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
|
428 |
-
|
429 |
|
430 |
-
|
431 |
|
432 |
-
|
433 |
|
434 |
|
435 |
-
|
436 |
-
|
437 |
|
438 |
-
|
439 |
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
|
446 |
-
|
447 |
|
448 |
-
|
449 |
|
450 |
|
451 |
-
|
452 |
|
453 |
/****** End Yasr Settings Page ******/
|
454 |
|
@@ -456,473 +450,444 @@ function yasrSetRaterAdminMulti (postid, setId, nonceMulti) {
|
|
456 |
/****** Yasr Ajax Page ******/
|
457 |
|
458 |
|
459 |
-
|
460 |
|
461 |
-
|
462 |
|
463 |
-
|
464 |
-
|
465 |
|
466 |
-
|
467 |
-
|
468 |
|
469 |
-
|
470 |
-
|
471 |
|
472 |
-
|
473 |
|
474 |
-
|
475 |
|
476 |
-
|
477 |
-
|
478 |
|
479 |
-
|
480 |
-
|
481 |
|
482 |
-
|
483 |
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
|
489 |
-
|
490 |
-
|
491 |
|
492 |
-
|
493 |
|
494 |
-
|
495 |
-
|
496 |
|
497 |
-
|
498 |
|
499 |
-
|
|
|
500 |
|
501 |
-
|
502 |
-
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
503 |
|
504 |
-
|
|
|
|
|
505 |
|
506 |
-
|
507 |
-
tb_remove();
|
508 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
509 |
-
|
510 |
-
});
|
511 |
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
// inserts the shortcode into the active editor
|
516 |
-
if(tinyMCE.activeEditor==null) {
|
517 |
|
518 |
-
|
519 |
-
|
520 |
|
521 |
-
|
|
|
522 |
|
523 |
-
|
524 |
|
525 |
-
|
526 |
-
|
527 |
|
528 |
-
|
529 |
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
if(tinyMCE.activeEditor==null) {
|
539 |
|
540 |
-
|
541 |
-
jQuery("#content").append(shortcode);
|
542 |
|
543 |
-
|
|
|
544 |
|
545 |
-
|
546 |
|
547 |
-
|
548 |
-
|
549 |
|
550 |
-
|
551 |
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
|
562 |
-
|
563 |
-
|
564 |
|
565 |
-
|
566 |
-
|
567 |
|
568 |
-
|
569 |
-
|
570 |
|
571 |
-
|
572 |
|
573 |
-
|
|
|
574 |
|
575 |
-
|
576 |
-
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
577 |
|
578 |
-
|
|
|
|
|
|
|
579 |
|
580 |
-
|
581 |
-
|
582 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
583 |
-
});
|
584 |
|
585 |
-
|
586 |
-
var shortcode = '[yasr_visitor_votes size="medium"]';
|
587 |
|
588 |
-
|
|
|
589 |
|
590 |
-
|
591 |
-
jQuery("#content").append(shortcode);
|
592 |
|
593 |
-
|
|
|
594 |
|
595 |
-
|
596 |
|
597 |
-
|
598 |
-
|
|
|
|
|
599 |
|
600 |
-
|
|
|
601 |
|
602 |
-
|
603 |
-
|
604 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
605 |
-
});
|
606 |
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
// inserts the shortcode into the active editor
|
611 |
-
if(tinyMCE.activeEditor==null) {
|
612 |
|
613 |
-
|
614 |
-
jQuery("#content").append(shortcode);
|
615 |
|
616 |
-
|
|
|
617 |
|
618 |
-
|
619 |
|
620 |
-
|
621 |
-
|
|
|
|
|
622 |
|
623 |
-
|
624 |
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
|
|
629 |
|
630 |
-
|
631 |
|
632 |
-
|
633 |
-
jQuery('#yasr-insert-multiset-select').on("click", function(){
|
634 |
-
var setType = jQuery("input:radio[name=yasr_tinymce_pick_set]:checked" ).val();
|
635 |
-
var visitorSet = jQuery("#yasr-allow-vote-multiset").is(':checked');
|
636 |
-
var showAverage = jQuery("#yasr-hide-average-multiset").is(':checked');
|
637 |
|
638 |
-
|
639 |
|
640 |
-
|
641 |
|
642 |
-
|
643 |
|
644 |
-
|
645 |
|
646 |
-
|
647 |
|
648 |
-
|
649 |
|
650 |
-
|
651 |
|
652 |
-
if (showAverage) {
|
653 |
|
654 |
-
|
655 |
|
656 |
-
|
|
|
657 |
|
|
|
|
|
658 |
|
659 |
-
|
660 |
-
|
661 |
-
// inserts the shortcode into the active editor
|
662 |
-
if(tinyMCE.activeEditor==null) {
|
663 |
|
664 |
-
|
665 |
-
|
666 |
|
667 |
-
|
668 |
|
669 |
-
|
|
|
|
|
|
|
670 |
|
671 |
-
|
672 |
-
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
673 |
|
674 |
-
|
675 |
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
|
681 |
-
|
682 |
|
683 |
-
|
684 |
|
685 |
-
|
686 |
-
jQuery('#yasr-single-set').on("click", function(){
|
687 |
-
var setType = jQuery('#yasr-single-set').val();
|
688 |
-
var showAverage = jQuery("#yasr-hide-average-multiset").is(':checked');
|
689 |
|
690 |
-
|
691 |
|
692 |
-
|
693 |
|
694 |
-
|
695 |
|
696 |
-
|
697 |
|
698 |
-
|
699 |
|
700 |
-
|
701 |
|
702 |
-
|
703 |
|
704 |
-
|
705 |
|
706 |
-
|
|
|
707 |
|
708 |
-
|
|
|
709 |
|
710 |
-
|
711 |
|
712 |
-
|
|
|
713 |
|
714 |
-
|
715 |
-
if(tinyMCE.activeEditor==null) {
|
716 |
|
717 |
-
|
718 |
-
|
|
|
|
|
719 |
|
720 |
-
|
721 |
|
722 |
-
|
|
|
|
|
723 |
|
724 |
-
|
725 |
-
|
726 |
|
727 |
-
|
|
|
728 |
|
729 |
-
|
730 |
-
tb_remove();
|
731 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
732 |
-
});
|
733 |
|
734 |
-
|
|
|
735 |
|
736 |
-
|
737 |
-
jQuery('#yasr-top-10-overall-rating').on("click", function(){
|
738 |
-
var shortcode = '[yasr_top_ten_highest_rated]';
|
739 |
-
|
740 |
-
// inserts the shortcode into the active editor
|
741 |
-
if(tinyMCE.activeEditor==null) {
|
742 |
|
743 |
-
|
744 |
-
|
|
|
|
|
745 |
|
746 |
-
|
|
|
|
|
747 |
|
748 |
-
|
|
|
749 |
|
750 |
-
|
751 |
-
|
752 |
|
753 |
-
|
754 |
|
755 |
-
|
756 |
-
|
757 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
758 |
-
});
|
759 |
|
760 |
-
|
761 |
-
jQuery('#yasr-10-highest-most-rated').on("click", function(){
|
762 |
-
var shortcode = '[yasr_most_or_highest_rated_posts]';
|
763 |
-
|
764 |
-
// inserts the shortcode into the active editor
|
765 |
-
if(tinyMCE.activeEditor==null) {
|
766 |
|
767 |
-
|
768 |
-
|
|
|
|
|
769 |
|
770 |
-
|
|
|
|
|
771 |
|
772 |
-
|
|
|
773 |
|
774 |
-
|
775 |
-
|
776 |
|
777 |
-
|
778 |
|
779 |
-
|
780 |
-
|
781 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
782 |
-
});
|
783 |
|
784 |
-
|
785 |
-
jQuery('#yasr-5-active-reviewers').on("click", function(){
|
786 |
-
var shortcode = '[yasr_top_5_reviewers]';
|
787 |
-
|
788 |
-
// inserts the shortcode into the active editor
|
789 |
-
if(tinyMCE.activeEditor==null) {
|
790 |
|
791 |
-
|
792 |
-
|
|
|
|
|
793 |
|
794 |
-
|
|
|
|
|
795 |
|
796 |
-
|
|
|
797 |
|
798 |
-
|
799 |
-
|
800 |
|
801 |
-
|
802 |
|
803 |
-
|
804 |
-
|
805 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
806 |
-
});
|
807 |
|
808 |
-
|
809 |
-
jQuery('#yasr-top-10-active-users').on("click", function(){
|
810 |
-
var shortcode = '[yasr_top_ten_active_users]';
|
811 |
-
|
812 |
-
// inserts the shortcode into the active editor
|
813 |
-
if(tinyMCE.activeEditor==null) {
|
814 |
|
815 |
-
|
816 |
-
|
|
|
|
|
817 |
|
818 |
-
|
819 |
|
820 |
-
|
821 |
|
822 |
-
|
823 |
-
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
824 |
|
825 |
-
|
|
|
826 |
|
827 |
-
|
828 |
-
|
829 |
-
//jQuery('#yasr-tinypopup-form').dialog('close');
|
830 |
-
});
|
831 |
|
832 |
-
|
833 |
|
834 |
-
|
|
|
|
|
|
|
835 |
|
836 |
-
|
837 |
|
838 |
-
|
839 |
-
|
|
|
|
|
840 |
|
841 |
-
|
842 |
-
jQuery('.yasr-log-pagenum').on('click', function() {
|
843 |
|
844 |
-
|
845 |
|
846 |
-
|
847 |
-
action : 'yasr_change_log_page',
|
848 |
-
pagenum: jQuery(this).val(),
|
849 |
-
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
850 |
|
851 |
-
|
852 |
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
|
|
857 |
|
858 |
-
|
|
|
|
|
859 |
|
860 |
-
|
861 |
|
862 |
-
|
863 |
|
864 |
-
|
865 |
|
866 |
-
var data = {
|
867 |
-
action : 'yasr_change_log_page',
|
868 |
-
pagenum: jQuery(this).val(),
|
869 |
-
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
870 |
-
};
|
871 |
|
872 |
-
|
873 |
-
|
874 |
-
});
|
875 |
|
876 |
-
|
|
|
877 |
|
878 |
-
|
879 |
|
880 |
-
|
|
|
|
|
|
|
881 |
|
|
|
882 |
|
|
|
|
|
|
|
|
|
|
|
|
|
883 |
|
884 |
-
|
885 |
-
jQuery(document).ready(function() {
|
886 |
|
887 |
-
|
888 |
-
jQuery('.yasr-user-log-pagenum').on('click', function() {
|
889 |
|
890 |
jQuery('#yasr-loader-user-log-metabox').show();
|
891 |
|
892 |
var data = {
|
893 |
-
action
|
894 |
pagenum: jQuery(this).val(),
|
895 |
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-user-log-total-pages')
|
896 |
-
|
897 |
};
|
898 |
|
899 |
-
jQuery.post(ajaxurl, data, function(response) {
|
900 |
-
jQuery('#yasr-
|
901 |
-
jQuery('#yasr-user-log-container').html(response);
|
902 |
-
});
|
903 |
-
|
904 |
-
});
|
905 |
-
|
906 |
-
jQuery(document).ajaxComplete(function() {
|
907 |
-
|
908 |
-
jQuery('.yasr-user-log-page-num').on('click', function() {
|
909 |
-
|
910 |
-
jQuery('#yasr-loader-user-log-metabox').show();
|
911 |
-
|
912 |
-
var data = {
|
913 |
-
action : 'yasr_change_user_log_page',
|
914 |
-
pagenum: jQuery(this).val(),
|
915 |
-
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-user-log-total-pages')
|
916 |
-
};
|
917 |
-
|
918 |
-
jQuery.post(ajaxurl, data, function(response) {
|
919 |
-
jQuery('#yasr-user-log-container').html(response); //This will hide the loader gif too
|
920 |
-
});
|
921 |
-
|
922 |
});
|
923 |
|
924 |
});
|
925 |
|
926 |
});
|
927 |
|
|
|
|
|
928 |
/****** End yasr db functions ******/
|
25 |
|
26 |
/****** Yasr Metabox overall rating, used for classic editor ******/
|
27 |
|
28 |
+
function yasrPrintMetaBoxOverall(overallRating) {
|
29 |
|
30 |
//Convert string to number
|
31 |
overallRating = parseFloat(overallRating);
|
62 |
|
63 |
/****** Yasr Metabox Multiple Rating ******/
|
64 |
|
65 |
+
function yasrAdminMultiSet(nMultiSet, postid, setId, nonceMulti) {
|
66 |
|
67 |
nMultiSet = parseInt(nMultiSet);
|
68 |
|
70 |
|
71 |
yasrPrintAdminMultiSet(setId, postid, nonceMulti, nMultiSet);
|
72 |
|
73 |
+
} else {
|
|
|
|
|
74 |
|
75 |
jQuery('#yasr-button-select-set').on("click", function () {
|
76 |
|
88 |
}
|
89 |
|
90 |
//print the table
|
91 |
+
function yasrPrintAdminMultiSet(setId, postid, nonceMulti, nMultiSet) {
|
92 |
|
93 |
var data_id = {
|
94 |
action: 'yasr_send_id_nameset',
|
96 |
post_id: postid
|
97 |
};
|
98 |
|
99 |
+
jQuery.post(ajaxurl, data_id, function (response) {
|
100 |
|
101 |
//Hide the loader near the select only if more multiset are used
|
102 |
if (nMultiSet !== 1) {
|
115 |
|
116 |
content += '<tr>';
|
117 |
content += '<td>' + valueName + '</td>';
|
118 |
+
content += '<td><div class="yasr-multiset-admin" id="yasr-multiset-admin-' + valueID + '" data-rating="' + valueRating + '" data-multi-idfield="' + valueID + '"></div>';
|
119 |
content += '<span id="yasr-loader-multi-set-field-' + valueID + '" style="display: none">';
|
120 |
+
content += '<img src="' + yasrCommonDataAdmin.loaderHtml + '"></span>';
|
121 |
content += '</span>';
|
122 |
content += '</td>';
|
123 |
content += '</tr>';
|
129 |
}
|
130 |
|
131 |
//Show the text "Choose a vote"
|
132 |
+
document.getElementById('yasr-multi-set-admin-choose-text').style.display = 'block';
|
133 |
|
134 |
//Set rater for divs
|
135 |
+
yasrSetRaterAdminMulti(postid, setId, nonceMulti);
|
136 |
|
137 |
//Show shortcode
|
138 |
+
document.getElementById('yasr-multi-set-admin-explain').style.display = 'block';
|
139 |
|
140 |
+
document.getElementById('yasr-multi-set-admin-explain-with-id-readonly').innerHTML = '<strong>[yasr_multiset setid=' + setId + ']</strong>';
|
141 |
+
document.getElementById('yasr-multi-set-admin-explain-with-id-visitor').innerHTML = '<strong>[yasr_visitor_multiset setid=' + setId + ']</strong>';
|
142 |
|
143 |
});
|
144 |
|
147 |
}
|
148 |
|
149 |
//Rater for multiset
|
150 |
+
function yasrSetRaterAdminMulti(postid, setId, nonceMulti) {
|
151 |
|
152 |
var yasrMultiSetAdmin = document.getElementsByClassName('yasr-multiset-admin');
|
153 |
|
154 |
+
for (var i = 0; i < yasrMultiSetAdmin.length; i++) {
|
155 |
|
156 |
+
(function (i) {
|
157 |
|
158 |
var htmlId = yasrMultiSetAdmin.item(i).id;
|
159 |
var idField = yasrMultiSetAdmin.item(i).getAttribute('data-multi-idfield');
|
209 |
|
210 |
/****** Yasr Settings Page ******/
|
211 |
|
212 |
+
function YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled, textBeforeStars) {
|
|
|
|
|
213 |
|
214 |
+
//-------------------General Settings Code---------------------
|
215 |
|
216 |
+
if (activeTab === 'general_settings') {
|
|
|
|
|
217 |
|
218 |
+
if (autoInsertEnabled == 0) {
|
219 |
+
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
220 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
+
//First Div, for auto insert
|
223 |
+
jQuery('#yasr_auto_insert_switch').change(function () {
|
224 |
+
if (jQuery(this).is(':checked')) {
|
225 |
+
jQuery('.yasr-auto-insert-options-class').prop('disabled', false);
|
226 |
+
} else {
|
227 |
+
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
|
228 |
}
|
229 |
+
});
|
230 |
|
231 |
+
//for text before stars
|
232 |
+
if (textBeforeStars == 0) {
|
233 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
234 |
+
}
|
235 |
|
236 |
+
jQuery('#yasr-general-options-text-before-stars-switch').change(function () {
|
237 |
+
if (jQuery(this).is(':checked')) {
|
|
|
|
|
|
|
|
|
238 |
|
239 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', false);
|
240 |
+
jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
|
241 |
+
jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
|
242 |
+
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
|
243 |
+
jQuery('#yasr-general-options-custom-text-must-sign-in').val('You must sign in to vote');
|
244 |
+
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
|
245 |
|
246 |
+
} else {
|
247 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
248 |
+
}
|
|
|
|
|
249 |
|
250 |
+
});
|
251 |
|
|
|
|
|
|
|
252 |
|
253 |
+
/*if (jQuery('#yasr_text_before_star_off').is(':checked')) {
|
254 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', true);
|
255 |
+
}
|
256 |
|
257 |
+
jQuery('#yasr_text_before_star_on').on('click', function(){
|
|
|
|
|
|
|
|
|
258 |
|
259 |
+
jQuery('.yasr-general-options-text-before').prop('disabled', false);
|
260 |
+
jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
|
261 |
+
jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
|
262 |
+
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
|
263 |
+
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
|
264 |
|
265 |
+
});*/
|
|
|
|
|
|
|
266 |
|
267 |
+
jQuery('#yasr-doc-custom-text-link').on('click', function () {
|
268 |
+
jQuery('#yasr-doc-custom-text-div').toggle('slow');
|
269 |
+
return false;
|
270 |
+
});
|
271 |
|
272 |
+
jQuery('#yasr-snippet-explained-link').on('click', function () {
|
273 |
+
jQuery('#yasr-snippet-explained').toggle('slow');
|
274 |
+
return false; // prevent default click action from happening!
|
275 |
+
});
|
276 |
|
|
|
|
|
|
|
|
|
|
|
277 |
|
278 |
+
/*//If on document ready "BlogPosting" is checked show the additional fields
|
279 |
+
if (jQuery('#yasr_choose_snippet_blogposting').is(':checked')) {
|
280 |
+
jQuery('#yasr-blogPosting-additional-info').show();
|
281 |
+
jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', false);
|
282 |
+
}
|
283 |
|
284 |
+
//On change show or hide the additional fields
|
285 |
+
jQuery('#yasr-choose-snippet-type input[type=radio]').change(function(){
|
286 |
+
var snippet_type = jQuery(this).val();
|
287 |
|
288 |
+
if (snippet_type === 'Other') {
|
|
|
289 |
|
290 |
+
jQuery('#yasr-blogPosting-additional-info').show();
|
291 |
+
jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', false);
|
292 |
|
293 |
+
}
|
|
|
|
|
294 |
|
295 |
+
else {
|
296 |
+
jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', true);
|
297 |
+
jQuery('#yasr-blogPosting-additional-info').hide();
|
298 |
|
299 |
+
}
|
300 |
|
301 |
+
return false;
|
302 |
|
303 |
+
});*/
|
304 |
|
305 |
+
} //End if general settings
|
306 |
|
307 |
+
//--------------Multi Sets Page ------------------
|
308 |
|
309 |
+
if (activeTab === 'manage_multi') {
|
|
|
|
|
310 |
|
311 |
+
jQuery('#yasr-multi-set-doc-link').on('click', function () {
|
312 |
+
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
313 |
+
});
|
314 |
|
315 |
+
jQuery('#yasr-multi-set-doc-link-hide').on('click', function () {
|
316 |
+
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
317 |
+
});
|
318 |
|
319 |
+
if (nMultiSet == 1) {
|
320 |
|
321 |
+
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
322 |
|
323 |
+
counter++;
|
324 |
|
325 |
+
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
|
|
|
|
|
|
|
|
326 |
|
327 |
+
if (counter > 9) {
|
328 |
+
jQuery('#yasr-element-limit').show();
|
329 |
+
jQuery('#yasr-add-field-edit-multiset').hide();
|
330 |
+
return false;
|
331 |
+
}
|
332 |
|
333 |
+
var newTextBoxDiv = jQuery(document.createElement('tr'))
|
334 |
|
335 |
+
newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
|
336 |
|
337 |
+
newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
|
338 |
|
339 |
+
counter++;
|
340 |
|
341 |
+
});
|
342 |
|
|
|
343 |
|
344 |
+
} //End if ($n_multi_set == 1)
|
345 |
|
346 |
+
if (nMultiSet > 1) {
|
|
|
347 |
|
348 |
+
//If more then 1 set is used...
|
349 |
+
jQuery('#yasr-button-select-set-edit-form').on("click", function () {
|
|
|
|
|
350 |
|
351 |
+
var data = {
|
352 |
+
action: 'yasr_get_multi_set',
|
353 |
+
set_id: jQuery('#yasr_select_edit_set').val()
|
354 |
+
}
|
355 |
|
356 |
+
jQuery.post(ajaxurl, data, function (response) {
|
357 |
+
jQuery('#yasr-multi-set-response').show();
|
358 |
+
jQuery('#yasr-multi-set-response').html(response);
|
359 |
+
});
|
360 |
|
361 |
+
return false; // prevent default click action from happening!
|
362 |
|
363 |
+
});
|
364 |
|
365 |
+
jQuery(document).ajaxComplete(function () {
|
366 |
|
367 |
+
var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
|
368 |
|
369 |
+
counter++;
|
370 |
|
371 |
+
jQuery("#yasr-add-field-edit-multiset").on('click', function () {
|
|
|
|
|
|
|
|
|
372 |
|
373 |
+
if (counter > 9) {
|
374 |
+
jQuery('#yasr-element-limit').show();
|
375 |
+
jQuery('#yasr-add-field-edit-multiset').hide();
|
376 |
+
return false;
|
377 |
+
}
|
378 |
|
379 |
+
var newTextBoxDiv = jQuery(document.createElement('tr'))
|
380 |
|
381 |
+
newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
|
382 |
|
383 |
+
newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
|
384 |
|
385 |
+
counter++;
|
386 |
|
387 |
+
});
|
388 |
|
389 |
+
});
|
390 |
|
391 |
+
} //End if ($n_multi_set > 1)
|
392 |
|
393 |
|
394 |
+
} //end if active_tab=='manage_multi'
|
395 |
|
396 |
|
397 |
+
if (activeTab === 'style_options') {
|
398 |
|
399 |
+
jQuery('#yasr-color-scheme-preview-link').on('click', function () {
|
400 |
+
jQuery('#yasr-color-scheme-preview').toggle('slow');
|
401 |
+
return false; // prevent default click action from happening!
|
402 |
+
});
|
403 |
|
404 |
+
}
|
405 |
|
406 |
|
407 |
+
}
|
408 |
|
409 |
+
function YasrAsk5Stars(nonceHideAskRating) {
|
410 |
|
411 |
+
//This will call an ajax action that set a site transite to hide
|
412 |
+
//for a week the metabok
|
413 |
+
jQuery('#yasr-ask-five-star-later').on("click", function () {
|
414 |
|
415 |
+
jQuery('#yasr-ask-five-stars').hide();
|
416 |
|
417 |
+
var data = {
|
418 |
+
action: 'yasr_hide_ask_rating_metabox',
|
419 |
+
choose: 'hide',
|
420 |
+
nonce: nonceHideAskRating
|
421 |
|
422 |
+
};
|
423 |
|
424 |
+
jQuery.post(ajaxurl, data);
|
425 |
|
426 |
+
});
|
427 |
|
428 |
|
429 |
+
//This will close the ask rating metabox forever
|
430 |
+
jQuery('#yasr-ask-five-close').on("click", function () {
|
431 |
|
432 |
+
jQuery('#yasr-ask-five-stars').hide();
|
433 |
|
434 |
+
var data = {
|
435 |
+
action: 'yasr_hide_ask_rating_metabox',
|
436 |
+
choose: 'close',
|
437 |
+
nonce: nonceHideAskRating
|
438 |
+
};
|
439 |
|
440 |
+
jQuery.post(ajaxurl, data);
|
441 |
|
442 |
+
});
|
443 |
|
444 |
|
445 |
+
}
|
446 |
|
447 |
/****** End Yasr Settings Page ******/
|
448 |
|
450 |
/****** Yasr Ajax Page ******/
|
451 |
|
452 |
|
453 |
+
// When click on chart hide tab-main and show tab-charts
|
454 |
|
455 |
+
function yasrShortcodeCreator(nMultiSet) {
|
456 |
|
457 |
+
// When click on main tab hide tab-main and show tab-charts
|
458 |
+
jQuery('#yasr-link-tab-main').on("click", function () {
|
459 |
|
460 |
+
jQuery('.yasr-nav-tab').removeClass('nav-tab-active');
|
461 |
+
jQuery('#yasr-link-tab-main').addClass('nav-tab-active');
|
462 |
|
463 |
+
jQuery('.yasr-content-tab-tinymce').hide();
|
464 |
+
jQuery('#yasr-content-tab-main').show();
|
465 |
|
466 |
+
});
|
467 |
|
468 |
+
jQuery('#yasr-link-tab-charts').on("click", function () {
|
469 |
|
470 |
+
jQuery('.yasr-nav-tab').removeClass('nav-tab-active');
|
471 |
+
jQuery('#yasr-link-tab-charts').addClass('nav-tab-active');
|
472 |
|
473 |
+
jQuery('.yasr-content-tab-tinymce').hide();
|
474 |
+
jQuery('#yasr-content-tab-charts').show();
|
475 |
|
476 |
+
});
|
477 |
|
478 |
+
// Add shortcode for overall rating
|
479 |
+
jQuery('#yasr-overall').on("click", function () {
|
480 |
+
jQuery('#yasr-overall-choose-size').toggle('slow');
|
481 |
+
});
|
482 |
|
483 |
+
jQuery('#yasr-overall-insert-small').on("click", function () {
|
484 |
+
var shortcode = '[yasr_overall_rating size="small"]';
|
485 |
|
486 |
+
if (tinyMCE.activeEditor == null) {
|
487 |
|
488 |
+
//this is for tinymce used in text mode
|
489 |
+
jQuery("#content").append(shortcode);
|
490 |
|
491 |
+
} else {
|
492 |
|
493 |
+
// inserts the shortcode into the active editor
|
494 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
495 |
|
496 |
+
}
|
|
|
497 |
|
498 |
+
// close
|
499 |
+
tb_remove();
|
500 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
501 |
|
502 |
+
});
|
|
|
|
|
|
|
|
|
503 |
|
504 |
+
jQuery('#yasr-overall-insert-medium').on("click", function () {
|
505 |
+
var shortcode = '[yasr_overall_rating size="medium"]';
|
|
|
|
|
|
|
506 |
|
507 |
+
// inserts the shortcode into the active editor
|
508 |
+
if (tinyMCE.activeEditor == null) {
|
509 |
|
510 |
+
//this is for tinymce used in text mode
|
511 |
+
jQuery("#content").append(shortcode);
|
512 |
|
513 |
+
} else {
|
514 |
|
515 |
+
// inserts the shortcode into the active editor
|
516 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
517 |
|
518 |
+
}
|
519 |
|
520 |
+
// close
|
521 |
+
tb_remove();
|
522 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
523 |
+
});
|
524 |
|
525 |
+
jQuery('#yasr-overall-insert-large').on("click", function () {
|
526 |
+
var shortcode = '[yasr_overall_rating size="large"]';
|
|
|
|
|
527 |
|
528 |
+
if (tinyMCE.activeEditor == null) {
|
|
|
529 |
|
530 |
+
//this is for tinymce used in text mode
|
531 |
+
jQuery("#content").append(shortcode);
|
532 |
|
533 |
+
} else {
|
534 |
|
535 |
+
// inserts the shortcode into the active editor
|
536 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
537 |
|
538 |
+
}
|
539 |
|
540 |
+
// close
|
541 |
+
tb_remove();
|
542 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
543 |
+
});
|
544 |
|
545 |
+
//Add shortcode for visitors rating
|
546 |
+
jQuery('#yasr-visitor-votes').on("click", function () {
|
547 |
+
jQuery('#yasr-visitor-choose-size').toggle('slow');
|
548 |
+
});
|
549 |
|
550 |
+
jQuery('#yasr-visitor-insert-small').on("click", function () {
|
551 |
+
var shortcode = '[yasr_visitor_votes size="small"]';
|
552 |
|
553 |
+
// inserts the shortcode into the active editor
|
554 |
+
if (tinyMCE.activeEditor == null) {
|
555 |
|
556 |
+
//this is for tinymce used in text mode
|
557 |
+
jQuery("#content").append(shortcode);
|
558 |
|
559 |
+
} else {
|
560 |
|
561 |
+
// inserts the shortcode into the active editor
|
562 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
563 |
|
564 |
+
}
|
|
|
565 |
|
566 |
+
// close
|
567 |
+
tb_remove();
|
568 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
569 |
+
});
|
570 |
|
571 |
+
jQuery('#yasr-visitor-insert-medium').on("click", function () {
|
572 |
+
var shortcode = '[yasr_visitor_votes size="medium"]';
|
|
|
|
|
573 |
|
574 |
+
if (tinyMCE.activeEditor == null) {
|
|
|
575 |
|
576 |
+
//this is for tinymce used in text mode
|
577 |
+
jQuery("#content").append(shortcode);
|
578 |
|
579 |
+
} else {
|
|
|
580 |
|
581 |
+
// inserts the shortcode into the active editor
|
582 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
583 |
|
584 |
+
}
|
585 |
|
586 |
+
// close
|
587 |
+
tb_remove();
|
588 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
589 |
+
});
|
590 |
|
591 |
+
jQuery('#yasr-visitor-insert-large').on("click", function () {
|
592 |
+
var shortcode = '[yasr_visitor_votes size="large"]';
|
593 |
|
594 |
+
// inserts the shortcode into the active editor
|
595 |
+
if (tinyMCE.activeEditor == null) {
|
|
|
|
|
596 |
|
597 |
+
//this is for tinymce used in text mode
|
598 |
+
jQuery("#content").append(shortcode);
|
|
|
|
|
|
|
599 |
|
600 |
+
} else {
|
|
|
601 |
|
602 |
+
// inserts the shortcode into the active editor
|
603 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
604 |
|
605 |
+
}
|
606 |
|
607 |
+
// close
|
608 |
+
tb_remove();
|
609 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
610 |
+
});
|
611 |
|
612 |
+
if (nMultiSet > 1) {
|
613 |
|
614 |
+
//Add shortcode for multiple set
|
615 |
+
jQuery('#yasr-insert-multiset-select').on("click", function () {
|
616 |
+
var setType = jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();
|
617 |
+
var visitorSet = jQuery("#yasr-allow-vote-multiset").is(':checked');
|
618 |
+
var showAverage = jQuery("#yasr-hide-average-multiset").is(':checked');
|
619 |
|
620 |
+
if (!visitorSet) {
|
621 |
|
622 |
+
var shortcode = '[yasr_visitor_multiset setid=';
|
|
|
|
|
|
|
|
|
623 |
|
624 |
+
} else {
|
625 |
|
626 |
+
var shortcode = '[yasr_multiset setid=';
|
627 |
|
628 |
+
}
|
629 |
|
630 |
+
shortcode += setType;
|
631 |
|
632 |
+
if (showAverage) {
|
633 |
|
634 |
+
shortcode += ' show_average=\'no\'';
|
635 |
|
636 |
+
}
|
637 |
|
|
|
638 |
|
639 |
+
shortcode += ']';
|
640 |
|
641 |
+
// inserts the shortcode into the active editor
|
642 |
+
if (tinyMCE.activeEditor == null) {
|
643 |
|
644 |
+
//this is for tinymce used in text mode
|
645 |
+
jQuery("#content").append(shortcode);
|
646 |
|
647 |
+
} else {
|
|
|
|
|
|
|
648 |
|
649 |
+
// inserts the shortcode into the active editor
|
650 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
651 |
|
652 |
+
}
|
653 |
|
654 |
+
// close
|
655 |
+
tb_remove();
|
656 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
657 |
+
});
|
658 |
|
659 |
+
} //End if
|
|
|
660 |
|
661 |
+
else if (nMultiSet == 1) {
|
662 |
|
663 |
+
//Add shortcode for single set (if only 1 are found)
|
664 |
+
jQuery('#yasr-single-set').on("click", function () {
|
665 |
+
var setType = jQuery('#yasr-single-set').val();
|
666 |
+
var showAverage = jQuery("#yasr-hide-average-multiset").is(':checked');
|
667 |
|
668 |
+
var visitorSet = jQuery("#yasr-allow-vote-multiset").is(':checked');
|
669 |
|
670 |
+
if (!visitorSet) {
|
671 |
|
672 |
+
var shortcode = '[yasr_visitor_multiset setid=';
|
|
|
|
|
|
|
673 |
|
674 |
+
} else {
|
675 |
|
676 |
+
var shortcode = '[yasr_multiset setid=';
|
677 |
|
678 |
+
}
|
679 |
|
680 |
+
shortcode += setType;
|
681 |
|
682 |
+
if (showAverage) {
|
683 |
|
684 |
+
shortcode += ' show_average=\'no\'';
|
685 |
|
686 |
+
}
|
687 |
|
688 |
+
shortcode += ']';
|
689 |
|
690 |
+
// inserts the shortcode into the active editor
|
691 |
+
if (tinyMCE.activeEditor == null) {
|
692 |
|
693 |
+
//this is for tinymce used in text mode
|
694 |
+
jQuery("#content").append(shortcode);
|
695 |
|
696 |
+
} else {
|
697 |
|
698 |
+
// inserts the shortcode into the active editor
|
699 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
700 |
|
701 |
+
}
|
|
|
702 |
|
703 |
+
// close
|
704 |
+
tb_remove();
|
705 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
706 |
+
});
|
707 |
|
708 |
+
} //End elseif
|
709 |
|
710 |
+
// Add shortcode for top 10 by overall ratings
|
711 |
+
jQuery('#yasr-top-10-overall-rating').on("click", function () {
|
712 |
+
var shortcode = '[yasr_top_ten_highest_rated]';
|
713 |
|
714 |
+
// inserts the shortcode into the active editor
|
715 |
+
if (tinyMCE.activeEditor == null) {
|
716 |
|
717 |
+
//this is for tinymce used in text mode
|
718 |
+
jQuery("#content").append(shortcode);
|
719 |
|
720 |
+
} else {
|
|
|
|
|
|
|
721 |
|
722 |
+
// inserts the shortcode into the active editor
|
723 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
724 |
|
725 |
+
}
|
|
|
|
|
|
|
|
|
|
|
726 |
|
727 |
+
// close
|
728 |
+
tb_remove();
|
729 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
730 |
+
});
|
731 |
|
732 |
+
// Add shortcode for 10 highest most rated
|
733 |
+
jQuery('#yasr-10-highest-most-rated').on("click", function () {
|
734 |
+
var shortcode = '[yasr_most_or_highest_rated_posts]';
|
735 |
|
736 |
+
// inserts the shortcode into the active editor
|
737 |
+
if (tinyMCE.activeEditor == null) {
|
738 |
|
739 |
+
//this is for tinymce used in text mode
|
740 |
+
jQuery("#content").append(shortcode);
|
741 |
|
742 |
+
} else {
|
743 |
|
744 |
+
// inserts the shortcode into the active editor
|
745 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
|
|
|
|
746 |
|
747 |
+
}
|
|
|
|
|
|
|
|
|
|
|
748 |
|
749 |
+
// close
|
750 |
+
tb_remove();
|
751 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
752 |
+
});
|
753 |
|
754 |
+
// Add shortcode for top 5 active reviewer
|
755 |
+
jQuery('#yasr-5-active-reviewers').on("click", function () {
|
756 |
+
var shortcode = '[yasr_top_5_reviewers]';
|
757 |
|
758 |
+
// inserts the shortcode into the active editor
|
759 |
+
if (tinyMCE.activeEditor == null) {
|
760 |
|
761 |
+
//this is for tinymce used in text mode
|
762 |
+
jQuery("#content").append(shortcode);
|
763 |
|
764 |
+
} else {
|
765 |
|
766 |
+
// inserts the shortcode into the active editor
|
767 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
|
|
|
|
768 |
|
769 |
+
}
|
|
|
|
|
|
|
|
|
|
|
770 |
|
771 |
+
// close
|
772 |
+
tb_remove();
|
773 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
774 |
+
});
|
775 |
|
776 |
+
// Add shortcode for top 10 active users
|
777 |
+
jQuery('#yasr-top-10-active-users').on("click", function () {
|
778 |
+
var shortcode = '[yasr_top_ten_active_users]';
|
779 |
|
780 |
+
// inserts the shortcode into the active editor
|
781 |
+
if (tinyMCE.activeEditor == null) {
|
782 |
|
783 |
+
//this is for tinymce used in text mode
|
784 |
+
jQuery("#content").append(shortcode);
|
785 |
|
786 |
+
} else {
|
787 |
|
788 |
+
// inserts the shortcode into the active editor
|
789 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
|
|
|
|
790 |
|
791 |
+
}
|
|
|
|
|
|
|
|
|
|
|
792 |
|
793 |
+
// close
|
794 |
+
tb_remove();
|
795 |
+
//jQuery('#yasr-tinypopup-form').dialog('close');
|
796 |
+
});
|
797 |
|
798 |
+
} //End function
|
799 |
|
800 |
+
/****** End YAsr Ajax page ******/
|
801 |
|
802 |
+
/****** Yasr db functions ******/
|
|
|
803 |
|
804 |
+
//Vote log
|
805 |
+
jQuery(document).ready(function () {
|
806 |
|
807 |
+
//Log
|
808 |
+
jQuery('.yasr-log-pagenum').on('click', function () {
|
|
|
|
|
809 |
|
810 |
+
jQuery('#yasr-loader-log-metabox').show();
|
811 |
|
812 |
+
var data = {
|
813 |
+
action: 'yasr_change_log_page',
|
814 |
+
pagenum: jQuery(this).val(),
|
815 |
+
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
816 |
|
817 |
+
};
|
818 |
|
819 |
+
jQuery.post(ajaxurl, data, function (response) {
|
820 |
+
jQuery('#yasr-loader-log-metabox').hide();
|
821 |
+
jQuery('#yasr-log-container').html(response);
|
822 |
+
});
|
823 |
|
824 |
+
});
|
|
|
825 |
|
826 |
+
jQuery(document).ajaxComplete(function () {
|
827 |
|
828 |
+
jQuery('.yasr-log-page-num').on('click', function () {
|
|
|
|
|
|
|
829 |
|
830 |
+
jQuery('#yasr-loader-log-metabox').show();
|
831 |
|
832 |
+
var data = {
|
833 |
+
action: 'yasr_change_log_page',
|
834 |
+
pagenum: jQuery(this).val(),
|
835 |
+
totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')
|
836 |
+
};
|
837 |
|
838 |
+
jQuery.post(ajaxurl, data, function (response) {
|
839 |
+
jQuery('#yasr-log-container').html(response); //This will hide the loader gif too
|
840 |
+
});
|
841 |
|
842 |
+
});
|
843 |
|
844 |
+
});
|
845 |
|
846 |
+
});
|
847 |
|
|
|
|
|
|
|
|
|
|
|
848 |
|
849 |
+
//Vote user log
|
850 |
+
jQuery(document).ready(function () {
|
|
|
851 |
|
852 |
+
//Log
|
853 |
+
jQuery('.yasr-user-log-pagenum').on('click', function () {
|
854 |
|
855 |
+
jQuery('#yasr-loader-user-log-metabox').show();
|
856 |
|
857 |
+
var data = {
|
858 |
+
action: 'yasr_change_user_log_page',
|
859 |
+
pagenum: jQuery(this).val(),
|
860 |
+
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-user-log-total-pages')
|
861 |
|
862 |
+
};
|
863 |
|
864 |
+
jQuery.post(ajaxurl, data, function (response) {
|
865 |
+
jQuery('#yasr-loader-log-metabox').hide();
|
866 |
+
jQuery('#yasr-user-log-container').html(response);
|
867 |
+
});
|
868 |
+
|
869 |
+
});
|
870 |
|
871 |
+
jQuery(document).ajaxComplete(function () {
|
|
|
872 |
|
873 |
+
jQuery('.yasr-user-log-page-num').on('click', function () {
|
|
|
874 |
|
875 |
jQuery('#yasr-loader-user-log-metabox').show();
|
876 |
|
877 |
var data = {
|
878 |
+
action: 'yasr_change_user_log_page',
|
879 |
pagenum: jQuery(this).val(),
|
880 |
totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-user-log-total-pages')
|
|
|
881 |
};
|
882 |
|
883 |
+
jQuery.post(ajaxurl, data, function (response) {
|
884 |
+
jQuery('#yasr-user-log-container').html(response); //This will hide the loader gif too
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
885 |
});
|
886 |
|
887 |
});
|
888 |
|
889 |
});
|
890 |
|
891 |
+
});
|
892 |
+
|
893 |
/****** End yasr db functions ******/
|
lib/admin/editor/yasr-metabox-top-right.php
CHANGED
@@ -22,11 +22,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
22 |
|
23 |
$post_id=get_the_ID();
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
$ajax_nonce_overall = wp_nonce_field( "yasr_nonce_overall_rating_action", "yasr_nonce_overall_rating");
|
32 |
$ajax_nonce_review_type = wp_nonce_field( "yasr_nonce_review_type_action", "yasr_nonce_review_type" );
|
@@ -42,7 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
42 |
|
43 |
<div id="yasr-vote-overall-stars">
|
44 |
<span id="yasr-rateit-vote-overall-text">
|
45 |
-
<?php _e(
|
46 |
</span>
|
47 |
|
48 |
<div id="yasr-rater-overall" >
|
@@ -63,9 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
63 |
<?php
|
64 |
|
65 |
if (YASR_AUTO_INSERT_ENABLED == 1) {
|
66 |
-
|
67 |
-
$is_this_post_exluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', TRUE);
|
68 |
-
|
69 |
?>
|
70 |
|
71 |
<div id="yasr-toprightmetabox-disable-auto-insert">
|
@@ -75,7 +73,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
75 |
<br />
|
76 |
|
77 |
<div class="yasr-onoffswitch-big" id="yasr-switcher-disable-auto-insert">
|
78 |
-
<input type="checkbox" name="yasr_auto_insert_disabled" class="yasr-onoffswitch-checkbox" value="yes"
|
|
|
79 |
<label class="yasr-onoffswitch-label" for="yasr-auto-insert-disabled-switch">
|
80 |
<span class="yasr-onoffswitch-inner"></span>
|
81 |
<span class="yasr-onoffswitch-switch"></span>
|
@@ -131,11 +130,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
131 |
|
132 |
jQuery(document).ready(function() {
|
133 |
|
134 |
-
var postid = <?php json_encode(the_ID()); ?>;
|
135 |
-
|
136 |
var overallRating = <?php echo (json_encode($overall_rating)); ?>;
|
137 |
|
138 |
-
yasrPrintMetaBoxOverall (
|
139 |
|
140 |
}); //End document ready
|
141 |
|
22 |
|
23 |
$post_id=get_the_ID();
|
24 |
|
25 |
+
$overall_rating=yasr_get_overall_rating($post_id);
|
26 |
|
27 |
+
if (!$overall_rating) {
|
28 |
+
$overall_rating = "0";
|
29 |
+
}
|
30 |
|
31 |
$ajax_nonce_overall = wp_nonce_field( "yasr_nonce_overall_rating_action", "yasr_nonce_overall_rating");
|
32 |
$ajax_nonce_review_type = wp_nonce_field( "yasr_nonce_review_type_action", "yasr_nonce_review_type" );
|
42 |
|
43 |
<div id="yasr-vote-overall-stars">
|
44 |
<span id="yasr-rateit-vote-overall-text">
|
45 |
+
<?php _e('Rate this article / item', 'yet-another-stars-rating'); ?>
|
46 |
</span>
|
47 |
|
48 |
<div id="yasr-rater-overall" >
|
63 |
<?php
|
64 |
|
65 |
if (YASR_AUTO_INSERT_ENABLED == 1) {
|
66 |
+
$is_this_post_exluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', TRUE);
|
|
|
|
|
67 |
?>
|
68 |
|
69 |
<div id="yasr-toprightmetabox-disable-auto-insert">
|
73 |
<br />
|
74 |
|
75 |
<div class="yasr-onoffswitch-big" id="yasr-switcher-disable-auto-insert">
|
76 |
+
<input type="checkbox" name="yasr_auto_insert_disabled" class="yasr-onoffswitch-checkbox" value="yes"
|
77 |
+
id="yasr-auto-insert-disabled-switch" <?php if ($is_this_post_exluded === 'yes') echo " checked='checked' "; ?> >
|
78 |
<label class="yasr-onoffswitch-label" for="yasr-auto-insert-disabled-switch">
|
79 |
<span class="yasr-onoffswitch-inner"></span>
|
80 |
<span class="yasr-onoffswitch-switch"></span>
|
130 |
|
131 |
jQuery(document).ready(function() {
|
132 |
|
|
|
|
|
133 |
var overallRating = <?php echo (json_encode($overall_rating)); ?>;
|
134 |
|
135 |
+
yasrPrintMetaBoxOverall (overallRating);
|
136 |
|
137 |
}); //End document ready
|
138 |
|
lib/admin/settings/yasr-settings-functions-misc.php
CHANGED
@@ -14,7 +14,7 @@ function yasr_upgrade_pro_box($position = false) {
|
|
14 |
|
15 |
<div class="<?php echo $yasr_upgrade_class ?>" style="display: none">
|
16 |
|
17 |
-
<h2 style="color: #34A7C1">
|
18 |
<?php _e('Upgrade to YASR Pro', 'yet-another-stars-rating'); ?>
|
19 |
</h2>
|
20 |
|
@@ -25,6 +25,7 @@ function yasr_upgrade_pro_box($position = false) {
|
|
25 |
<li><strong><?php _e(' 20 + ready to use themes', 'yet-another-stars-rating'); ?></strong></li>
|
26 |
<li><strong><?php _e(' Upload your own theme', 'yet-another-stars-rating'); ?></strong></li>
|
27 |
<li><strong><?php _e(' Dedicate support', 'yet-another-stars-rating'); ?></strong></li>
|
|
|
28 |
</ul>
|
29 |
<a href="<?php echo yasr_fs()->get_upgrade_url(); ?>">
|
30 |
<button class="button button-primary">Upgrade Now</button>
|
@@ -39,60 +40,106 @@ function yasr_upgrade_pro_box($position = false) {
|
|
39 |
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
* It must be appear after 10 logged rating, after 100 and after 1000
|
45 |
-
* Since version 0.9.0
|
46 |
-
*/
|
47 |
-
|
48 |
-
function yasr_ask_rating($position = false) {
|
49 |
|
50 |
-
$
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
$yasr_metabox_class = "yasr-donatedivbottom";
|
56 |
-
} else {
|
57 |
-
$yasr_metabox_class = "yasr-donatedivdx";
|
58 |
-
}
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
'<strong>' . $n_stored_ratings . '</strong>'
|
68 |
-
);
|
69 |
-
$text .= "<br />";
|
70 |
-
$text .= __('Can I ask a favor?', 'yet-another-stars-rating');
|
71 |
-
$text .= "<br />";
|
72 |
-
$text .= __('Can you please rate YASR 5 stars on', 'yet-another-stars-rating');
|
73 |
-
$text .= ' <a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5">wordpress.org?</a>';
|
74 |
-
$text .= __(' It will require just 1 min but it\'s a HUGE help for me. Thank you.', 'yet-another-stars-rating');
|
75 |
-
$text .= "<br /><br />";
|
76 |
-
$text .= "<em>> Dario Curvino</em>";
|
77 |
|
78 |
-
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
83 |
|
84 |
-
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
-
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
} //End if (!transient)
|
94 |
|
|
|
|
|
|
|
95 |
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
|
14 |
|
15 |
<div class="<?php echo $yasr_upgrade_class ?>" style="display: none">
|
16 |
|
17 |
+
<h2 class="yasr-donate-title" style="color: #34A7C1">
|
18 |
<?php _e('Upgrade to YASR Pro', 'yet-another-stars-rating'); ?>
|
19 |
</h2>
|
20 |
|
25 |
<li><strong><?php _e(' 20 + ready to use themes', 'yet-another-stars-rating'); ?></strong></li>
|
26 |
<li><strong><?php _e(' Upload your own theme', 'yet-another-stars-rating'); ?></strong></li>
|
27 |
<li><strong><?php _e(' Dedicate support', 'yet-another-stars-rating'); ?></strong></li>
|
28 |
+
<li><strong><?php _e(' ...And much more!!', 'yet-another-stars-rating'); ?></strong></li>
|
29 |
</ul>
|
30 |
<a href="<?php echo yasr_fs()->get_upgrade_url(); ?>">
|
31 |
<button class="button button-primary">Upgrade Now</button>
|
40 |
|
41 |
}
|
42 |
|
43 |
+
/*
|
44 |
+
* Add a box on with the resouces
|
45 |
+
* Since version 1.9.5
|
46 |
+
*
|
47 |
+
*/
|
48 |
|
49 |
+
function yasr_resources_box($position = false) {
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
if ($position && $position == "bottom") {
|
52 |
+
$yasr_metabox_class = "yasr-donatedivbottom";
|
53 |
+
} else {
|
54 |
+
$yasr_metabox_class = "yasr-donatedivdx";
|
55 |
+
}
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
$div = "<div class='$yasr_metabox_class' id='yasr-resources-box' style='display:none;'>";
|
58 |
+
|
59 |
+
$text = '<div class="yasr-donate-title">Resources</div>';
|
60 |
+
$text .= '<div class="yasr-donate-single-resource">
|
61 |
+
<span class="dashicons dashicons-star-filled" style="color: #ccc"></span>
|
62 |
+
<a target="blank" href="http://yetanotherstarsrating.com/">'
|
63 |
+
. __('YASR official website', 'yet-another-stars-rating') .
|
64 |
+
'</a>
|
65 |
+
</div>';
|
66 |
+
$text .= '<div class="yasr-donate-single-resource">
|
67 |
+
<span class="dashicons dashicons-edit" style="color: #ccc"></span>
|
68 |
+
<a target="blank" href="https://yetanotherstarsrating.com/yasr-basics-shortcode/">'
|
69 |
+
. __('Documentation', 'yet-another-stars-rating') .
|
70 |
+
'</a>
|
71 |
+
</div>';
|
72 |
+
$text .= '<div class="yasr-donate-single-resource">
|
73 |
+
<span class="dashicons dashicons-book-alt" style="color: #ccc"></span>
|
74 |
+
<a target="blank" href="https://yetanotherstarsrating.com/f-a-q/">'
|
75 |
+
. __('F.A.Q.', 'yet-another-stars-rating') .
|
76 |
+
'</a>
|
77 |
+
</div>';
|
78 |
+
$text .= '<div class="yasr-donate-single-resource">
|
79 |
+
<span class="dashicons dashicons-video-alt3" style="color: #ccc"></span>
|
80 |
+
<a target="blank" href="https://www.youtube.com/channel/UCU5jbO1PJsUUsCNbME9S-Zw">'
|
81 |
+
. __('Youtube channel', 'yet-another-stars-rating') .
|
82 |
+
'</a>
|
83 |
+
</div>';
|
84 |
+
$text .= '<div class="yasr-donate-single-resource">
|
85 |
+
<span class="dashicons dashicons-smiley" style="color: #ccc"></span>
|
86 |
+
<a target="blank" href="https://www.youtube.com/channel/UCU5jbO1PJsUUsCNbME9S-Zw">
|
87 |
+
Yasr Pro
|
88 |
+
</a>
|
89 |
+
</div>';
|
90 |
+
|
91 |
+
|
92 |
+
$div_and_text = $div . $text . '</div>';
|
93 |
+
|
94 |
+
echo $div_and_text;
|
95 |
|
96 |
+
}
|
97 |
|
98 |
+
/** Add a box on the right for asking to rate 5 stars on Wordpress.org
|
99 |
+
* Since version 0.9.0
|
100 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
function yasr_ask_rating($position = false) {
|
103 |
|
104 |
+
if ($position && $position == "bottom") {
|
105 |
+
$yasr_metabox_class = "yasr-donatedivbottom";
|
106 |
+
} else {
|
107 |
+
$yasr_metabox_class = "yasr-donatedivdx";
|
108 |
+
}
|
109 |
|
110 |
+
$div = "<div class='$yasr_metabox_class' id='yasr-ask-five-stars' style='display:none;'>";
|
111 |
|
112 |
+
$text = '<div class="yasr-donate-title">' . __('Can I ask your help?', 'yet-another-stars-rating') .'</div>';
|
113 |
+
$text .= '<div style="font-size: 32px; color: #F1CB32; text-align:center; margin-bottom: 20px; margin-top: -5px;">
|
114 |
+
<span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
|
115 |
+
<span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
|
116 |
+
<span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
|
117 |
+
<span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
|
118 |
+
<span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
|
119 |
+
</div>';
|
120 |
+
$text .= __('Please rate YASR 5 stars on', 'yet-another-stars-rating');
|
121 |
+
$text .= ' <a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5">
|
122 |
+
WordPress.org.</a><br />';
|
123 |
+
$text .= __(' It will require just 1 min but it\'s a HUGE help for me. Thank you.', 'yet-another-stars-rating');
|
124 |
+
$text .= "<br /><br />";
|
125 |
+
$text .= "<em>> Dario Curvino</em>";
|
126 |
|
127 |
+
$div_and_text = $div . $text . '</div>';
|
128 |
|
129 |
+
echo $div_and_text;
|
130 |
|
131 |
+
}
|
132 |
|
|
|
133 |
|
134 |
+
/****
|
135 |
+
Yasr Right settings panel, since version 1.9.5
|
136 |
+
****/
|
137 |
|
138 |
+
function yasr_right_settings_panel($position = false) {
|
139 |
+
do_action('yasr_right_settings_panel_box', $position);
|
140 |
+
yasr_upgrade_pro_box($position);
|
141 |
+
yasr_resources_box($position);
|
142 |
+
yasr_ask_rating($position);
|
143 |
}
|
144 |
|
145 |
|
lib/admin/settings/yasr-settings-functions.php
CHANGED
@@ -123,6 +123,14 @@ function yasr_general_options_init()
|
|
123 |
'yasr_general_options_section_id',
|
124 |
$option
|
125 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
add_settings_field(
|
127 |
'yasr_show_overall_in_loop',
|
128 |
__( 'Show "Overall Rating" in Archive Page?', 'yet-another-stars-rating' ),
|
@@ -139,14 +147,6 @@ function yasr_general_options_init()
|
|
139 |
'yasr_general_options_section_id',
|
140 |
$option
|
141 |
);
|
142 |
-
add_settings_field(
|
143 |
-
'yasr_custom_text',
|
144 |
-
__( 'Insert custom text to show before / after stars', 'yet-another-stars-rating' ),
|
145 |
-
'yasr_custom_text_callback',
|
146 |
-
'yasr_general_settings_tab',
|
147 |
-
'yasr_general_options_section_id',
|
148 |
-
$option
|
149 |
-
);
|
150 |
add_settings_field(
|
151 |
'yasr_visitors_stats',
|
152 |
__( 'Do you want show stats for visitors votes?', 'yet-another-stars-rating' ),
|
@@ -190,310 +190,252 @@ function yasr_auto_insert_callback( $option )
|
|
190 |
{
|
191 |
?>
|
192 |
|
193 |
-
<
|
|
|
194 |
_e( 'Use Auto Insert?', 'yet-another-stars-rating' );
|
195 |
?></strong>
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
<input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox"
|
200 |
-
value="1" id="yasr_auto_insert_switch" <?php
|
201 |
if ( $option['auto_insert_enabled'] == 1 ) {
|
202 |
echo " checked='checked' " ;
|
203 |
}
|
204 |
?> >
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
|
211 |
-
|
212 |
|
213 |
-
|
214 |
_e( 'What?', 'yet-another-stars-rating' );
|
215 |
?></strong>
|
216 |
|
217 |
-
|
218 |
|
219 |
-
|
220 |
-
|
221 |
if ( $option['auto_insert_what'] === 'overall_rating' ) {
|
222 |
echo " checked=\"checked\" " ;
|
223 |
}
|
224 |
?> >
|
225 |
-
|
226 |
_e( 'Overall Rating / Author Rating', 'yet-another-stars-rating' );
|
227 |
?>
|
228 |
-
|
229 |
|
230 |
-
|
231 |
-
|
232 |
if ( $option['auto_insert_what'] === 'visitor_rating' ) {
|
233 |
echo " checked=\"checked\" " ;
|
234 |
}
|
235 |
?> >
|
236 |
-
|
237 |
_e( 'Visitor Votes', 'yet-another-stars-rating' );
|
238 |
?>
|
239 |
-
|
240 |
|
241 |
-
|
242 |
-
|
243 |
if ( $option['auto_insert_what'] === 'both' ) {
|
244 |
echo " checked=\"checked\" " ;
|
245 |
}
|
246 |
?> >
|
247 |
-
|
248 |
_e( 'Both', 'yet-another-stars-rating' );
|
249 |
?>
|
250 |
|
251 |
-
|
252 |
|
253 |
-
|
254 |
|
255 |
-
|
256 |
_e( 'Where?', 'yet-another-stars-rating' );
|
257 |
?></strong>
|
258 |
|
259 |
-
|
260 |
|
261 |
-
|
262 |
-
|
263 |
if ( $option['auto_insert_where'] === 'top' ) {
|
264 |
echo " checked=\"checked\" " ;
|
265 |
}
|
266 |
?> >
|
267 |
-
|
268 |
_e( 'Before the post', 'yet-another-stars-rating' );
|
269 |
?>
|
270 |
-
|
271 |
|
272 |
-
|
273 |
-
|
274 |
if ( $option['auto_insert_where'] === 'bottom' ) {
|
275 |
echo " checked=\"checked\" " ;
|
276 |
}
|
277 |
?> >
|
278 |
-
|
279 |
_e( 'After the post', 'yet-another-stars-rating' );
|
280 |
?>
|
281 |
-
|
282 |
|
283 |
-
|
284 |
|
285 |
-
|
286 |
|
287 |
-
|
288 |
_e( 'Size', 'yet-another-stars-rating' );
|
289 |
?></strong>
|
290 |
|
291 |
-
|
292 |
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
if ( $option['auto_insert_size'] === 'small' ) {
|
297 |
echo " checked=\"checked\" " ;
|
298 |
}
|
299 |
?> >
|
300 |
-
|
301 |
echo YASR_IMG_DIR . "yasr-stars-small.png" ;
|
302 |
?>" class="yasr-img-option-size"><span
|
303 |
-
|
304 |
_e( 'Small', 'yet-another-stars-rating' );
|
305 |
?></span>
|
306 |
-
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
if ( $option['auto_insert_size'] === 'medium' ) {
|
312 |
echo " checked=\"checked\" " ;
|
313 |
}
|
314 |
?> >
|
315 |
-
|
316 |
echo YASR_IMG_DIR . "yasr-stars-medium.png" ;
|
317 |
?>" class="yasr-img-option-size"><span
|
318 |
-
|
319 |
_e( 'Medium', 'yet-another-stars-rating' );
|
320 |
?></span>
|
321 |
-
|
322 |
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
if ( $option['auto_insert_size'] === 'large' ) {
|
327 |
echo " checked=\"checked\" " ;
|
328 |
}
|
329 |
?> >
|
330 |
-
|
331 |
echo YASR_IMG_DIR . "yasr-stars-large.png" ;
|
332 |
?>" class="yasr-img-option-size"><span
|
333 |
-
|
334 |
_e( 'Large', 'yet-another-stars-rating' );
|
335 |
?></span>
|
336 |
-
|
337 |
|
338 |
-
|
339 |
|
340 |
-
|
341 |
|
342 |
-
|
343 |
_e( 'Exclude Pages?', 'yet-another-stars-rating' );
|
344 |
?></strong>
|
345 |
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
if ( $option['auto_insert_exclude_pages'] === 'yes' ) {
|
350 |
echo " checked=\"checked\" " ;
|
351 |
}
|
352 |
?> >
|
353 |
-
|
354 |
_e( 'Yes', 'yet-another-stars-rating' );
|
355 |
?>
|
356 |
|
357 |
-
|
358 |
|
359 |
-
|
360 |
-
|
361 |
if ( $option['auto_insert_exclude_pages'] === 'no' ) {
|
362 |
echo " checked=\"checked\" " ;
|
363 |
}
|
364 |
?> >
|
365 |
-
|
366 |
_e( 'No', 'yet-another-stars-rating' );
|
367 |
?>
|
368 |
-
|
369 |
|
370 |
-
|
371 |
|
372 |
-
|
373 |
|
374 |
-
|
375 |
$custom_post_types = yasr_get_custom_post_type( 'bool' );
|
376 |
|
377 |
if ( $custom_post_types ) {
|
378 |
?>
|
379 |
-
|
380 |
_e( 'Use only in custom post types?', 'yet-another-stars-rating' );
|
381 |
?></strong>
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
if ( $option['auto_insert_custom_post_only'] === 'yes' ) {
|
386 |
echo " checked=\"checked\" " ;
|
387 |
}
|
388 |
?> >
|
389 |
-
|
390 |
_e( 'Yes', 'yet-another-stars-rating' );
|
391 |
?>
|
392 |
|
393 |
-
|
394 |
|
395 |
-
|
396 |
-
|
397 |
if ( $option['auto_insert_custom_post_only'] === 'no' ) {
|
398 |
echo " checked=\"checked\" " ;
|
399 |
}
|
400 |
?> >
|
401 |
-
|
402 |
_e( 'No', 'yet-another-stars-rating' );
|
403 |
?>
|
404 |
|
405 |
-
|
406 |
|
407 |
-
|
408 |
_e( "You see this because you use custom post types.", 'yet-another-stars-rating' );
|
409 |
?>
|
410 |
-
|
411 |
-
|
412 |
_e( "If you want to use auto insert only in custom post types, choose Yes", 'yet-another-stars-rating' );
|
413 |
?>
|
414 |
|
415 |
-
|
416 |
|
417 |
-
|
418 |
|
419 |
-
|
420 |
} else {
|
421 |
?>
|
422 |
-
|
423 |
-
|
424 |
}
|
425 |
|
426 |
?>
|
427 |
|
428 |
-
|
429 |
submit_button( __( 'Save Settings' ) );
|
430 |
-
}
|
431 |
-
|
432 |
-
//End yasr_auto_insert_callback
|
433 |
-
function yasr_show_overall_in_loop_callback( $option )
|
434 |
-
{
|
435 |
?>
|
436 |
|
437 |
-
<div class="yasr-onoffswitch-big">
|
438 |
-
<input type="checkbox" name="yasr_general_options[show_overall_in_loop]" class="yasr-onoffswitch-checkbox"
|
439 |
-
id="yasr-show-overall-in-loop-switch" <?php
|
440 |
-
if ( $option['show_overall_in_loop'] === 'enabled' ) {
|
441 |
-
echo " checked='checked' " ;
|
442 |
-
}
|
443 |
-
?> >
|
444 |
-
<label class="yasr-onoffswitch-label" for="yasr-show-overall-in-loop-switch">
|
445 |
-
<span class="yasr-onoffswitch-inner"></span>
|
446 |
-
<span class="yasr-onoffswitch-switch"></span>
|
447 |
-
</label>
|
448 |
-
</div>
|
449 |
-
|
450 |
-
<br/> <br/>
|
451 |
-
|
452 |
-
<?php
|
453 |
-
_e( 'If you enable this, "Overall Rating" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating' );
|
454 |
-
?>
|
455 |
-
|
456 |
-
<p> </p>
|
457 |
-
|
458 |
-
<br/>
|
459 |
-
|
460 |
-
<hr>
|
461 |
-
|
462 |
-
<?php
|
463 |
-
}
|
464 |
-
|
465 |
-
function yasr_show_visitor_votes_in_loop_callback( $option )
|
466 |
-
{
|
467 |
-
?>
|
468 |
-
|
469 |
-
<div class="yasr-onoffswitch-big">
|
470 |
-
<input type="checkbox" name="yasr_general_options[show_visitor_votes_in_loop]" class="yasr-onoffswitch-checkbox"
|
471 |
-
id="yasr-show-visitor-votes-in-loop-switch" <?php
|
472 |
-
if ( $option['show_visitor_votes_in_loop'] === 'enabled' ) {
|
473 |
-
echo " checked='checked' " ;
|
474 |
-
}
|
475 |
-
?> >
|
476 |
-
<label class="yasr-onoffswitch-label" for="yasr-show-visitor-votes-in-loop-switch">
|
477 |
-
<span class="yasr-onoffswitch-inner"></span>
|
478 |
-
<span class="yasr-onoffswitch-switch"></span>
|
479 |
-
</label>
|
480 |
</div>
|
481 |
|
482 |
-
<
|
483 |
-
|
484 |
-
<?php
|
485 |
-
_e( 'If you enable this, "Visitor Votes" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating' );
|
486 |
-
?>
|
487 |
-
|
488 |
-
<p> </p>
|
489 |
-
|
490 |
-
<br/>
|
491 |
-
|
492 |
-
<hr>
|
493 |
|
494 |
<?php
|
495 |
}
|
496 |
|
|
|
497 |
function yasr_custom_text_callback( $option )
|
498 |
{
|
499 |
$text_before_overall = htmlspecialchars_decode( "{$option['text_before_overall']}" );
|
@@ -605,6 +547,70 @@ function yasr_custom_text_callback( $option )
|
|
605 |
submit_button( __( 'Save Settings' ) );
|
606 |
}
|
607 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
function yasr_visitors_stats_callback( $option )
|
609 |
{
|
610 |
?>
|
@@ -739,10 +745,11 @@ function yasr_choose_snippet_callback( $option )
|
|
739 |
|
740 |
<div id="yasr-snippet-explained" class="yasr-help-box-settings">
|
741 |
<?php
|
742 |
-
_e(
|
|
|
743 |
echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_review.png>" ;
|
744 |
echo "<br /> <br />" ;
|
745 |
-
_e(
|
746 |
echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_aggregate.jpg>" ;
|
747 |
?>
|
748 |
</div>
|
123 |
'yasr_general_options_section_id',
|
124 |
$option
|
125 |
);
|
126 |
+
add_settings_field(
|
127 |
+
'yasr_custom_text',
|
128 |
+
__( 'Insert custom text to show before / after stars', 'yet-another-stars-rating' ),
|
129 |
+
'yasr_custom_text_callback',
|
130 |
+
'yasr_general_settings_tab',
|
131 |
+
'yasr_general_options_section_id',
|
132 |
+
$option
|
133 |
+
);
|
134 |
add_settings_field(
|
135 |
'yasr_show_overall_in_loop',
|
136 |
__( 'Show "Overall Rating" in Archive Page?', 'yet-another-stars-rating' ),
|
147 |
'yasr_general_options_section_id',
|
148 |
$option
|
149 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
add_settings_field(
|
151 |
'yasr_visitors_stats',
|
152 |
__( 'Do you want show stats for visitors votes?', 'yet-another-stars-rating' ),
|
190 |
{
|
191 |
?>
|
192 |
|
193 |
+
<div>
|
194 |
+
<strong><?php
|
195 |
_e( 'Use Auto Insert?', 'yet-another-stars-rating' );
|
196 |
?></strong>
|
197 |
+
<div class="yasr-onoffswitch-big">
|
198 |
+
<input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox"
|
199 |
+
value="1" id="yasr_auto_insert_switch" <?php
|
|
|
|
|
200 |
if ( $option['auto_insert_enabled'] == 1 ) {
|
201 |
echo " checked='checked' " ;
|
202 |
}
|
203 |
?> >
|
204 |
+
<label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
|
205 |
+
<span class="yasr-onoffswitch-inner"></span>
|
206 |
+
<span class="yasr-onoffswitch-switch"></span>
|
207 |
+
</label>
|
208 |
+
</div>
|
209 |
|
210 |
+
<p> </p>
|
211 |
|
212 |
+
<strong><?php
|
213 |
_e( 'What?', 'yet-another-stars-rating' );
|
214 |
?></strong>
|
215 |
|
216 |
+
<div class="yasr-indented-answer">
|
217 |
|
218 |
+
<input type="radio" name="yasr_general_options[auto_insert_what]" value="overall_rating"
|
219 |
+
class="yasr-auto-insert-options-class" <?php
|
220 |
if ( $option['auto_insert_what'] === 'overall_rating' ) {
|
221 |
echo " checked=\"checked\" " ;
|
222 |
}
|
223 |
?> >
|
224 |
+
<?php
|
225 |
_e( 'Overall Rating / Author Rating', 'yet-another-stars-rating' );
|
226 |
?>
|
227 |
+
<br/>
|
228 |
|
229 |
+
<input type="radio" name="yasr_general_options[auto_insert_what]" value="visitor_rating"
|
230 |
+
class="yasr-auto-insert-options-class" <?php
|
231 |
if ( $option['auto_insert_what'] === 'visitor_rating' ) {
|
232 |
echo " checked=\"checked\" " ;
|
233 |
}
|
234 |
?> >
|
235 |
+
<?php
|
236 |
_e( 'Visitor Votes', 'yet-another-stars-rating' );
|
237 |
?>
|
238 |
+
<br/>
|
239 |
|
240 |
+
<input type="radio" name="yasr_general_options[auto_insert_what]" value="both"
|
241 |
+
class="yasr-auto-insert-options-class" <?php
|
242 |
if ( $option['auto_insert_what'] === 'both' ) {
|
243 |
echo " checked=\"checked\" " ;
|
244 |
}
|
245 |
?> >
|
246 |
+
<?php
|
247 |
_e( 'Both', 'yet-another-stars-rating' );
|
248 |
?>
|
249 |
|
250 |
+
<p> </p>
|
251 |
|
252 |
+
</div>
|
253 |
|
254 |
+
<strong><?php
|
255 |
_e( 'Where?', 'yet-another-stars-rating' );
|
256 |
?></strong>
|
257 |
|
258 |
+
<div class="yasr-indented-answer">
|
259 |
|
260 |
+
<input type="radio" name="yasr_general_options[auto_insert_where]" value="top"
|
261 |
+
class="yasr-auto-insert-options-class" <?php
|
262 |
if ( $option['auto_insert_where'] === 'top' ) {
|
263 |
echo " checked=\"checked\" " ;
|
264 |
}
|
265 |
?> >
|
266 |
+
<?php
|
267 |
_e( 'Before the post', 'yet-another-stars-rating' );
|
268 |
?>
|
269 |
+
<br/>
|
270 |
|
271 |
+
<input type="radio" name="yasr_general_options[auto_insert_where]" value="bottom"
|
272 |
+
class="yasr-auto-insert-options-class" <?php
|
273 |
if ( $option['auto_insert_where'] === 'bottom' ) {
|
274 |
echo " checked=\"checked\" " ;
|
275 |
}
|
276 |
?> >
|
277 |
+
<?php
|
278 |
_e( 'After the post', 'yet-another-stars-rating' );
|
279 |
?>
|
280 |
+
<br/>
|
281 |
|
282 |
+
<p> </p>
|
283 |
|
284 |
+
</div>
|
285 |
|
286 |
+
<strong><?php
|
287 |
_e( 'Size', 'yet-another-stars-rating' );
|
288 |
?></strong>
|
289 |
|
290 |
+
<div class="yasr-indented-answer">
|
291 |
|
292 |
+
<div class="yasr-option-size">
|
293 |
+
<input type="radio" name="yasr_general_options[auto_insert_size]" value="small"
|
294 |
+
class="yasr-auto-insert-options-class" <?php
|
295 |
if ( $option['auto_insert_size'] === 'small' ) {
|
296 |
echo " checked=\"checked\" " ;
|
297 |
}
|
298 |
?> >
|
299 |
+
<img src="<?php
|
300 |
echo YASR_IMG_DIR . "yasr-stars-small.png" ;
|
301 |
?>" class="yasr-img-option-size"><span
|
302 |
+
class="yasr-text-options-size"><?php
|
303 |
_e( 'Small', 'yet-another-stars-rating' );
|
304 |
?></span>
|
305 |
+
</div>
|
306 |
|
307 |
+
<div class="yasr-option-size">
|
308 |
+
<input type="radio" name="yasr_general_options[auto_insert_size]" value="medium"
|
309 |
+
class="yasr-auto-insert-options-class" <?php
|
310 |
if ( $option['auto_insert_size'] === 'medium' ) {
|
311 |
echo " checked=\"checked\" " ;
|
312 |
}
|
313 |
?> >
|
314 |
+
<img src="<?php
|
315 |
echo YASR_IMG_DIR . "yasr-stars-medium.png" ;
|
316 |
?>" class="yasr-img-option-size"><span
|
317 |
+
class="yasr-text-options-size"><?php
|
318 |
_e( 'Medium', 'yet-another-stars-rating' );
|
319 |
?></span>
|
320 |
+
</div>
|
321 |
|
322 |
+
<div class="yasr-option-size">
|
323 |
+
<input type="radio" name="yasr_general_options[auto_insert_size]" value="large"
|
324 |
+
class="yasr-auto-insert-options-class" <?php
|
325 |
if ( $option['auto_insert_size'] === 'large' ) {
|
326 |
echo " checked=\"checked\" " ;
|
327 |
}
|
328 |
?> >
|
329 |
+
<img src="<?php
|
330 |
echo YASR_IMG_DIR . "yasr-stars-large.png" ;
|
331 |
?>" class="yasr-img-option-size"><span
|
332 |
+
class="yasr-text-options-size"><?php
|
333 |
_e( 'Large', 'yet-another-stars-rating' );
|
334 |
?></span>
|
335 |
+
</div>
|
336 |
|
337 |
+
<p> </p>
|
338 |
|
339 |
+
</div>
|
340 |
|
341 |
+
<strong><?php
|
342 |
_e( 'Exclude Pages?', 'yet-another-stars-rating' );
|
343 |
?></strong>
|
344 |
|
345 |
+
<div class="yasr-indented-answer">
|
346 |
+
<input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="yes"
|
347 |
+
class="yasr-auto-insert-options-class" <?php
|
348 |
if ( $option['auto_insert_exclude_pages'] === 'yes' ) {
|
349 |
echo " checked=\"checked\" " ;
|
350 |
}
|
351 |
?> >
|
352 |
+
<?php
|
353 |
_e( 'Yes', 'yet-another-stars-rating' );
|
354 |
?>
|
355 |
|
356 |
+
|
357 |
|
358 |
+
<input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="no"
|
359 |
+
class="yasr-auto-insert-options-class" <?php
|
360 |
if ( $option['auto_insert_exclude_pages'] === 'no' ) {
|
361 |
echo " checked=\"checked\" " ;
|
362 |
}
|
363 |
?> >
|
364 |
+
<?php
|
365 |
_e( 'No', 'yet-another-stars-rating' );
|
366 |
?>
|
367 |
+
<br/>
|
368 |
|
369 |
+
<p> </p>
|
370 |
|
371 |
+
</div>
|
372 |
|
373 |
+
<?php
|
374 |
$custom_post_types = yasr_get_custom_post_type( 'bool' );
|
375 |
|
376 |
if ( $custom_post_types ) {
|
377 |
?>
|
378 |
+
<strong><?php
|
379 |
_e( 'Use only in custom post types?', 'yet-another-stars-rating' );
|
380 |
?></strong>
|
381 |
+
<div class="yasr-indented-answer">
|
382 |
+
<input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="yes"
|
383 |
+
class="yasr-auto-insert-options-class" <?php
|
384 |
if ( $option['auto_insert_custom_post_only'] === 'yes' ) {
|
385 |
echo " checked=\"checked\" " ;
|
386 |
}
|
387 |
?> >
|
388 |
+
<?php
|
389 |
_e( 'Yes', 'yet-another-stars-rating' );
|
390 |
?>
|
391 |
|
392 |
+
|
393 |
|
394 |
+
<input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="no"
|
395 |
+
class="yasr-auto-insert-options-class" <?php
|
396 |
if ( $option['auto_insert_custom_post_only'] === 'no' ) {
|
397 |
echo " checked=\"checked\" " ;
|
398 |
}
|
399 |
?> >
|
400 |
+
<?php
|
401 |
_e( 'No', 'yet-another-stars-rating' );
|
402 |
?>
|
403 |
|
404 |
+
<p>
|
405 |
|
406 |
+
<?php
|
407 |
_e( "You see this because you use custom post types.", 'yet-another-stars-rating' );
|
408 |
?>
|
409 |
+
<br/>
|
410 |
+
<?php
|
411 |
_e( "If you want to use auto insert only in custom post types, choose Yes", 'yet-another-stars-rating' );
|
412 |
?>
|
413 |
|
414 |
+
<p> </p>
|
415 |
|
416 |
+
</div>
|
417 |
|
418 |
+
<?php
|
419 |
} else {
|
420 |
?>
|
421 |
+
<input type="hidden" name="yasr_general_options[auto_insert_custom_post_only]" value="no" ?>
|
422 |
+
<?php
|
423 |
}
|
424 |
|
425 |
?>
|
426 |
|
427 |
+
<?php
|
428 |
submit_button( __( 'Save Settings' ) );
|
|
|
|
|
|
|
|
|
|
|
429 |
?>
|
430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
</div>
|
432 |
|
433 |
+
<hr />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
|
435 |
<?php
|
436 |
}
|
437 |
|
438 |
+
//End yasr_auto_insert_callback
|
439 |
function yasr_custom_text_callback( $option )
|
440 |
{
|
441 |
$text_before_overall = htmlspecialchars_decode( "{$option['text_before_overall']}" );
|
547 |
submit_button( __( 'Save Settings' ) );
|
548 |
}
|
549 |
|
550 |
+
function yasr_show_overall_in_loop_callback( $option )
|
551 |
+
{
|
552 |
+
?>
|
553 |
+
|
554 |
+
<div class="yasr-onoffswitch-big">
|
555 |
+
<input type="checkbox" name="yasr_general_options[show_overall_in_loop]" class="yasr-onoffswitch-checkbox"
|
556 |
+
id="yasr-show-overall-in-loop-switch" <?php
|
557 |
+
if ( $option['show_overall_in_loop'] === 'enabled' ) {
|
558 |
+
echo " checked='checked' " ;
|
559 |
+
}
|
560 |
+
?> >
|
561 |
+
<label class="yasr-onoffswitch-label" for="yasr-show-overall-in-loop-switch">
|
562 |
+
<span class="yasr-onoffswitch-inner"></span>
|
563 |
+
<span class="yasr-onoffswitch-switch"></span>
|
564 |
+
</label>
|
565 |
+
</div>
|
566 |
+
|
567 |
+
<br/> <br/>
|
568 |
+
|
569 |
+
<?php
|
570 |
+
_e( 'If you enable this, "Overall Rating" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating' );
|
571 |
+
?>
|
572 |
+
|
573 |
+
<p> </p>
|
574 |
+
|
575 |
+
<br/>
|
576 |
+
|
577 |
+
<hr>
|
578 |
+
|
579 |
+
<?php
|
580 |
+
}
|
581 |
+
|
582 |
+
function yasr_show_visitor_votes_in_loop_callback( $option )
|
583 |
+
{
|
584 |
+
?>
|
585 |
+
|
586 |
+
<div class="yasr-onoffswitch-big">
|
587 |
+
<input type="checkbox" name="yasr_general_options[show_visitor_votes_in_loop]" class="yasr-onoffswitch-checkbox"
|
588 |
+
id="yasr-show-visitor-votes-in-loop-switch" <?php
|
589 |
+
if ( $option['show_visitor_votes_in_loop'] === 'enabled' ) {
|
590 |
+
echo " checked='checked' " ;
|
591 |
+
}
|
592 |
+
?> >
|
593 |
+
<label class="yasr-onoffswitch-label" for="yasr-show-visitor-votes-in-loop-switch">
|
594 |
+
<span class="yasr-onoffswitch-inner"></span>
|
595 |
+
<span class="yasr-onoffswitch-switch"></span>
|
596 |
+
</label>
|
597 |
+
</div>
|
598 |
+
|
599 |
+
<br/> <br/>
|
600 |
+
|
601 |
+
<?php
|
602 |
+
_e( 'If you enable this, "Visitor Votes" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating' );
|
603 |
+
?>
|
604 |
+
|
605 |
+
<p> </p>
|
606 |
+
|
607 |
+
<br/>
|
608 |
+
|
609 |
+
<hr>
|
610 |
+
|
611 |
+
<?php
|
612 |
+
}
|
613 |
+
|
614 |
function yasr_visitors_stats_callback( $option )
|
615 |
{
|
616 |
?>
|
745 |
|
746 |
<div id="yasr-snippet-explained" class="yasr-help-box-settings">
|
747 |
<?php
|
748 |
+
_e( 'If you select "Review Rating", rating average is get from yasr_overall_rating shortcode.
|
749 |
+
Your site will be indexed from search engines like this: ', 'yet-another-stars-rating' );
|
750 |
echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_review.png>" ;
|
751 |
echo "<br /> <br />" ;
|
752 |
+
_e( 'If, instead, you choose "Aggregate Rating", your site will be indexed like this', 'yet-another-stars-rating' );
|
753 |
echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_aggregate.jpg>" ;
|
754 |
?>
|
755 |
</div>
|
lib/yasr-ajax-functions.php
CHANGED
@@ -25,73 +25,6 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
25 |
|
26 |
/********** Functions used while wirting a new post or page ********/
|
27 |
|
28 |
-
/****** Get id and overall rating from post or page and write it in db, used in yasr-metabox-overall-rating******/
|
29 |
-
|
30 |
-
/*add_action( 'wp_ajax_yasr_send_overall_rating', 'yasr_insert_overall_rating_callback' );
|
31 |
-
|
32 |
-
function yasr_insert_overall_rating_callback() {
|
33 |
-
|
34 |
-
if (isset($_POST['rating']) && isset($_POST['post_id']) && $_POST['post_id'] != '') {
|
35 |
-
$rating = $_POST['rating'];
|
36 |
-
$post_id = $_POST['post_id'];
|
37 |
-
$nonce = $_POST['nonce'];
|
38 |
-
}
|
39 |
-
|
40 |
-
else {
|
41 |
-
exit();
|
42 |
-
}
|
43 |
-
|
44 |
-
if ( ! current_user_can( 'publish_posts' ) ) {
|
45 |
-
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ) );
|
46 |
-
}
|
47 |
-
|
48 |
-
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_insert_overall_rating' ) ) {
|
49 |
-
die( 'Security check' );
|
50 |
-
}
|
51 |
-
|
52 |
-
$post_id = (int)$post_id;
|
53 |
-
$rating = (float)$rating;
|
54 |
-
|
55 |
-
if ($rating > 5) {
|
56 |
-
$rating = 5;
|
57 |
-
}
|
58 |
-
|
59 |
-
//Put an action to hook into
|
60 |
-
do_action('yasr_action_on_overall_rating', $post_id, $rating);
|
61 |
-
|
62 |
-
$update_result = update_post_meta($post_id, 'yasr_overall_rating', $rating );
|
63 |
-
|
64 |
-
//if update_post_meta returns an integer means this is a new post
|
65 |
-
//so we're going to insert the default YASR_ITEMTYPE
|
66 |
-
if (is_int($update_result)) {
|
67 |
-
|
68 |
-
add_post_meta($post_id, 'yasr_review_type', YASR_ITEMTYPE);
|
69 |
-
|
70 |
-
}
|
71 |
-
|
72 |
-
//this will not work on error or
|
73 |
-
//if the value is the same in the db
|
74 |
-
if ($update_result) {
|
75 |
-
|
76 |
-
$transient_name = 'yasr_overall_rating_' . $post_id;
|
77 |
-
|
78 |
-
set_transient( $transient_name, $rating, WEEK_IN_SECONDS );
|
79 |
-
|
80 |
-
if ($rating != '-1') {
|
81 |
-
$text = __("You've rated it ", "yet-another-stars-rating");
|
82 |
-
echo $text . $rating;
|
83 |
-
}
|
84 |
-
else {
|
85 |
-
$text = __("You've reset the vote", "yet-another-stars-rating");
|
86 |
-
echo $text;
|
87 |
-
}
|
88 |
-
|
89 |
-
}
|
90 |
-
|
91 |
-
die(); // this is required to return a proper result
|
92 |
-
|
93 |
-
}*/
|
94 |
-
|
95 |
/****** Get Set name from post or page and output the set,
|
96 |
used in yasr-metabox-multiple-rating******/
|
97 |
|
@@ -942,10 +875,10 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
942 |
function yasr_visitor_multiset_field_vote_callback() {
|
943 |
|
944 |
if (isset($_POST['post_id']) && isset($_POST['rating']) && isset($_POST['set_type'])) {
|
945 |
-
$post_id
|
946 |
-
$rating
|
947 |
$set_type = $_POST['set_type'];
|
948 |
-
$nonce
|
949 |
|
950 |
if ($post_id == '' || $set_type == '') {
|
951 |
exit("Missing post id or set type");
|
@@ -955,31 +888,30 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
955 |
exit("You must insert at least a rating");
|
956 |
}
|
957 |
|
958 |
-
}
|
959 |
-
|
960 |
-
exit();
|
961 |
}
|
962 |
|
963 |
-
if (
|
964 |
-
die(
|
965 |
}
|
966 |
|
967 |
-
delete_transient(
|
968 |
|
969 |
$array_action_visitor_multiset_vote = array('post_id' => $post_id);
|
970 |
|
971 |
-
do_action('yasr_action_on_visitor_multiset_vote', $array_action_visitor_multiset_vote
|
972 |
|
973 |
global $wpdb;
|
974 |
|
975 |
$array_error = array();
|
976 |
|
977 |
-
|
978 |
-
|
979 |
|
980 |
-
|
981 |
//and then submit another one
|
982 |
-
|
983 |
|
984 |
foreach ($cleaned_array as $rating_values) {
|
985 |
|
@@ -987,36 +919,36 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
987 |
if ($rating_values['postid'] == $post_id && $rating_values['setid'] == $set_type) {
|
988 |
|
989 |
//increase the counter
|
990 |
-
$counter_matched_fields = $counter_matched_fields+1;
|
991 |
|
992 |
$id_field = $rating_values['field'];
|
993 |
-
$rating
|
994 |
|
995 |
//Find the existing votes
|
996 |
$existing_vote = $wpdb->get_results($wpdb->prepare("SELECT number_of_votes, sum_votes FROM " . YASR_MULTI_SET_VALUES_TABLE . "
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
|
1002 |
if (!empty($existing_vote)) {
|
1003 |
|
1004 |
foreach ($existing_vote as $user_votes) {
|
1005 |
$number_of_votes = $user_votes->number_of_votes;
|
1006 |
-
$user_votes_sum
|
1007 |
}
|
1008 |
|
1009 |
$number_of_votes = $number_of_votes + 1;
|
1010 |
-
$user_votes_sum
|
1011 |
|
1012 |
$query_success = $wpdb->update(
|
1013 |
YASR_MULTI_SET_VALUES_TABLE,
|
1014 |
array(
|
1015 |
'number_of_votes' => $number_of_votes,
|
1016 |
-
'sum_votes'
|
1017 |
),
|
1018 |
array(
|
1019 |
-
'post_id'
|
1020 |
'field_id' => $id_field,
|
1021 |
'set_type' => $set_type
|
1022 |
),
|
@@ -1024,9 +956,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1024 |
array('%d', '%d', '%d')
|
1025 |
);
|
1026 |
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
else {
|
1030 |
|
1031 |
//Find the highest_id (it's not auto increment on db due to gd star compatibility)
|
1032 |
$highest_id = $wpdb->get_var("SELECT id FROM " . YASR_MULTI_SET_VALUES_TABLE . " ORDER BY id DESC LIMIT 1 ");
|
@@ -1041,12 +971,12 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1041 |
$query_success = $wpdb->replace(
|
1042 |
YASR_MULTI_SET_VALUES_TABLE,
|
1043 |
array(
|
1044 |
-
'id'
|
1045 |
-
'post_id'
|
1046 |
-
'field_id'
|
1047 |
-
'set_type'
|
1048 |
'number_of_votes' => 1,
|
1049 |
-
'sum_votes'
|
1050 |
),
|
1051 |
array("%d", "%d", "%d", "%d", "%d", "%d")
|
1052 |
);
|
@@ -1055,8 +985,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1055 |
|
1056 |
if ($query_success) {
|
1057 |
$array_error[] = 0;
|
1058 |
-
}
|
1059 |
-
else {
|
1060 |
$array_error[] = 1;
|
1061 |
}
|
1062 |
|
@@ -1068,29 +997,28 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1068 |
$array_error[] = 1;
|
1069 |
}
|
1070 |
|
1071 |
-
$error_found =
|
1072 |
|
1073 |
foreach ($array_error as $error) {
|
1074 |
if ($error === 1) {
|
1075 |
-
$error_found =
|
1076 |
}
|
1077 |
}
|
1078 |
|
1079 |
-
if(!$error_found) {
|
1080 |
|
1081 |
$cookiename = 'yasr_multi_visitor_cookie';
|
1082 |
|
1083 |
$data_to_save = array(
|
1084 |
-
|
1085 |
-
|
1086 |
);
|
1087 |
|
1088 |
yasr_setcookie($cookiename, $data_to_save);
|
1089 |
|
1090 |
_e('Rating saved!', 'yet-another-stars-rating');
|
1091 |
|
1092 |
-
}
|
1093 |
-
else {
|
1094 |
_e('Rating not saved. Please Try again', 'yet-another-stars-rating');
|
1095 |
}
|
1096 |
|
25 |
|
26 |
/********** Functions used while wirting a new post or page ********/
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/****** Get Set name from post or page and output the set,
|
29 |
used in yasr-metabox-multiple-rating******/
|
30 |
|
875 |
function yasr_visitor_multiset_field_vote_callback() {
|
876 |
|
877 |
if (isset($_POST['post_id']) && isset($_POST['rating']) && isset($_POST['set_type'])) {
|
878 |
+
$post_id = $_POST['post_id'];
|
879 |
+
$rating = $_POST['rating'];
|
880 |
$set_type = $_POST['set_type'];
|
881 |
+
$nonce = $_POST['nonce'];
|
882 |
|
883 |
if ($post_id == '' || $set_type == '') {
|
884 |
exit("Missing post id or set type");
|
888 |
exit("You must insert at least a rating");
|
889 |
}
|
890 |
|
891 |
+
} else {
|
892 |
+
exit();
|
|
|
893 |
}
|
894 |
|
895 |
+
if (!wp_verify_nonce($nonce, 'yasr_nonce_insert_visitor_rating_multiset')) {
|
896 |
+
die('Security Check');
|
897 |
}
|
898 |
|
899 |
+
delete_transient('yasr_visitor_multi_set_' . $post_id . '_' . $set_type);
|
900 |
|
901 |
$array_action_visitor_multiset_vote = array('post_id' => $post_id);
|
902 |
|
903 |
+
do_action('yasr_action_on_visitor_multiset_vote', $array_action_visitor_multiset_vote);
|
904 |
|
905 |
global $wpdb;
|
906 |
|
907 |
$array_error = array();
|
908 |
|
909 |
+
//clean array, so if an user rate same field twice, take only the last rating
|
910 |
+
$cleaned_array = yasr_unique_multidim_array($rating, 'field');
|
911 |
|
912 |
+
//this is a counter: if at the end of the foreach it still 0, means that an user rated in a set
|
913 |
//and then submit another one
|
914 |
+
$counter_matched_fields = 0;
|
915 |
|
916 |
foreach ($cleaned_array as $rating_values) {
|
917 |
|
919 |
if ($rating_values['postid'] == $post_id && $rating_values['setid'] == $set_type) {
|
920 |
|
921 |
//increase the counter
|
922 |
+
$counter_matched_fields = $counter_matched_fields + 1;
|
923 |
|
924 |
$id_field = $rating_values['field'];
|
925 |
+
$rating = $rating_values['rating'];
|
926 |
|
927 |
//Find the existing votes
|
928 |
$existing_vote = $wpdb->get_results($wpdb->prepare("SELECT number_of_votes, sum_votes FROM " . YASR_MULTI_SET_VALUES_TABLE . "
|
929 |
+
WHERE post_id = %d
|
930 |
+
AND set_type = %d
|
931 |
+
AND field_id = %d
|
932 |
+
", $post_id, $set_type, $id_field));
|
933 |
|
934 |
if (!empty($existing_vote)) {
|
935 |
|
936 |
foreach ($existing_vote as $user_votes) {
|
937 |
$number_of_votes = $user_votes->number_of_votes;
|
938 |
+
$user_votes_sum = $user_votes->sum_votes;
|
939 |
}
|
940 |
|
941 |
$number_of_votes = $number_of_votes + 1;
|
942 |
+
$user_votes_sum = $user_votes_sum + $rating;
|
943 |
|
944 |
$query_success = $wpdb->update(
|
945 |
YASR_MULTI_SET_VALUES_TABLE,
|
946 |
array(
|
947 |
'number_of_votes' => $number_of_votes,
|
948 |
+
'sum_votes' => $user_votes_sum,
|
949 |
),
|
950 |
array(
|
951 |
+
'post_id' => $post_id,
|
952 |
'field_id' => $id_field,
|
953 |
'set_type' => $set_type
|
954 |
),
|
956 |
array('%d', '%d', '%d')
|
957 |
);
|
958 |
|
959 |
+
} else {
|
|
|
|
|
960 |
|
961 |
//Find the highest_id (it's not auto increment on db due to gd star compatibility)
|
962 |
$highest_id = $wpdb->get_var("SELECT id FROM " . YASR_MULTI_SET_VALUES_TABLE . " ORDER BY id DESC LIMIT 1 ");
|
971 |
$query_success = $wpdb->replace(
|
972 |
YASR_MULTI_SET_VALUES_TABLE,
|
973 |
array(
|
974 |
+
'id' => $new_id,
|
975 |
+
'post_id' => $post_id,
|
976 |
+
'field_id' => $id_field,
|
977 |
+
'set_type' => $set_type,
|
978 |
'number_of_votes' => 1,
|
979 |
+
'sum_votes' => $rating
|
980 |
),
|
981 |
array("%d", "%d", "%d", "%d", "%d", "%d")
|
982 |
);
|
985 |
|
986 |
if ($query_success) {
|
987 |
$array_error[] = 0;
|
988 |
+
} else {
|
|
|
989 |
$array_error[] = 1;
|
990 |
}
|
991 |
|
997 |
$array_error[] = 1;
|
998 |
}
|
999 |
|
1000 |
+
$error_found = false;
|
1001 |
|
1002 |
foreach ($array_error as $error) {
|
1003 |
if ($error === 1) {
|
1004 |
+
$error_found = true;
|
1005 |
}
|
1006 |
}
|
1007 |
|
1008 |
+
if (!$error_found) {
|
1009 |
|
1010 |
$cookiename = 'yasr_multi_visitor_cookie';
|
1011 |
|
1012 |
$data_to_save = array(
|
1013 |
+
'post_id' => $post_id,
|
1014 |
+
'set_id' => $set_type
|
1015 |
);
|
1016 |
|
1017 |
yasr_setcookie($cookiename, $data_to_save);
|
1018 |
|
1019 |
_e('Rating saved!', 'yet-another-stars-rating');
|
1020 |
|
1021 |
+
} else {
|
|
|
1022 |
_e('Rating not saved. Please Try again', 'yet-another-stars-rating');
|
1023 |
}
|
1024 |
|
lib/yasr-db-functions.php
CHANGED
@@ -34,44 +34,44 @@ function yasr_install() {
|
|
34 |
$yasr_log_table = $prefix . 'log';
|
35 |
|
36 |
$sql_yasr_multi_set_table = "CREATE TABLE IF NOT EXISTS $yasr_multi_set_table (
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
$sql_yasr_multi_set_fields = "CREATE TABLE IF NOT EXISTS $yasr_multi_set_fields (
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
$sql_yasr_multi_value_table = "CREATE TABLE IF NOT EXISTS $yasr_multi_values_table (
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
$sql_yasr_log_table = "CREATE TABLE IF NOT EXISTS $yasr_log_table (
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
|
77 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
@@ -813,7 +813,6 @@ function yasr_insert_overall_rating_callback($post_id) {
|
|
813 |
if ($is_ajax === true) {
|
814 |
echo json_encode('KO');
|
815 |
}
|
816 |
-
|
817 |
return;
|
818 |
}
|
819 |
|
34 |
$yasr_log_table = $prefix . 'log';
|
35 |
|
36 |
$sql_yasr_multi_set_table = "CREATE TABLE IF NOT EXISTS $yasr_multi_set_table (
|
37 |
+
set_id int(2) NOT NULL,
|
38 |
+
set_name varchar(64) COLLATE utf8_unicode_ci NOT NULL,
|
39 |
+
UNIQUE KEY set_id (set_id),
|
40 |
+
UNIQUE KEY set_name (set_name)
|
41 |
+
)";
|
42 |
|
43 |
$sql_yasr_multi_set_fields = "CREATE TABLE IF NOT EXISTS $yasr_multi_set_fields (
|
44 |
+
id bigint(20) NOT NULL,
|
45 |
+
parent_set_id int(2) NOT NULL,
|
46 |
+
field_name varchar(40) COLLATE utf8_unicode_ci NOT NULL,
|
47 |
+
field_id int(2) NOT NULL,
|
48 |
+
PRIMARY KEY (id),
|
49 |
+
UNIQUE KEY id (id)
|
50 |
+
)";
|
51 |
|
52 |
$sql_yasr_multi_value_table = "CREATE TABLE IF NOT EXISTS $yasr_multi_values_table (
|
53 |
+
id bigint(20) NOT NULL,
|
54 |
+
field_id int(2) NOT NULL,
|
55 |
+
set_type int (2) NOT NULL,
|
56 |
+
post_id bigint(20) NOT NULL,
|
57 |
+
votes decimal(2,1) NOT NULL,
|
58 |
+
number_of_votes bigint(20) NOT NULL,
|
59 |
+
sum_votes decimal(11, 1) NOT NULL,
|
60 |
+
PRIMARY KEY (id),
|
61 |
+
UNIQUE KEY id (id)
|
62 |
+
);";
|
63 |
|
64 |
$sql_yasr_log_table = "CREATE TABLE IF NOT EXISTS $yasr_log_table (
|
65 |
+
id bigint(20) NOT NULL AUTO_INCREMENT,
|
66 |
+
post_id bigint(20) NOT NULL,
|
67 |
+
multi_set_id int(2) NOT NULL,
|
68 |
+
user_id int(11) NOT NULL,
|
69 |
+
vote decimal(11,1) NOT NULL,
|
70 |
+
date datetime NOT NULL,
|
71 |
+
ip varchar(45) COLLATE utf8_unicode_ci NOT NULL,
|
72 |
+
PRIMARY KEY (id),
|
73 |
+
UNIQUE KEY id (id)
|
74 |
+
);";
|
75 |
|
76 |
|
77 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
813 |
if ($is_ajax === true) {
|
814 |
echo json_encode('KO');
|
815 |
}
|
|
|
816 |
return;
|
817 |
}
|
818 |
|
lib/yasr-functions.php
CHANGED
@@ -18,146 +18,144 @@ You should have received a copy of the GNU General Public License
|
|
18 |
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
*/
|
20 |
|
21 |
-
if (
|
|
|
|
|
22 |
|
23 |
|
24 |
/***** Adding javascript and css *****/
|
25 |
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
wp_enqueue_style( 'yasrcssdarkscheme', YASR_CSS_DIR . 'yasr-table-dark.css', array('yasrcss'), YASR_VERSION_NUM, 'all' );
|
44 |
-
}
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
}
|
56 |
|
57 |
|
58 |
-
|
59 |
-
|
60 |
|
61 |
-
|
62 |
|
63 |
-
|
64 |
|
65 |
-
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
|
84 |
-
|
85 |
|
86 |
-
|
|
|
|
|
|
|
87 |
|
88 |
-
|
89 |
|
90 |
-
|
91 |
|
92 |
-
|
93 |
|
94 |
-
|
95 |
|
96 |
-
|
97 |
|
98 |
-
|
99 |
|
100 |
-
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
107 |
|
108 |
-
|
109 |
|
110 |
|
111 |
-
|
112 |
|
113 |
/*** Css rules for stars set, from version 1.2.7
|
114 |
-
Here I use add_action instead of directly use wp_add_inline_style so I can
|
115 |
-
use remove_action if needed (e.g. Yasr Stylish)
|
116 |
-
***/
|
117 |
|
118 |
-
add_action(
|
119 |
-
add_action(
|
120 |
|
121 |
function yasr_css_stars_set() {
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
132 |
}
|
133 |
|
134 |
-
//by default, use the one provided by Yasr
|
135 |
-
else {
|
136 |
-
$star_grey = YASR_IMG_DIR . 'star_2.svg';
|
137 |
-
$star_yellow = YASR_IMG_DIR . 'star_3.svg';
|
138 |
-
}
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
.star-rating {
|
143 |
background-image: url(\"$star_grey\");
|
144 |
}
|
145 |
.star-rating .star-value {
|
146 |
background: url(\"$star_yellow\") ;
|
147 |
}
|
148 |
-
|
149 |
|
150 |
-
|
151 |
|
152 |
}
|
153 |
|
154 |
-
add_action(
|
155 |
-
add_action(
|
156 |
|
157 |
-
function yasr_rtl_support
|
158 |
|
159 |
if (is_rtl()) {
|
160 |
-
|
161 |
$yasr_rtl_css = '.star-rating .star-value {
|
162 |
-moz-transform: scaleX(-1);
|
163 |
-o-transform: scaleX(-1);
|
@@ -170,7 +168,7 @@ function yasr_rtl_support () {
|
|
170 |
left: auto;
|
171 |
}';
|
172 |
|
173 |
-
|
174 |
|
175 |
}
|
176 |
|
@@ -179,180 +177,172 @@ function yasr_rtl_support () {
|
|
179 |
|
180 |
/****** Translating YASR ******/
|
181 |
|
182 |
-
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
|
188 |
|
189 |
/****** Create a new Page in Administration Menu ******/
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
function yasr_add_pages() {
|
195 |
|
196 |
-
|
197 |
|
198 |
-
|
199 |
-
$yasr_settings_page = add_menu_page(
|
200 |
-
__( 'Yet Another Stars Rating: settings', 'yet-another-stars-rating' ), //Page Title
|
201 |
-
__( 'Yet Another Stars Rating', 'yet-another-stars-rating' ), //Menu Title
|
202 |
-
'manage_options', //capability
|
203 |
-
'yasr_settings_page', //menu slug
|
204 |
-
'yasr_settings_page_callback', //The function to be called to output the content for this page.
|
205 |
-
'dashicons-star-half'
|
206 |
-
);
|
207 |
-
|
208 |
-
add_submenu_page('yasr_settings_page',
|
209 |
-
'Yet Another Stars Rating: settings',
|
210 |
-
'Settings',
|
211 |
-
'manage_options',
|
212 |
-
'yasr_settings_page'
|
213 |
-
);
|
214 |
-
|
215 |
-
add_submenu_page('yasr_settings_page',
|
216 |
-
'Yet Another Stars Rating: All Rating',
|
217 |
-
'Logs',
|
218 |
-
'manage_options',
|
219 |
-
'yasr_stats_page',
|
220 |
-
'yasr_stats_page_callback'
|
221 |
-
);
|
222 |
-
|
223 |
-
if (yasr_fs()->is_free_plan()) {
|
224 |
-
global $submenu;
|
225 |
-
$permalink = '#';
|
226 |
-
$contact_us_string = sprintf(__('Contact Us %s', 'yet-another-stars-rating'), '<span class="dashicons dashicons-lock" />');
|
227 |
-
$submenu['yasr_settings_page'][] = array( $contact_us_string, 'manage_options', $permalink );
|
228 |
-
}
|
229 |
-
|
230 |
-
}
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
240 |
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
-
|
247 |
-
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ) );
|
248 |
-
}
|
249 |
|
250 |
-
|
|
|
251 |
|
|
|
|
|
252 |
}
|
253 |
|
|
|
254 |
|
255 |
-
|
256 |
-
|
257 |
-
if (YASR_AUTO_INSERT_ENABLED == 1) {
|
258 |
-
|
259 |
-
if (!is_admin()) {
|
260 |
|
261 |
-
add_filter('the_content', 'yasr_auto_insert_shortcode_callback');
|
262 |
|
263 |
-
|
264 |
|
265 |
-
|
|
|
|
|
266 |
|
267 |
-
|
268 |
|
269 |
-
|
270 |
-
$post_excluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', TRUE);
|
271 |
|
272 |
-
if($post_excluded === 'yes') {
|
273 |
|
274 |
-
|
275 |
|
276 |
-
|
277 |
|
278 |
-
|
|
|
|
|
279 |
|
280 |
-
|
281 |
|
282 |
-
|
283 |
|
284 |
-
|
285 |
-
|
286 |
-
case 'top':
|
287 |
-
$content_and_stars = $overall_rating_code . $content;
|
288 |
-
break;
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
} //End Switch
|
294 |
-
} //end YASR_AUTO_INSERT_WHAT overall rating
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
|
302 |
-
|
303 |
-
|
304 |
-
break;
|
305 |
-
} //End Switch
|
306 |
-
}
|
307 |
|
308 |
-
|
309 |
-
switch (YASR_AUTO_INSERT_WHERE) {
|
310 |
-
case 'top':
|
311 |
-
$content_and_stars = $overall_rating_code . $visitor_votes_code . $content;
|
312 |
-
break;
|
313 |
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
|
|
|
|
318 |
}
|
319 |
|
320 |
-
|
321 |
-
if (YASR_AUTO_INSERT_CUSTOM_POST_ONLY === 'yes') {
|
322 |
-
|
323 |
-
$custom_post_types = yasr_get_custom_post_type();
|
324 |
-
|
325 |
-
//If is a post type return content and stars
|
326 |
-
if (is_singular($custom_post_types)) {
|
327 |
-
return $content_and_stars;
|
328 |
-
}
|
329 |
-
|
330 |
-
//else return just content
|
331 |
-
else {
|
332 |
-
return $content;
|
333 |
-
}
|
334 |
-
|
335 |
-
}
|
336 |
|
337 |
-
|
338 |
-
|
|
|
|
|
|
|
|
|
339 |
return $content_and_stars;
|
|
|
|
|
|
|
340 |
}
|
|
|
341 |
|
342 |
-
|
343 |
-
elseif (YASR_AUTO_INSERT_EXCLUDE_PAGES === 'yes') {
|
344 |
-
if ( !is_page() ) {
|
345 |
-
return $content_and_stars;
|
346 |
-
}
|
347 |
-
//If is a page return the content without stars
|
348 |
-
else {
|
349 |
-
return $content;
|
350 |
-
}
|
351 |
-
}
|
352 |
-
|
353 |
-
} //End function yasr_auto_insert_shortcode_callback
|
354 |
|
355 |
-
|
356 |
|
357 |
|
358 |
/****** Add review schema data at the end of the post *******/
|
@@ -360,322 +350,293 @@ function yasr_rtl_support () {
|
|
360 |
|
361 |
add_filter('the_content', 'yasr_add_schema');
|
362 |
|
363 |
-
|
364 |
-
|
365 |
-
//Add buddypress compatibility
|
366 |
-
if (function_exists('bp_is_active')) {
|
367 |
-
//Return content only if is page. This will disable schema for all page.
|
368 |
-
//If I try to return $content after if (YASR_SNIPPET == 'overall_rating')
|
369 |
-
//or (YASR_SNIPPET == 'visitor_rating') $content will have only wp content, losing the buddypress one
|
370 |
-
if (is_page()) {
|
371 |
-
return $content;
|
372 |
-
}
|
373 |
-
}
|
374 |
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
376 |
return $content;
|
377 |
}
|
|
|
378 |
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
$review_choosen = yasr_get_snippet_type();
|
384 |
-
|
385 |
-
//if doesn't exists a filter for yasr_filter_schema_jsonld $review_chosen value is assigned to $filtered_schema...
|
386 |
-
$filtered_schema = apply_filters( 'yasr_filter_schema_jsonld', $review_choosen );
|
387 |
-
|
388 |
-
//So check here if $schema != $review_choosen
|
389 |
-
if ($filtered_schema !== $review_choosen) {
|
390 |
-
|
391 |
-
return $content . $script_type . $filtered_schema . $end_script_type;
|
392 |
-
|
393 |
-
}
|
394 |
-
|
395 |
-
$rich_snippet["@context"] = "http://schema.org/";
|
396 |
-
|
397 |
-
|
398 |
-
$author = get_the_author();
|
399 |
-
|
400 |
-
$review_name = get_the_title();
|
401 |
-
|
402 |
-
$date = get_the_date('c');
|
403 |
-
|
404 |
-
$date_modified = get_the_modified_date('c');
|
405 |
-
|
406 |
-
$post_image_url = ''; //avoid undefined
|
407 |
-
$logo_image_url = ''; //avoid undefined
|
408 |
-
|
409 |
-
if (defined('YASR_BLOGPOSTING_ORGANIZATION_LOGO')) {
|
410 |
-
|
411 |
-
$logo_image_url = YASR_BLOGPOSTING_ORGANIZATION_LOGO;
|
412 |
-
|
413 |
-
$post_image_url = $logo_image_url; //this will be overwritten if has_post_thumbnail is true
|
414 |
-
|
415 |
-
$logo_image_url_absolute = $_SERVER['DOCUMENT_ROOT'] . parse_url(YASR_BLOGPOSTING_ORGANIZATION_LOGO, PHP_URL_PATH);
|
416 |
-
|
417 |
-
$post_image_size = @getimagesize($logo_image_url_absolute); //the @ should be useless, just to be safe
|
418 |
|
419 |
-
|
|
|
420 |
|
421 |
-
|
422 |
|
423 |
-
|
424 |
-
|
425 |
-
$post_image_size[1] = 0;
|
426 |
|
427 |
-
|
428 |
-
|
429 |
-
|
|
|
430 |
|
431 |
-
|
432 |
-
if (has_post_thumbnail() ) {
|
433 |
|
434 |
-
$post_image_url = wp_get_attachment_url(get_post_thumbnail_id());
|
435 |
|
436 |
-
|
|
|
437 |
|
438 |
-
|
|
|
439 |
|
440 |
-
|
|
|
441 |
|
|
|
|
|
|
|
442 |
|
443 |
-
|
444 |
|
445 |
-
|
446 |
|
447 |
-
|
448 |
|
449 |
-
|
|
|
|
|
450 |
|
451 |
-
|
|
|
|
|
452 |
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
|
460 |
-
}
|
461 |
|
462 |
-
|
463 |
|
464 |
-
|
465 |
|
466 |
-
|
467 |
|
468 |
-
|
469 |
|
470 |
-
|
|
|
|
|
|
|
|
|
|
|
471 |
|
472 |
-
|
473 |
|
474 |
-
|
475 |
|
476 |
-
|
477 |
-
"@type" => "WebPage",
|
478 |
-
"@id" => get_permalink()
|
479 |
-
);
|
480 |
|
|
|
481 |
|
482 |
-
|
483 |
-
"@type" => "Person",
|
484 |
-
"name" => "$author"
|
485 |
-
);
|
486 |
|
487 |
-
|
488 |
-
"@type" => "Organization",
|
489 |
-
"name" => YASR_BLOGPOSTING_ORGANIZATION_NAME,
|
490 |
-
"logo" => array(
|
491 |
-
"@type" => "ImageObject",
|
492 |
-
"url" => $logo_image_url,
|
493 |
-
"width" => $logo_image_size[0],
|
494 |
-
"height" => $logo_image_size[1]
|
495 |
-
)
|
496 |
|
497 |
-
|
|
|
|
|
|
|
498 |
|
499 |
-
$rich_snippet["dateModified"] = $date_modified;
|
500 |
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
"height" => $post_image_size[1]
|
506 |
-
);
|
507 |
|
508 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
|
510 |
-
|
511 |
|
512 |
-
|
513 |
|
514 |
-
|
|
|
|
|
|
|
|
|
|
|
515 |
|
516 |
-
|
517 |
|
518 |
-
|
519 |
-
$rich_snippet["name"] = $review_name;
|
520 |
|
521 |
-
|
522 |
-
"@type" => "Review",
|
523 |
-
"name" => "$review_name",
|
524 |
-
"author" => array(
|
525 |
-
"@type" => "Person",
|
526 |
-
"name" => "$author"
|
527 |
-
),
|
528 |
-
"datePublished" => "$date",
|
529 |
-
"reviewRating" => array(
|
530 |
-
"@type" => "Rating",
|
531 |
-
"ratingValue" => "$overall_rating",
|
532 |
-
),
|
533 |
-
);
|
534 |
|
535 |
-
|
536 |
|
537 |
-
|
538 |
|
539 |
-
|
|
|
540 |
|
541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
|
543 |
-
|
544 |
|
545 |
-
|
546 |
|
547 |
-
|
548 |
|
549 |
-
|
550 |
|
551 |
-
|
552 |
-
$visitor_rating['votes_number']=$rating->number_of_votes;
|
553 |
-
$visitor_rating['sum']=$rating->sum_votes;
|
554 |
-
}
|
555 |
|
556 |
-
|
557 |
|
558 |
-
|
559 |
|
560 |
-
|
561 |
|
|
|
|
|
|
|
562 |
}
|
563 |
|
564 |
-
|
565 |
|
566 |
-
|
567 |
|
568 |
-
|
569 |
|
570 |
-
|
571 |
-
$rich_snippet["name"] = $review_name;
|
572 |
|
573 |
-
|
574 |
-
"@type" => "AggregateRating",
|
575 |
-
"ratingValue" => "$average_rating",
|
576 |
-
"ratingCount" => $visitor_rating['votes_number'],
|
577 |
-
);
|
578 |
|
579 |
-
|
580 |
|
581 |
-
|
|
|
582 |
|
583 |
-
|
|
|
|
|
|
|
|
|
584 |
|
585 |
-
|
586 |
|
587 |
-
|
588 |
|
589 |
-
if ( is_singular() && is_main_query() && !is_404() ) {
|
590 |
-
return $content . $script_type . json_encode($rich_snippet) . $end_script_type;
|
591 |
}
|
592 |
|
593 |
-
|
594 |
-
return $content;
|
595 |
-
}
|
596 |
|
|
|
|
|
|
|
|
|
|
|
597 |
|
598 |
|
599 |
-
|
600 |
|
601 |
|
602 |
/****** Create a select menu to choose the rich snippet itemtype ******/
|
603 |
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
?>
|
627 |
|
628 |
-
|
629 |
|
630 |
-
|
631 |
|
632 |
-
|
633 |
|
634 |
-
|
635 |
|
636 |
-
|
637 |
-
echo "<option value=\"$i\" selected>$type</option>";
|
638 |
-
}
|
639 |
|
640 |
-
|
641 |
-
|
642 |
-
|
|
|
|
|
643 |
|
644 |
-
|
645 |
|
646 |
-
|
647 |
|
648 |
|
649 |
-
|
650 |
|
651 |
-
|
652 |
|
653 |
-
|
654 |
|
655 |
-
|
656 |
|
657 |
|
658 |
/******* Add a media content button ******/
|
659 |
|
660 |
add_action('media_buttons', 'yasr_shortcode_button_media', 99);
|
661 |
|
662 |
-
|
663 |
|
664 |
-
|
665 |
|
666 |
-
|
667 |
|
668 |
-
|
669 |
|
670 |
-
|
671 |
-
|
672 |
-
}
|
673 |
|
|
|
674 |
|
675 |
|
676 |
/****** Return the custom post type if exists
|
677 |
-
Argument is to set what to return, if array or boolean value.
|
678 |
-
Default: array******/
|
679 |
|
680 |
add_action('admin_init', 'yasr_get_custom_post_type');
|
681 |
|
@@ -685,13 +646,13 @@ add_action('rest_api_init', function () {
|
|
685 |
'yet-another-stars-rating/v1/',
|
686 |
'/list-posts-types',
|
687 |
array(
|
688 |
-
'methods'
|
689 |
'callback' => 'yasr_get_custom_post_type',
|
690 |
)
|
691 |
);
|
692 |
});
|
693 |
|
694 |
-
function yasr_get_custom_post_type($return_value='array') {
|
695 |
|
696 |
//if this is a rest request $return_value is an object called WP_REST_Request
|
697 |
//overwrite content to 'array'
|
@@ -706,7 +667,7 @@ function yasr_get_custom_post_type($return_value='array') {
|
|
706 |
'_builtin' => false
|
707 |
);
|
708 |
|
709 |
-
$output
|
710 |
$operator = 'and'; // 'and' or 'or'
|
711 |
|
712 |
$post_types = get_post_types($args, $output, $operator);
|
@@ -726,7 +687,7 @@ function yasr_get_custom_post_type($return_value='array') {
|
|
726 |
|
727 |
|
728 |
/*** function that get the star size and return it***/
|
729 |
-
function yasr_stars_size
|
730 |
|
731 |
$size = sanitize_text_field($size);
|
732 |
|
@@ -734,13 +695,9 @@ function yasr_stars_size ($size) {
|
|
734 |
|
735 |
if ($size === 'small') {
|
736 |
$stars_attribute['px_size'] = '16';
|
737 |
-
}
|
738 |
-
|
739 |
-
elseif ($size === 'medium') {
|
740 |
$stars_attribute['px_size'] = '24';
|
741 |
-
}
|
742 |
-
|
743 |
-
//default values
|
744 |
else {
|
745 |
$stars_attribute['px_size'] = '32';
|
746 |
}
|
@@ -750,43 +707,39 @@ function yasr_stars_size ($size) {
|
|
750 |
}
|
751 |
|
752 |
|
753 |
-
|
754 |
/*** Add support for wp super cache ***/
|
755 |
function yasr_wp_super_cache_support($post_id) {
|
756 |
-
if(function_exists('wp_cache_post_change')) {
|
757 |
wp_cache_post_change($post_id);
|
758 |
}
|
759 |
}
|
760 |
|
761 |
/*** Add support for wp rocket, thanks to GeekPress
|
762 |
-
https://wordpress.org/support/topic/compatibility-with-wp-rocket-2
|
763 |
-
***/
|
764 |
function yasr_wp_rocket_support($post_id) {
|
765 |
-
if(function_exists('rocket_clean_post')) {
|
766 |
rocket_clean_post($post_id);
|
767 |
}
|
768 |
}
|
769 |
|
770 |
-
/*** Add support for LiteSpeed Cache plugin, thanks to Pako69
|
771 |
-
https://wordpress.org/support/topic/yasr-is-litespeed-cache-plugin-compatible/
|
772 |
-
***/
|
773 |
function yasr_litespeed_cache_support($post_id) {
|
774 |
-
if (method_exists(
|
775 |
-
LiteSpeed_Cache_API::purge_post(
|
776 |
}
|
777 |
}
|
778 |
|
779 |
/*** Add support for cache enabler ***/
|
780 |
function yasr_cache_enabler_support($post_id, $is_singular) {
|
781 |
|
782 |
-
if (
|
783 |
-
|
784 |
//IF is in the single post or page delete only that cache
|
785 |
if ($is_singular === 'true') {
|
786 |
do_action('ce_clear_post_cache', $post_id);
|
787 |
-
}
|
788 |
-
|
789 |
-
//otherwise, delete everything
|
790 |
else {
|
791 |
do_action('ce_clear_cache');
|
792 |
}
|
@@ -800,238 +753,233 @@ function yasr_cache_enabler_support($post_id, $is_singular) {
|
|
800 |
function yasr_wp_fastest_cache($post_id, $is_singular) {
|
801 |
|
802 |
if ($is_singular === 'true') {
|
803 |
-
|
804 |
if (isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'singleDeleteCache')) {
|
805 |
$GLOBALS['wp_fastest_cache']->singleDeleteCache(false, $post_id);
|
806 |
}
|
807 |
-
|
808 |
-
|
809 |
-
else {
|
810 |
-
|
811 |
-
if(isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')){
|
812 |
$GLOBALS['wp_fastest_cache']->deleteCache();
|
813 |
}
|
814 |
-
|
815 |
}
|
816 |
|
817 |
|
818 |
}
|
819 |
|
820 |
/*** Function to set cookie, since version 0.8.3 ***/
|
821 |
-
|
822 |
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
|
827 |
-
|
828 |
|
829 |
-
|
830 |
|
831 |
-
|
832 |
-
|
833 |
|
834 |
-
|
835 |
-
|
836 |
|
837 |
-
|
838 |
|
839 |
-
|
840 |
-
|
841 |
|
842 |
-
|
843 |
|
844 |
-
|
845 |
|
846 |
-
|
847 |
|
848 |
/*** Function to get ip, since version 0.8.8
|
849 |
-
This code can be found on http://codex.wordpress.org/Plugin_API/Filter_Reference/pre_comment_user_ip
|
850 |
-
***/
|
851 |
|
852 |
function yasr_get_ip() {
|
853 |
|
854 |
if (YASR_ENABLE_IP === 'yes') {
|
855 |
|
856 |
-
|
857 |
-
|
858 |
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
|
863 |
|
864 |
-
|
865 |
|
866 |
-
|
867 |
|
868 |
-
|
869 |
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
|
874 |
-
|
875 |
* Some php environments will use the $_SERVER['HTTP_X_FORWARDED_FOR']
|
876 |
* variable to capture visitor address information.
|
877 |
*/
|
878 |
|
879 |
-
elseif (
|
880 |
|
881 |
-
|
882 |
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
}
|
888 |
|
889 |
-
|
890 |
|
891 |
-
|
892 |
|
893 |
-
else {
|
894 |
return ('X.X.X.X');
|
895 |
}
|
896 |
|
897 |
|
898 |
-
|
899 |
}
|
900 |
|
901 |
|
902 |
-
|
903 |
-
|
904 |
/*function to remove duplicate in an array for a specific key
|
905 |
Taken value: array to search, key
|
906 |
*/
|
907 |
|
908 |
function yasr_unique_multidim_array($array, $key) {
|
909 |
|
910 |
-
|
911 |
-
|
912 |
|
913 |
-
|
914 |
-
|
915 |
|
916 |
-
|
917 |
|
918 |
-
|
919 |
|
920 |
-
|
921 |
-
|
922 |
|
923 |
-
|
924 |
-
|
925 |
|
926 |
-
|
927 |
|
928 |
-
|
929 |
|
930 |
-
|
931 |
|
932 |
-
|
933 |
|
934 |
-
|
935 |
|
936 |
-
|
937 |
|
938 |
}
|
939 |
|
940 |
|
941 |
//Delete caches for wp_super_Cache and wp_rocket
|
942 |
-
add_action('yasr_action_on_visitor_vote', 'yasr_delete_cache'
|
943 |
add_action('yasr_action_on_visitor_multiset_vote', 'yasr_delete_cache');
|
944 |
|
945 |
function yasr_delete_cache($array_action_visitor_vote) {
|
946 |
|
947 |
-
if(isset($array_action_visitor_vote['post_id'])) {
|
948 |
$post_id = $array_action_visitor_vote['post_id'];
|
949 |
-
}
|
950 |
-
else {
|
951 |
return;
|
952 |
}
|
953 |
|
954 |
-
if(isset($array_action_visitor_vote['is_singular'])) {
|
955 |
$is_singular = $array_action_visitor_vote['is_singular'];
|
956 |
-
}
|
957 |
-
else {
|
958 |
return;
|
959 |
}
|
960 |
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
yasr_wp_fastest_cache($post_id, $is_singular);
|
966 |
|
967 |
}
|
968 |
|
969 |
|
970 |
-
function yasr_check_valid_url
|
971 |
|
972 |
$timeout = 5;
|
973 |
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
//Check if curl is installed
|
978 |
-
if (function_exists('curl_version')) {
|
979 |
|
980 |
-
|
981 |
-
|
982 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
983 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
984 |
|
985 |
-
|
986 |
-
|
987 |
-
|
|
|
988 |
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
}
|
993 |
-
else
|
994 |
-
{
|
995 |
-
return false;
|
996 |
-
}
|
997 |
-
//close curl
|
998 |
-
curl_close($ch);
|
999 |
|
1000 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1001 |
|
1002 |
-
|
1003 |
-
|
1004 |
|
1005 |
-
|
1006 |
-
|
1007 |
|
1008 |
-
|
1009 |
-
|
1010 |
|
1011 |
-
|
1012 |
-
|
1013 |
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
|
|
|
|
1022 |
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
|
1028 |
-
|
1029 |
-
}
|
1030 |
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1034 |
|
|
|
|
|
|
|
|
|
1035 |
}
|
1036 |
|
1037 |
?>
|
18 |
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
*/
|
20 |
|
21 |
+
if (!defined('ABSPATH')) {
|
22 |
+
exit('You\'re not allowed to see this page');
|
23 |
+
} // Exit if accessed directly
|
24 |
|
25 |
|
26 |
/***** Adding javascript and css *****/
|
27 |
|
28 |
+
add_action('wp_enqueue_scripts', 'yasr_add_scripts');
|
29 |
+
add_action('admin_enqueue_scripts', 'yasr_add_admin_scripts');
|
30 |
|
31 |
+
function yasr_add_scripts() {
|
32 |
|
33 |
+
wp_enqueue_style('yasrcss', YASR_CSS_DIR . 'yasr.css', false, YASR_VERSION_NUM, 'all');
|
34 |
+
wp_enqueue_style('dashicons'); //dashicons
|
35 |
|
36 |
+
//Run after default css are loaded
|
37 |
+
do_action('yasr_add_front_script_css');
|
38 |
|
39 |
+
//If choosen is light or not dark (force to be default)
|
40 |
+
if (YASR_SCHEME_COLOR === 'light' || YASR_SCHEME_COLOR != 'dark') {
|
41 |
+
wp_enqueue_style('yasrcsslightscheme', YASR_CSS_DIR . 'yasr-table-light.css', array('yasrcss'), YASR_VERSION_NUM, 'all');
|
42 |
+
} elseif (YASR_SCHEME_COLOR === 'dark') {
|
43 |
+
wp_enqueue_style('yasrcssdarkscheme', YASR_CSS_DIR . 'yasr-table-dark.css', array('yasrcss'), YASR_VERSION_NUM, 'all');
|
44 |
+
}
|
|
|
|
|
45 |
|
46 |
+
if (YASR_CUSTOM_CSS_RULES) {
|
47 |
+
wp_add_inline_style('yasrcss', YASR_CUSTOM_CSS_RULES);
|
48 |
+
}
|
49 |
|
50 |
+
if (!is_rtl()) {
|
51 |
+
wp_enqueue_script('rater', YASR_JS_DIR . 'rater-js.js', '', YASR_VERSION_NUM, true);
|
52 |
+
} else {
|
53 |
+
wp_enqueue_script('rater', YASR_JS_DIR . 'rater-js-rtl.js', '', YASR_VERSION_NUM, true);
|
54 |
+
}
|
|
|
55 |
|
56 |
|
57 |
+
wp_enqueue_script('yasrfront', YASR_JS_DIR . 'yasr-front.js', array('jquery', 'rater'), YASR_VERSION_NUM, true);
|
58 |
+
wp_enqueue_script('tippy', YASR_JS_DIR . 'tippy.all.min.js', '', '3.6.0', true);
|
59 |
|
60 |
+
do_action('yasr_add_front_script_js');
|
61 |
|
62 |
+
$yasr_visitor_votes_loader = '<div id="loader-visitor-rating" style="display: inline"> ' . ' <img src=' . YASR_IMG_DIR . 'loader.gif title="yasr-loader" alt="yasr-loader"></div>';
|
63 |
|
64 |
+
$tooltip_values = __("bad, poor, ok, good, super", 'yet-another-stars-rating');
|
65 |
+
$tooltip_values_exploded = explode(", ", $tooltip_values);
|
66 |
|
67 |
+
wp_localize_script('yasrfront', 'yasrCommonData',
|
68 |
+
array(
|
69 |
+
'postid' => get_the_ID(),
|
70 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
71 |
+
'loggedUser' => is_user_logged_in(),
|
72 |
+
'visitorStatsEnabled' => YASR_VISITORS_STATS,
|
73 |
+
'tooltipValues' => $tooltip_values_exploded,
|
74 |
+
'loaderHtml' => $yasr_visitor_votes_loader,
|
75 |
+
)
|
76 |
+
);
|
77 |
|
78 |
+
}
|
79 |
|
80 |
+
//$hook contain the current page in the admin side
|
81 |
+
function yasr_add_admin_scripts($hook) {
|
82 |
|
83 |
+
global $yasr_settings_page;
|
84 |
|
85 |
+
if ($hook === 'index.php' || $hook === 'edit.php' || $hook === 'post.php' || $hook === 'post-new.php' ||
|
86 |
+
$hook === 'edit-comments.php' || $hook === $yasr_settings_page ||
|
87 |
+
$hook === 'yet-another-stars-rating_page_yasr_stats_page'
|
88 |
+
) {
|
89 |
|
90 |
+
do_action('yasr_add_admin_scripts_begin');
|
91 |
|
92 |
+
wp_enqueue_style('yasrcss', YASR_CSS_DIR . 'yasr-admin.css', false, YASR_VERSION_NUM, 'all');
|
93 |
|
94 |
+
wp_enqueue_script('yasradmin', YASR_JS_DIR . 'yasr-admin.js', array('jquery'), YASR_VERSION_NUM, true);
|
95 |
|
96 |
+
wp_enqueue_script('rater', YASR_JS_DIR . 'rater-js.js', '', YASR_VERSION_NUM, true);
|
97 |
|
98 |
+
wp_enqueue_script('yasr_shortcode_creator', YASR_JS_DIR . 'yasr-shortcode-creator.js', array('jquery'), YASR_VERSION_NUM, true);
|
99 |
|
100 |
+
do_action('yasr_add_admin_scripts_end', $hook);
|
101 |
|
102 |
+
$yasr_loader = YASR_IMG_DIR . 'loader.gif';
|
103 |
|
104 |
+
wp_localize_script(
|
105 |
+
'yasradmin', 'yasrCommonDataAdmin',
|
106 |
+
array(
|
107 |
+
'loaderHtml' => $yasr_loader
|
108 |
+
)
|
109 |
+
);
|
110 |
|
111 |
+
}
|
112 |
|
113 |
|
114 |
+
}
|
115 |
|
116 |
/*** Css rules for stars set, from version 1.2.7
|
117 |
+
* Here I use add_action instead of directly use wp_add_inline_style so I can
|
118 |
+
* use remove_action if needed (e.g. Yasr Stylish)
|
119 |
+
***/
|
120 |
|
121 |
+
add_action('yasr_add_front_script_css', 'yasr_css_stars_set');
|
122 |
+
add_action('yasr_add_admin_scripts_end', 'yasr_css_stars_set');
|
123 |
|
124 |
function yasr_css_stars_set() {
|
125 |
|
126 |
+
//if star selected is "rater", select the images
|
127 |
+
if (YASR_STARS_SET === 'rater') {
|
128 |
+
$star_grey = YASR_IMG_DIR . 'star_0.svg';
|
129 |
+
$star_yellow = YASR_IMG_DIR . 'star_1.svg';
|
130 |
+
} elseif (YASR_STARS_SET === 'rater-oxy') {
|
131 |
+
$star_grey = YASR_IMG_DIR . 'star_oxy_0.svg';
|
132 |
+
$star_yellow = YASR_IMG_DIR . 'star_oxy_1.svg';
|
133 |
+
} //by default, use the one provided by Yasr
|
134 |
+
else {
|
135 |
+
$star_grey = YASR_IMG_DIR . 'star_2.svg';
|
136 |
+
$star_yellow = YASR_IMG_DIR . 'star_3.svg';
|
137 |
}
|
138 |
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
+
$yasr_st_css = "
|
141 |
+
.star-rating {
|
|
|
142 |
background-image: url(\"$star_grey\");
|
143 |
}
|
144 |
.star-rating .star-value {
|
145 |
background: url(\"$star_yellow\") ;
|
146 |
}
|
147 |
+
";
|
148 |
|
149 |
+
wp_add_inline_style('yasrcss', $yasr_st_css);
|
150 |
|
151 |
}
|
152 |
|
153 |
+
add_action('yasr_add_front_script_css', 'yasr_rtl_support');
|
154 |
+
add_action('yasr_add_admin_scripts_end', 'yasr_rtl_support');
|
155 |
|
156 |
+
function yasr_rtl_support() {
|
157 |
|
158 |
if (is_rtl()) {
|
|
|
159 |
$yasr_rtl_css = '.star-rating .star-value {
|
160 |
-moz-transform: scaleX(-1);
|
161 |
-o-transform: scaleX(-1);
|
168 |
left: auto;
|
169 |
}';
|
170 |
|
171 |
+
wp_add_inline_style('yasrcss', $yasr_rtl_css);
|
172 |
|
173 |
}
|
174 |
|
177 |
|
178 |
/****** Translating YASR ******/
|
179 |
|
180 |
+
add_action('init', 'yasr_translate_option', 110);
|
181 |
|
182 |
+
function yasr_translate_option() {
|
183 |
+
load_plugin_textdomain('yet-another-stars-rating', false, YASR_LANG_DIR);
|
184 |
+
}
|
185 |
|
186 |
|
187 |
/****** Create a new Page in Administration Menu ******/
|
188 |
|
189 |
+
/* Hook to admin_menu the yasr_add_pages function above */
|
190 |
+
add_action('admin_menu', 'yasr_add_pages');
|
|
|
|
|
191 |
|
192 |
+
function yasr_add_pages() {
|
193 |
|
194 |
+
global $yasr_settings_page;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
|
196 |
+
//Add Settings Page
|
197 |
+
$yasr_settings_page = add_menu_page(
|
198 |
+
__('Yet Another Stars Rating: settings', 'yet-another-stars-rating'), //Page Title
|
199 |
+
__('Yet Another Stars Rating', 'yet-another-stars-rating'), //Menu Title
|
200 |
+
'manage_options', //capability
|
201 |
+
'yasr_settings_page', //menu slug
|
202 |
+
'yasr_settings_page_callback', //The function to be called to output the content for this page.
|
203 |
+
'dashicons-star-half'
|
204 |
+
);
|
205 |
|
206 |
+
add_submenu_page(
|
207 |
+
'yasr_settings_page',
|
208 |
+
'Yet Another Stars Rating: settings',
|
209 |
+
'Settings',
|
210 |
+
'manage_options',
|
211 |
+
'yasr_settings_page'
|
212 |
+
);
|
213 |
|
214 |
+
add_submenu_page(
|
215 |
+
'yasr_settings_page',
|
216 |
+
'Yet Another Stars Rating: All Rating',
|
217 |
+
'Logs',
|
218 |
+
'manage_options',
|
219 |
+
'yasr_stats_page',
|
220 |
+
'yasr_stats_page_callback'
|
221 |
+
);
|
222 |
|
223 |
+
if (yasr_fs()->is_free_plan()) {
|
224 |
+
global $submenu;
|
225 |
+
$permalink = '#';
|
226 |
+
$contact_us_string = sprintf(
|
227 |
+
__('Contact Us %s', 'yet-another-stars-rating'),
|
228 |
+
'<span class="dashicons dashicons-lock" />'
|
229 |
+
);
|
230 |
+
$submenu['yasr_settings_page'][] = array($contact_us_string, 'manage_options', $permalink);
|
231 |
+
}
|
232 |
|
233 |
+
}
|
|
|
|
|
234 |
|
235 |
+
// Settings Page Content
|
236 |
+
function yasr_settings_page_callback() {
|
237 |
|
238 |
+
if (!current_user_can('manage_options')) {
|
239 |
+
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
240 |
}
|
241 |
|
242 |
+
include(YASR_ABSOLUTE_PATH . '/yasr-settings-page.php');
|
243 |
|
244 |
+
} //End yasr_settings_page_content
|
|
|
|
|
|
|
|
|
245 |
|
|
|
246 |
|
247 |
+
function yasr_stats_page_callback() {
|
248 |
|
249 |
+
if (!current_user_can('manage_options')) {
|
250 |
+
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
251 |
+
}
|
252 |
|
253 |
+
include(YASR_ABSOLUTE_PATH . '/yasr-stats-page.php');
|
254 |
|
255 |
+
}
|
|
|
256 |
|
|
|
257 |
|
258 |
+
/****** Auto insert overall rating and visitor rating ******/
|
259 |
|
260 |
+
if (YASR_AUTO_INSERT_ENABLED == 1) {
|
261 |
|
262 |
+
if (!is_admin()) {
|
263 |
+
add_filter('the_content', 'yasr_auto_insert_shortcode_callback');
|
264 |
+
}
|
265 |
|
266 |
+
function yasr_auto_insert_shortcode_callback($content) {
|
267 |
|
268 |
+
$post_id = get_the_ID();
|
269 |
|
270 |
+
//check if for this post or page auto insert is off
|
271 |
+
$post_excluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', true);
|
|
|
|
|
|
|
272 |
|
273 |
+
if ($post_excluded === 'yes') {
|
274 |
+
return $content;
|
275 |
+
}
|
|
|
|
|
276 |
|
277 |
+
$auto_insert_shortcode = null; //To avoid undefined variable notice outside the loop (if (is_singular) )
|
278 |
+
|
279 |
+
$overall_rating_code = '[yasr_overall_rating size="' . YASR_AUTO_INSERT_SIZE . '"]';
|
280 |
+
|
281 |
+
$visitor_votes_code = '[yasr_visitor_votes size="' . YASR_AUTO_INSERT_SIZE . '"]';
|
282 |
+
|
283 |
+
if (YASR_AUTO_INSERT_WHAT === 'overall_rating') {
|
284 |
+
switch (YASR_AUTO_INSERT_WHERE) {
|
285 |
+
case 'top':
|
286 |
+
$content_and_stars = $overall_rating_code . $content;
|
287 |
+
break;
|
288 |
+
|
289 |
+
case 'bottom':
|
290 |
+
$content_and_stars = $content . $overall_rating_code;
|
291 |
+
break;
|
292 |
+
} //End Switch
|
293 |
+
} elseif (YASR_AUTO_INSERT_WHAT === 'visitor_rating') {
|
294 |
+
switch (YASR_AUTO_INSERT_WHERE) {
|
295 |
+
case 'top':
|
296 |
+
$content_and_stars = $visitor_votes_code . $content;
|
297 |
+
break;
|
298 |
+
|
299 |
+
case 'bottom':
|
300 |
+
$content_and_stars = $content . $visitor_votes_code;
|
301 |
+
break;
|
302 |
+
} //End Switch
|
303 |
+
} elseif (YASR_AUTO_INSERT_WHAT === 'both') {
|
304 |
+
switch (YASR_AUTO_INSERT_WHERE) {
|
305 |
+
case 'top':
|
306 |
+
$content_and_stars = $overall_rating_code . $visitor_votes_code . $content;
|
307 |
+
break;
|
308 |
+
|
309 |
+
case 'bottom':
|
310 |
+
$content_and_stars = $content . $overall_rating_code . $visitor_votes_code;
|
311 |
+
break;
|
312 |
+
} //End Switch
|
313 |
+
}
|
314 |
|
315 |
+
//IF auto insert must work only in custom post type
|
316 |
+
if (YASR_AUTO_INSERT_CUSTOM_POST_ONLY === 'yes') {
|
|
|
|
|
|
|
317 |
|
318 |
+
$custom_post_types = yasr_get_custom_post_type();
|
|
|
|
|
|
|
|
|
319 |
|
320 |
+
//If is a post type return content and stars
|
321 |
+
if (is_singular($custom_post_types)) {
|
322 |
+
return $content_and_stars;
|
323 |
+
} //else return just content
|
324 |
+
else {
|
325 |
+
return $content;
|
326 |
}
|
327 |
|
328 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
|
330 |
+
//If page are not excluded
|
331 |
+
if (YASR_AUTO_INSERT_EXCLUDE_PAGES === 'no') {
|
332 |
+
return $content_and_stars;
|
333 |
+
} //else return only if it is not a page
|
334 |
+
elseif (YASR_AUTO_INSERT_EXCLUDE_PAGES === 'yes') {
|
335 |
+
if (!is_page()) {
|
336 |
return $content_and_stars;
|
337 |
+
} //If is a page return the content without stars
|
338 |
+
else {
|
339 |
+
return $content;
|
340 |
}
|
341 |
+
}
|
342 |
|
343 |
+
} //End function yasr_auto_insert_shortcode_callback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
|
345 |
+
} //End if (YASR_AUTO_INSERT_ENABLED
|
346 |
|
347 |
|
348 |
/****** Add review schema data at the end of the post *******/
|
350 |
|
351 |
add_filter('the_content', 'yasr_add_schema');
|
352 |
|
353 |
+
function yasr_add_schema($content) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
|
355 |
+
//Add buddypress compatibility
|
356 |
+
if (function_exists('bp_is_active')) {
|
357 |
+
//Return content only if is page. This will disable schema for all page.
|
358 |
+
//If I try to return $content after if (YASR_SNIPPET == 'overall_rating')
|
359 |
+
//or (YASR_SNIPPET == 'visitor_rating') $content will have only wp content, losing the buddypress one
|
360 |
+
if (is_page()) {
|
361 |
return $content;
|
362 |
}
|
363 |
+
}
|
364 |
|
365 |
+
if (!is_singular() && is_main_query() || is_404()) {
|
366 |
+
return $content;
|
367 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
+
$script_type = '<script type="application/ld+json">';
|
370 |
+
$end_script_type = '</script>';
|
371 |
|
372 |
+
$review_choosen = yasr_get_snippet_type();
|
373 |
|
374 |
+
//if doesn't exists a filter for yasr_filter_schema_jsonld $review_chosen value is assigned to $filtered_schema...
|
375 |
+
$filtered_schema = apply_filters('yasr_filter_schema_jsonld', $review_choosen);
|
|
|
376 |
|
377 |
+
//So check here if $schema != $review_choosen
|
378 |
+
if ($filtered_schema !== $review_choosen) {
|
379 |
+
return $content . $script_type . $filtered_schema . $end_script_type;
|
380 |
+
}
|
381 |
|
382 |
+
$rich_snippet["@context"] = "http://schema.org/";
|
|
|
383 |
|
|
|
384 |
|
385 |
+
$author = get_the_author();
|
386 |
+
$review_name = get_the_title();
|
387 |
|
388 |
+
$date = get_the_date('c');
|
389 |
+
$date_modified = get_the_modified_date('c');
|
390 |
|
391 |
+
$post_image_url = ''; //avoid undefined
|
392 |
+
$logo_image_url = ''; //avoid undefined
|
393 |
|
394 |
+
if (defined('YASR_BLOGPOSTING_ORGANIZATION_LOGO')) {
|
395 |
+
$logo_image_url = YASR_BLOGPOSTING_ORGANIZATION_LOGO;
|
396 |
+
$post_image_url = $logo_image_url; //this will be overwritten if has_post_thumbnail is true
|
397 |
|
398 |
+
$logo_image_url_absolute = $_SERVER['DOCUMENT_ROOT'] . parse_url(YASR_BLOGPOSTING_ORGANIZATION_LOGO, PHP_URL_PATH);
|
399 |
|
400 |
+
$post_image_size = @getimagesize($logo_image_url_absolute); //the @ should be useless, just to be safe
|
401 |
|
402 |
+
$logo_image_size = @getimagesize($logo_image_url_absolute); //the @ should be useless, just to be safe
|
403 |
|
404 |
+
} else {
|
405 |
+
$post_image_size[0] = 0;
|
406 |
+
$post_image_size[1] = 0;
|
407 |
|
408 |
+
$logo_image_size[0] = 0;
|
409 |
+
$logo_image_size[1] = 0;
|
410 |
+
}
|
411 |
|
412 |
+
//if exists featuread image get the url and overwrite the variable
|
413 |
+
if (has_post_thumbnail()) {
|
414 |
+
$post_image_url = wp_get_attachment_url(get_post_thumbnail_id());
|
415 |
+
$post_image_url_absolute = $_SERVER['DOCUMENT_ROOT'] . parse_url($post_image_url, PHP_URL_PATH);
|
416 |
+
$post_image_size = @getimagesize($post_image_url_absolute); //the @ should be useless, just to be safe
|
417 |
+
}
|
418 |
|
|
|
419 |
|
420 |
+
if ($review_choosen === "Product") {
|
421 |
|
422 |
+
$rich_snippet["@type"] = "Product";
|
423 |
|
424 |
+
} elseif ($review_choosen === "Recipe") {
|
425 |
|
426 |
+
$rich_snippet["@type"] = "Recipe";
|
427 |
|
428 |
+
$rich_snippet["image"] = array(
|
429 |
+
"@type" => "ImageObject",
|
430 |
+
"url" => $post_image_url,
|
431 |
+
"width" => $post_image_size[0],
|
432 |
+
"height" => $post_image_size[1]
|
433 |
+
);
|
434 |
|
435 |
+
} elseif ($review_choosen == "Place") {
|
436 |
|
437 |
+
$rich_snippet["@type"] = "LocalBusiness";
|
438 |
|
439 |
+
} elseif ($review_choosen == "Other") {
|
|
|
|
|
|
|
440 |
|
441 |
+
$rich_snippet["@type"] = "BlogPosting";
|
442 |
|
443 |
+
$rich_snippet["datePublished"] = $date;
|
|
|
|
|
|
|
444 |
|
445 |
+
$rich_snippet["headline"] = $review_name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
|
447 |
+
$rich_snippet["mainEntityOfPage"] = array(
|
448 |
+
"@type" => "WebPage",
|
449 |
+
"@id" => get_permalink()
|
450 |
+
);
|
451 |
|
|
|
452 |
|
453 |
+
$rich_snippet["author"] = array(
|
454 |
+
"@type" => "Person",
|
455 |
+
"name" => "$author"
|
456 |
+
);
|
|
|
|
|
457 |
|
458 |
+
$rich_snippet["publisher"] = array(
|
459 |
+
"@type" => "Organization",
|
460 |
+
"name" => YASR_BLOGPOSTING_ORGANIZATION_NAME,
|
461 |
+
"logo" => array(
|
462 |
+
"@type" => "ImageObject",
|
463 |
+
"url" => $logo_image_url,
|
464 |
+
"width" => $logo_image_size[0],
|
465 |
+
"height" => $logo_image_size[1]
|
466 |
+
)
|
467 |
|
468 |
+
);
|
469 |
|
470 |
+
$rich_snippet["dateModified"] = $date_modified;
|
471 |
|
472 |
+
$rich_snippet["image"] = array(
|
473 |
+
"@type" => "ImageObject",
|
474 |
+
"url" => $post_image_url,
|
475 |
+
"width" => $post_image_size[0],
|
476 |
+
"height" => $post_image_size[1]
|
477 |
+
);
|
478 |
|
479 |
+
}
|
480 |
|
481 |
+
if (YASR_SNIPPET == 'overall_rating') {
|
|
|
482 |
|
483 |
+
$overall_rating = yasr_get_overall_rating(false, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
|
485 |
+
if ($overall_rating && $overall_rating != '-1' && $overall_rating != '0.0') {
|
486 |
|
487 |
+
global $post;
|
488 |
|
489 |
+
//name
|
490 |
+
$rich_snippet["name"] = $review_name;
|
491 |
|
492 |
+
$rich_snippet["Review"] = array(
|
493 |
+
"@type" => "Review",
|
494 |
+
"name" => "$review_name",
|
495 |
+
"author" => array(
|
496 |
+
"@type" => "Person",
|
497 |
+
"name" => "$author"
|
498 |
+
),
|
499 |
+
"datePublished" => "$date",
|
500 |
+
"reviewRating" => array(
|
501 |
+
"@type" => "Rating",
|
502 |
+
"ratingValue" => "$overall_rating",
|
503 |
+
),
|
504 |
+
);
|
505 |
|
506 |
+
} //END id if $overall_rating != '-1'
|
507 |
|
508 |
+
else {
|
509 |
|
510 |
+
return $content;
|
511 |
|
512 |
+
}
|
513 |
|
514 |
+
} //end if ($choosen_snippet['snippet'] == 'overall_rating')
|
|
|
|
|
|
|
515 |
|
516 |
+
if (YASR_SNIPPET == 'visitor_rating') {
|
517 |
|
518 |
+
$visitor_votes = yasr_get_visitor_votes(false, false);
|
519 |
|
520 |
+
if ($visitor_votes) {
|
521 |
|
522 |
+
foreach ($visitor_votes as $rating) {
|
523 |
+
$visitor_rating['votes_number'] = $rating->number_of_votes;
|
524 |
+
$visitor_rating['sum'] = $rating->sum_votes;
|
525 |
}
|
526 |
|
527 |
+
} else {
|
528 |
|
529 |
+
return $content;
|
530 |
|
531 |
+
}
|
532 |
|
533 |
+
if ($visitor_rating['sum'] != 0 && $visitor_rating['votes_number'] != 0) {
|
|
|
534 |
|
535 |
+
$average_rating = $visitor_rating['sum'] / $visitor_rating['votes_number'];
|
|
|
|
|
|
|
|
|
536 |
|
537 |
+
$average_rating = round($average_rating, 1);
|
538 |
|
539 |
+
//name
|
540 |
+
$rich_snippet["name"] = $review_name;
|
541 |
|
542 |
+
$rich_snippet["aggregateRating"] = array(
|
543 |
+
"@type" => "AggregateRating",
|
544 |
+
"ratingValue" => "$average_rating",
|
545 |
+
"ratingCount" => $visitor_rating['votes_number'],
|
546 |
+
);
|
547 |
|
548 |
+
} else {
|
549 |
|
550 |
+
return $content;
|
551 |
|
|
|
|
|
552 |
}
|
553 |
|
554 |
+
}
|
|
|
|
|
555 |
|
556 |
+
if (is_singular() && is_main_query() && !is_404()) {
|
557 |
+
return $content . $script_type . json_encode($rich_snippet) . $end_script_type;
|
558 |
+
} else {
|
559 |
+
return $content;
|
560 |
+
}
|
561 |
|
562 |
|
563 |
+
} //End function
|
564 |
|
565 |
|
566 |
/****** Create a select menu to choose the rich snippet itemtype ******/
|
567 |
|
568 |
+
function yasr_select_itemtype() {
|
569 |
+
|
570 |
+
$i18n_array_review = __('Product, Place, Recipe, BlogPosting', 'yet-another-stars-rating');
|
571 |
+
$array_review_type = explode(',', $i18n_array_review);
|
572 |
+
$review_type = array_map('trim', $array_review_type);
|
573 |
+
$review_type_choosen = yasr_get_snippet_type();
|
574 |
+
|
575 |
+
switch ( $review_type_choosen ) {
|
576 |
+
case 'Product':
|
577 |
+
$review_type_choosen = 1;
|
578 |
+
break;
|
579 |
+
case 'Place':
|
580 |
+
$review_type_choosen = 2;
|
581 |
+
break;
|
582 |
+
case 'Recipe':
|
583 |
+
$review_type_choosen = 3;
|
584 |
+
break;
|
585 |
+
case 'Other':
|
586 |
+
$review_type_choosen = 4;
|
587 |
+
break;
|
588 |
+
}
|
|
|
|
|
589 |
|
590 |
+
?>
|
591 |
|
592 |
+
<select name="yasr-review-type" id="yasr-choose-reviews-types-list">
|
593 |
|
594 |
+
<?php
|
595 |
|
596 |
+
$i = 1;
|
597 |
|
598 |
+
foreach ($review_type as $type) {
|
|
|
|
|
599 |
|
600 |
+
if ($i === $review_type_choosen) {
|
601 |
+
echo "<option value=\"$i\" selected>$type</option>";
|
602 |
+
} else {
|
603 |
+
echo "<option value=\"$i\">$type</option>";
|
604 |
+
}
|
605 |
|
606 |
+
$i = $i + 1;
|
607 |
|
608 |
+
}
|
609 |
|
610 |
|
611 |
+
?>
|
612 |
|
613 |
+
</select>
|
614 |
|
615 |
+
<?php
|
616 |
|
617 |
+
} //End function yasr_select_itemtype()
|
618 |
|
619 |
|
620 |
/******* Add a media content button ******/
|
621 |
|
622 |
add_action('media_buttons', 'yasr_shortcode_button_media', 99);
|
623 |
|
624 |
+
function yasr_shortcode_button_media() {
|
625 |
|
626 |
+
if (is_admin()) {
|
627 |
|
628 |
+
add_thickbox();
|
629 |
|
630 |
+
echo '<a href="#TB_inline?width=530&height=600&inlineId=yasr-tinypopup-form" id="yasr-shortcode-creator" class="button thickbox"><span class="dashicons dashicons-star-half" style="vertical-align: midlle;"></span> Yasr Shortcode</a>';
|
631 |
|
632 |
+
}
|
|
|
|
|
633 |
|
634 |
+
}
|
635 |
|
636 |
|
637 |
/****** Return the custom post type if exists
|
638 |
+
* Argument is to set what to return, if array or boolean value.
|
639 |
+
* Default: array******/
|
640 |
|
641 |
add_action('admin_init', 'yasr_get_custom_post_type');
|
642 |
|
646 |
'yet-another-stars-rating/v1/',
|
647 |
'/list-posts-types',
|
648 |
array(
|
649 |
+
'methods' => 'GET',
|
650 |
'callback' => 'yasr_get_custom_post_type',
|
651 |
)
|
652 |
);
|
653 |
});
|
654 |
|
655 |
+
function yasr_get_custom_post_type($return_value = 'array') {
|
656 |
|
657 |
//if this is a rest request $return_value is an object called WP_REST_Request
|
658 |
//overwrite content to 'array'
|
667 |
'_builtin' => false
|
668 |
);
|
669 |
|
670 |
+
$output = 'names'; // names or objects, note names is the default
|
671 |
$operator = 'and'; // 'and' or 'or'
|
672 |
|
673 |
$post_types = get_post_types($args, $output, $operator);
|
687 |
|
688 |
|
689 |
/*** function that get the star size and return it***/
|
690 |
+
function yasr_stars_size($size) {
|
691 |
|
692 |
$size = sanitize_text_field($size);
|
693 |
|
695 |
|
696 |
if ($size === 'small') {
|
697 |
$stars_attribute['px_size'] = '16';
|
698 |
+
} elseif ($size === 'medium') {
|
|
|
|
|
699 |
$stars_attribute['px_size'] = '24';
|
700 |
+
} //default values
|
|
|
|
|
701 |
else {
|
702 |
$stars_attribute['px_size'] = '32';
|
703 |
}
|
707 |
}
|
708 |
|
709 |
|
|
|
710 |
/*** Add support for wp super cache ***/
|
711 |
function yasr_wp_super_cache_support($post_id) {
|
712 |
+
if (function_exists('wp_cache_post_change')) {
|
713 |
wp_cache_post_change($post_id);
|
714 |
}
|
715 |
}
|
716 |
|
717 |
/*** Add support for wp rocket, thanks to GeekPress
|
718 |
+
* https://wordpress.org/support/topic/compatibility-with-wp-rocket-2
|
719 |
+
***/
|
720 |
function yasr_wp_rocket_support($post_id) {
|
721 |
+
if (function_exists('rocket_clean_post')) {
|
722 |
rocket_clean_post($post_id);
|
723 |
}
|
724 |
}
|
725 |
|
726 |
+
/*** Add support for LiteSpeed Cache plugin, thanks to Pako69
|
727 |
+
* https://wordpress.org/support/topic/yasr-is-litespeed-cache-plugin-compatible/
|
728 |
+
***/
|
729 |
function yasr_litespeed_cache_support($post_id) {
|
730 |
+
if (method_exists('LiteSpeed_Cache_API', 'purge_post') == true) {
|
731 |
+
LiteSpeed_Cache_API::purge_post($post_id);
|
732 |
}
|
733 |
}
|
734 |
|
735 |
/*** Add support for cache enabler ***/
|
736 |
function yasr_cache_enabler_support($post_id, $is_singular) {
|
737 |
|
738 |
+
if (has_action('ce_clear_cache') || has_action('ce_clear_post_cache')) {
|
|
|
739 |
//IF is in the single post or page delete only that cache
|
740 |
if ($is_singular === 'true') {
|
741 |
do_action('ce_clear_post_cache', $post_id);
|
742 |
+
} //otherwise, delete everything
|
|
|
|
|
743 |
else {
|
744 |
do_action('ce_clear_cache');
|
745 |
}
|
753 |
function yasr_wp_fastest_cache($post_id, $is_singular) {
|
754 |
|
755 |
if ($is_singular === 'true') {
|
|
|
756 |
if (isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'singleDeleteCache')) {
|
757 |
$GLOBALS['wp_fastest_cache']->singleDeleteCache(false, $post_id);
|
758 |
}
|
759 |
+
} else {
|
760 |
+
if (isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')) {
|
|
|
|
|
|
|
761 |
$GLOBALS['wp_fastest_cache']->deleteCache();
|
762 |
}
|
|
|
763 |
}
|
764 |
|
765 |
|
766 |
}
|
767 |
|
768 |
/*** Function to set cookie, since version 0.8.3 ***/
|
769 |
+
function yasr_setcookie($cookiename, $data_to_save) {
|
770 |
|
771 |
+
if (!$data_to_save || !$cookiename) {
|
772 |
+
exit('Error setting yasr cookie');
|
773 |
+
}
|
774 |
|
775 |
+
$existing_data = array(); //avoid undefined index
|
776 |
|
777 |
+
if (isset($_COOKIE[$cookiename])) {
|
778 |
|
779 |
+
//setcookie add \ , so I need to stripslahes
|
780 |
+
$existing_data = stripslashes($_COOKIE[$cookiename]);
|
781 |
|
782 |
+
//By default, json_decode return an object, TRUE to return an array
|
783 |
+
$existing_data = json_decode($existing_data, true);
|
784 |
|
785 |
+
}
|
786 |
|
787 |
+
//whetever exists or not, push into at the end of array
|
788 |
+
$existing_data[] = $data_to_save;
|
789 |
|
790 |
+
$encoded_data = json_encode($existing_data);
|
791 |
|
792 |
+
setcookie($cookiename, $encoded_data, time() + 31536000, COOKIEPATH, COOKIE_DOMAIN);
|
793 |
|
794 |
+
}
|
795 |
|
796 |
/*** Function to get ip, since version 0.8.8
|
797 |
+
* This code can be found on http://codex.wordpress.org/Plugin_API/Filter_Reference/pre_comment_user_ip
|
798 |
+
***/
|
799 |
|
800 |
function yasr_get_ip() {
|
801 |
|
802 |
if (YASR_ENABLE_IP === 'yes') {
|
803 |
|
804 |
+
$ip = null;
|
805 |
+
$ip = apply_filters('yasr_filter_ip', $ip);
|
806 |
|
807 |
+
if (isset($ip)) {
|
808 |
+
return $ip;
|
809 |
+
}
|
810 |
|
811 |
|
812 |
+
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
|
813 |
|
814 |
+
if (!empty($_SERVER['X_FORWARDED_FOR'])) {
|
815 |
|
816 |
+
$X_FORWARDED_FOR = explode(',', $_SERVER['X_FORWARDED_FOR']);
|
817 |
|
818 |
+
if (!empty($X_FORWARDED_FOR)) {
|
819 |
+
$REMOTE_ADDR = trim($X_FORWARDED_FOR[0]);
|
820 |
+
}
|
821 |
|
822 |
+
} /*
|
823 |
* Some php environments will use the $_SERVER['HTTP_X_FORWARDED_FOR']
|
824 |
* variable to capture visitor address information.
|
825 |
*/
|
826 |
|
827 |
+
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
828 |
|
829 |
+
$HTTP_X_FORWARDED_FOR = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
830 |
|
831 |
+
if (!empty($HTTP_X_FORWARDED_FOR)) {
|
832 |
+
$REMOTE_ADDR = trim($HTTP_X_FORWARDED_FOR[0]);
|
833 |
+
}
|
|
|
|
|
834 |
|
835 |
+
}
|
836 |
|
837 |
+
return preg_replace('/[^0-9a-f:\., ]/si', '', $REMOTE_ADDR);
|
838 |
|
839 |
+
} else {
|
840 |
return ('X.X.X.X');
|
841 |
}
|
842 |
|
843 |
|
|
|
844 |
}
|
845 |
|
846 |
|
|
|
|
|
847 |
/*function to remove duplicate in an array for a specific key
|
848 |
Taken value: array to search, key
|
849 |
*/
|
850 |
|
851 |
function yasr_unique_multidim_array($array, $key) {
|
852 |
|
853 |
+
$temp_array = array();
|
854 |
+
$i = 0;
|
855 |
|
856 |
+
//creo un array vuoto che conterrà solo gli indici
|
857 |
+
$key_array = array();
|
858 |
|
859 |
+
foreach ($array as $val) {
|
860 |
|
861 |
+
$result_search_array = array_search($val[$key], $key_array);
|
862 |
|
863 |
+
$key_array[$i] = $val[$key];
|
864 |
+
$temp_array[$i] = $val;
|
865 |
|
866 |
+
//if result is found
|
867 |
+
if ($result_search_array !== false) {
|
868 |
|
869 |
+
unset($key_array[$result_search_array], $temp_array[$result_search_array]);
|
870 |
|
871 |
+
}
|
872 |
|
873 |
+
$i ++;
|
874 |
|
875 |
+
}
|
876 |
|
877 |
+
sort($temp_array);
|
878 |
|
879 |
+
return $temp_array;
|
880 |
|
881 |
}
|
882 |
|
883 |
|
884 |
//Delete caches for wp_super_Cache and wp_rocket
|
885 |
+
add_action('yasr_action_on_visitor_vote', 'yasr_delete_cache');
|
886 |
add_action('yasr_action_on_visitor_multiset_vote', 'yasr_delete_cache');
|
887 |
|
888 |
function yasr_delete_cache($array_action_visitor_vote) {
|
889 |
|
890 |
+
if (isset($array_action_visitor_vote['post_id'])) {
|
891 |
$post_id = $array_action_visitor_vote['post_id'];
|
892 |
+
} else {
|
|
|
893 |
return;
|
894 |
}
|
895 |
|
896 |
+
if (isset($array_action_visitor_vote['is_singular'])) {
|
897 |
$is_singular = $array_action_visitor_vote['is_singular'];
|
898 |
+
} else {
|
|
|
899 |
return;
|
900 |
}
|
901 |
|
902 |
+
yasr_wp_super_cache_support($post_id);
|
903 |
+
yasr_wp_rocket_support($post_id);
|
904 |
+
yasr_litespeed_cache_support($post_id);
|
905 |
+
yasr_cache_enabler_support($post_id, $is_singular);
|
906 |
yasr_wp_fastest_cache($post_id, $is_singular);
|
907 |
|
908 |
}
|
909 |
|
910 |
|
911 |
+
function yasr_check_valid_url($url) {
|
912 |
|
913 |
$timeout = 5;
|
914 |
|
915 |
+
//Check if url is valid
|
916 |
+
if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
|
|
|
|
|
|
|
917 |
|
918 |
+
//Check if curl is installed
|
919 |
+
if (function_exists('curl_version')) {
|
|
|
|
|
920 |
|
921 |
+
$ch = curl_init();
|
922 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
923 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
924 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
925 |
|
926 |
+
//execute curl
|
927 |
+
$http_respond = trim(strip_tags(curl_exec($ch)));
|
928 |
+
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
929 |
|
930 |
+
//Check the response
|
931 |
+
if (($http_code == "200") || ($http_code == "302")) {
|
932 |
+
return true;
|
933 |
+
} else {
|
934 |
+
return false;
|
935 |
+
}
|
936 |
+
//close curl
|
937 |
+
curl_close($ch);
|
938 |
|
939 |
+
} //if curl is not installed, use file_get_contents
|
940 |
+
else {
|
941 |
|
942 |
+
//...but only if enabled on the server!
|
943 |
+
if (ini_get('allow_url_fopen')) {
|
944 |
|
945 |
+
//Change timeout for file_get_contents
|
946 |
+
ini_set('default_socket_timeout', $timeout); //5 seconds
|
947 |
|
948 |
+
$headers = get_headers($url, 1);
|
949 |
+
$string_to_check = '200 OK';
|
950 |
|
951 |
+
//check if in the first heade we've 200 OK
|
952 |
+
if (strpos($headers[0], $string_to_check) !== false) {
|
953 |
+
return true;
|
954 |
+
} else {
|
955 |
+
return false;
|
956 |
+
}
|
957 |
+
} //if url_fopen is not enabled
|
958 |
+
else {
|
959 |
+
return false;
|
960 |
+
}
|
961 |
|
962 |
+
}
|
963 |
+
} else {
|
964 |
+
return false;
|
965 |
+
}
|
966 |
|
967 |
+
}
|
|
|
968 |
|
969 |
+
/**
|
970 |
+
* Check if Classic Editor plugin is active.
|
971 |
+
*
|
972 |
+
* @return bool
|
973 |
+
*/
|
974 |
+
function yasr_is_classic_editor_plugin_active() {
|
975 |
+
if (!function_exists( 'is_plugin_active' )) {
|
976 |
+
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
977 |
+
}
|
978 |
|
979 |
+
if (is_plugin_active( 'classic-editor/classic-editor.php' )) {
|
980 |
+
return true;
|
981 |
+
}
|
982 |
+
return false;
|
983 |
}
|
984 |
|
985 |
?>
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
3 |
Tags: ratings, rating, postrating, google rating, 5 star, review, reviews, star rating, vote, votes, blocks
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
-
Tested up to: 5.2
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 1.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!
|
@@ -127,11 +127,9 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
|
|
127 |
|
128 |
The full changelog can be found in the plugin's directory. Recent entries:
|
129 |
|
130 |
-
= 1.9.
|
131 |
-
*
|
132 |
-
*
|
133 |
-
* FIXED: Update transient to show the new average when a rating get deleted from the panel
|
134 |
-
* TWEAKED: Code cleanup
|
135 |
|
136 |
|
137 |
= 1.9.3 =
|
@@ -189,5 +187,6 @@ The full changelog can be found in the plugin's directory. Recent entries:
|
|
189 |
External Libraries: [Rater](https://github.com/fredolss/rater-js)
|
190 |
[tippy](https://atomiks.github.io/tippyjs/)
|
191 |
|
192 |
-
|
193 |
from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
|
|
3 |
Tags: ratings, rating, postrating, google rating, 5 star, review, reviews, star rating, vote, votes, blocks
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
+
Tested up to: 5.2.1
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 1.9.5
|
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!
|
127 |
|
128 |
The full changelog can be found in the plugin's directory. Recent entries:
|
129 |
|
130 |
+
= 1.9.5 =
|
131 |
+
* TWEAKED: settings redesigned
|
132 |
+
* TWEAKED: code cleanup
|
|
|
|
|
133 |
|
134 |
|
135 |
= 1.9.3 =
|
187 |
External Libraries: [Rater](https://github.com/fredolss/rater-js)
|
188 |
[tippy](https://atomiks.github.io/tippyjs/)
|
189 |
|
190 |
+
Flat star icon made by[Freepik](http://www.freepik.com)
|
191 |
from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
|
192 |
+
|
yasr-settings-page.php
CHANGED
@@ -18,96 +18,94 @@ You should have received a copy of the GNU General Public License
|
|
18 |
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
*/
|
20 |
|
21 |
-
if (
|
|
|
|
|
22 |
|
23 |
-
if (
|
24 |
-
|
25 |
}
|
26 |
|
27 |
-
$ajax_nonce_hide_ask_rating = wp_create_nonce(
|
28 |
|
29 |
-
$n_multi_set =
|
30 |
|
31 |
?>
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
$error_new_multi_set=yasr_process_new_multi_set_form(); //defined in yasr-settings-functions
|
40 |
-
|
41 |
-
$error_edit_multi_set=yasr_process_edit_multi_set_form(); //defined in yasr-settings-functions
|
42 |
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
echo "<br />";
|
49 |
-
}
|
50 |
|
51 |
-
|
52 |
-
|
|
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
echo "<br />";
|
60 |
-
}
|
61 |
|
62 |
-
|
63 |
-
|
|
|
|
|
64 |
|
|
|
|
|
65 |
|
66 |
-
if (isset($_GET['tab'])) {
|
67 |
-
$active_tab = $_GET[ 'tab' ];
|
68 |
-
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
|
76 |
|
77 |
-
|
78 |
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
?>
|
95 |
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
|
101 |
|
102 |
-
|
103 |
|
104 |
|
105 |
-
|
106 |
|
107 |
-
|
108 |
|
109 |
-
|
110 |
-
|
111 |
DELETE FROM {$wpdb->options}
|
112 |
WHERE option_name LIKE '_transient_yasr_get_multi_set_values_and_field_%'
|
113 |
OR option_name LIKE '_transient_yasr_visitor_multi_set_%'
|
@@ -115,158 +113,153 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
|
|
115 |
OR option_name LIKE '_transient_timeout_yasr_visitor_multi_set_%'
|
116 |
";
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
$multi_set=yasr_get_multi_set();
|
121 |
-
|
122 |
-
$n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
|
123 |
-
|
124 |
-
?>
|
125 |
|
126 |
-
|
127 |
|
128 |
-
|
129 |
|
130 |
-
|
131 |
|
132 |
-
|
133 |
|
134 |
-
|
135 |
|
136 |
-
|
137 |
-
<?php _e("Multi Set allows you to insert a rate for each aspect about the product / local business / whetever you're reviewing, example in the image below.", 'yet-another-stars-rating');
|
138 |
|
139 |
-
|
|
|
140 |
|
141 |
-
|
142 |
|
143 |
-
|
|
|
144 |
|
145 |
-
|
146 |
|
147 |
-
|
148 |
|
149 |
-
|
150 |
|
151 |
-
|
152 |
|
153 |
-
|
154 |
|
155 |
-
|
156 |
|
157 |
-
|
|
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
</div> <!--yasr-new-multi-set-->
|
162 |
|
163 |
-
|
164 |
|
165 |
-
|
166 |
|
167 |
-
|
168 |
|
169 |
-
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
174 |
|
175 |
-
|
176 |
-
</div>
|
177 |
|
|
|
178 |
|
179 |
-
|
180 |
|
181 |
-
|
182 |
-
<form action="options.php" method="post" id="yasr_multiset_form">
|
183 |
-
<?php
|
184 |
-
settings_fields( 'yasr_multiset_options_group' );
|
185 |
-
do_settings_sections('yasr_multiset_tab' );
|
186 |
-
submit_button( __('Save') );
|
187 |
-
?>
|
188 |
-
</form>
|
189 |
|
190 |
-
|
|
|
191 |
|
192 |
|
193 |
-
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
199 |
|
200 |
-
|
201 |
-
</div>
|
202 |
|
203 |
-
<?php
|
204 |
|
205 |
-
|
206 |
|
|
|
|
|
|
|
207 |
|
208 |
-
|
|
|
209 |
|
210 |
-
|
211 |
|
212 |
-
|
213 |
|
214 |
-
<div class="yasr-settingsdiv">
|
215 |
-
<form action="options.php" method="post" enctype='multipart/form-data' id="yasr_settings_form">
|
216 |
-
<?php
|
217 |
-
settings_fields( 'yasr_style_options_group' );
|
218 |
-
do_settings_sections('yasr_style_tab' );
|
219 |
-
submit_button( __('Save') );
|
220 |
-
?>
|
221 |
-
</form>
|
222 |
-
</div>
|
223 |
|
224 |
-
|
225 |
-
yasr_upgrade_pro_box();
|
226 |
-
yasr_ask_rating ();
|
227 |
-
?>
|
228 |
|
229 |
-
|
230 |
-
</div>
|
231 |
|
232 |
-
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
-
|
|
|
|
|
236 |
|
237 |
-
|
|
|
238 |
|
|
|
239 |
|
240 |
-
do_action( 'yasr_settings_check_active_tab', $active_tab );
|
241 |
|
|
|
242 |
|
243 |
-
|
244 |
-
yasr_ask_rating ("bottom");
|
245 |
|
246 |
-
?>
|
247 |
|
248 |
-
|
249 |
-
</div>
|
250 |
|
251 |
|
252 |
-
|
253 |
|
254 |
-
|
255 |
|
256 |
-
|
|
|
257 |
|
258 |
-
var nMultiSet = <?php echo (json_encode("$n_multi_set")); ?> ;//Null in php is different from javascript NULL
|
259 |
|
260 |
-
|
261 |
|
262 |
-
|
263 |
|
264 |
-
|
|
|
|
|
|
|
|
|
265 |
|
266 |
-
|
267 |
|
268 |
-
|
269 |
|
270 |
-
|
271 |
|
272 |
-
|
18 |
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
*/
|
20 |
|
21 |
+
if (!defined('ABSPATH')) {
|
22 |
+
exit('You\'re not allowed to see this page');
|
23 |
+
} // Exit if accessed directly
|
24 |
|
25 |
+
if (!current_user_can('manage_options')) {
|
26 |
+
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
|
27 |
}
|
28 |
|
29 |
+
$ajax_nonce_hide_ask_rating = wp_create_nonce("yasr_nonce_hide_ask_rating");
|
30 |
|
31 |
+
$n_multi_set = null; //Evoid undefined variable when printed outside multiset tab
|
32 |
|
33 |
?>
|
34 |
|
35 |
+
<div class="wrap">
|
36 |
|
37 |
+
<h2>Yet Another Stars Rating: <?php _e("Settings", 'yet-another-stars-rating'); ?></h2>
|
38 |
|
39 |
+
<?php
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
$error_new_multi_set = yasr_process_new_multi_set_form(); //defined in yasr-settings-functions
|
42 |
+
$error_edit_multi_set = yasr_process_edit_multi_set_form(); //defined in yasr-settings-functions
|
43 |
|
44 |
+
if ($error_new_multi_set) {
|
45 |
+
echo "<div class=\"error\"> <p> <strong>";
|
|
|
|
|
46 |
|
47 |
+
foreach ($error_new_multi_set as $error) {
|
48 |
+
_e($error, 'yet-another-stars-rating');
|
49 |
+
echo "<br />";
|
50 |
+
}
|
51 |
|
52 |
+
echo "</strong></p></div>";
|
53 |
+
}
|
54 |
|
55 |
+
if ($error_edit_multi_set) {
|
56 |
+
echo "<div class=\"error\"> <p> <strong>";
|
|
|
|
|
57 |
|
58 |
+
foreach ($error_edit_multi_set as $error) {
|
59 |
+
_e($error, 'yet-another-stars-rating');
|
60 |
+
echo "<br />";
|
61 |
+
}
|
62 |
|
63 |
+
echo "</strong></p></div>";
|
64 |
+
}
|
65 |
|
|
|
|
|
|
|
66 |
|
67 |
+
if (isset($_GET['tab'])) {
|
68 |
+
$active_tab = $_GET['tab'];
|
69 |
+
} else {
|
70 |
+
$active_tab = 'general_settings';
|
71 |
+
}
|
72 |
|
73 |
+
//Do the settings tab
|
74 |
+
yasr_settings_tabs($active_tab);
|
75 |
|
76 |
+
if ($active_tab == 'general_settings') {
|
77 |
|
78 |
+
?>
|
79 |
|
80 |
+
<div class="yasr-settingsdiv">
|
81 |
+
<form action="options.php" method="post" id="yasr_settings_form">
|
82 |
+
<?php
|
83 |
+
settings_fields('yasr_general_options_group');
|
84 |
+
do_settings_sections('yasr_general_settings_tab');
|
85 |
+
submit_button(__('Save Settings'));
|
86 |
+
?>
|
87 |
+
</form>
|
88 |
+
</div>
|
89 |
|
90 |
+
<?php
|
91 |
+
yasr_right_settings_panel();
|
92 |
+
?>
|
|
|
93 |
|
94 |
+
<div class="yasr-space-settings-div">
|
95 |
+
</div>
|
96 |
|
97 |
+
<?php
|
98 |
|
99 |
|
100 |
+
} //End if tab 'general_settings'
|
101 |
|
102 |
|
103 |
+
if ($active_tab === 'manage_multi') {
|
104 |
|
105 |
+
global $wpdb;
|
106 |
|
107 |
+
//delete all transient that use multiset
|
108 |
+
$sql_delete_transient = "
|
109 |
DELETE FROM {$wpdb->options}
|
110 |
WHERE option_name LIKE '_transient_yasr_get_multi_set_values_and_field_%'
|
111 |
OR option_name LIKE '_transient_yasr_visitor_multi_set_%'
|
113 |
OR option_name LIKE '_transient_timeout_yasr_visitor_multi_set_%'
|
114 |
";
|
115 |
|
116 |
+
$wpdb->query($sql_delete_transient);
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
+
$multi_set = yasr_get_multi_set();
|
119 |
|
120 |
+
$n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
|
121 |
|
122 |
+
?>
|
123 |
|
124 |
+
<div class="yasr-settingsdiv">
|
125 |
|
126 |
+
<h3> <?php _e("Manage Multi Set", 'yet-another-stars-rating'); ?></h3>
|
127 |
|
128 |
+
<p>
|
|
|
129 |
|
130 |
+
<a href="#"
|
131 |
+
id="yasr-multi-set-doc-link"><?php _e("What is a Multi Set?", 'yet-another-stars-rating') ?></a>
|
132 |
|
133 |
+
</p>
|
134 |
|
135 |
+
<div id="yasr-multi-set-doc-box" style="display:none">
|
136 |
+
<?php _e("Multi Set allows you to insert a rate for each aspect about the product / local business / whetever you're reviewing, example in the image below.", 'yet-another-stars-rating');
|
137 |
|
138 |
+
echo "<br /><br /><img src=" . YASR_IMG_DIR . "/yasr-multi-set.png> <br /> <br />";
|
139 |
|
140 |
+
_e("You can create up to 99 different Multi Set and each one can contain up to 9 different fields. Once you've saved it, you can insert the rates while typing your article in the box below the editor, as you can see in this image (click to see it larger)", 'yet-another-stars-rating');
|
141 |
|
142 |
+
echo "<br /><br /><a href=\"" . YASR_IMG_DIR . "yasr-multi-set-insert-rate.jpg\"><img src=" . YASR_IMG_DIR . "/yasr-multi-set-insert-rate-small.jpg></a> <br /> <br />";
|
143 |
|
144 |
+
_e("In order to insert your Multi Sets into a post or page, you can either past the short code that will appear at the bottom of the box or just click on the star in the graphic editor and select \"Insert Multi Set\".", 'yet-another-stars-rating');
|
145 |
|
146 |
+
?>
|
147 |
|
148 |
+
<br/> <br/>
|
149 |
|
150 |
+
<a href="#"
|
151 |
+
id="yasr-multi-set-doc-link-hide"><?php _e("Close this message", 'yet-another-stars-rating') ?></a>
|
152 |
|
153 |
+
</div>
|
|
|
|
|
154 |
|
155 |
+
<div class="yasr-multi-set-left">
|
156 |
|
157 |
+
<div class="yasr-new-multi-set">
|
158 |
|
159 |
+
<?php yasr_display_multi_set_form(); ?>
|
160 |
|
161 |
+
</div> <!--yasr-new-multi-set-->
|
162 |
|
163 |
+
</div> <!--End yasr-multi-set-left-->
|
164 |
|
165 |
+
<div class="yasr-multi-set-right">
|
166 |
|
167 |
+
<?php yasr_edit_multi_form(); ?>
|
|
|
168 |
|
169 |
+
<div id="yasr-multi-set-response" style="display:none">
|
170 |
|
171 |
+
</div>
|
172 |
|
173 |
+
</div> <!--End yasr-multi-set-right-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
+
<div class="yasr-space-settings-div">
|
176 |
+
</div>
|
177 |
|
178 |
|
179 |
+
<div class="yasr-multi-set-choose-theme">
|
180 |
|
181 |
+
<!--This allow to choose color for multiset-->
|
182 |
+
<form action="options.php" method="post" id="yasr_multiset_form">
|
183 |
+
<?php
|
184 |
+
settings_fields('yasr_multiset_options_group');
|
185 |
+
do_settings_sections('yasr_multiset_tab');
|
186 |
+
submit_button(__('Save'));
|
187 |
+
?>
|
188 |
+
</form>
|
189 |
|
190 |
+
</div>
|
|
|
191 |
|
|
|
192 |
|
193 |
+
</div>
|
194 |
|
195 |
+
<?php
|
196 |
+
yasr_right_settings_panel();
|
197 |
+
?>
|
198 |
|
199 |
+
<div class="yasr-space-settings-div">
|
200 |
+
</div>
|
201 |
|
202 |
+
<?php
|
203 |
|
204 |
+
} //End if ($active_tab=='manage_multi')
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
+
if ($active_tab == 'style_options') {
|
|
|
|
|
|
|
208 |
|
209 |
+
?>
|
|
|
210 |
|
211 |
+
<?php do_action('yasr_add_content_top_style_options_tab', $active_tab); ?>
|
212 |
|
213 |
+
<div class="yasr-settingsdiv">
|
214 |
+
<form action="options.php" method="post" enctype='multipart/form-data' id="yasr_settings_form">
|
215 |
+
<?php
|
216 |
+
settings_fields('yasr_style_options_group');
|
217 |
+
do_settings_sections('yasr_style_tab');
|
218 |
+
submit_button(__('Save'));
|
219 |
+
?>
|
220 |
+
</form>
|
221 |
+
</div>
|
222 |
|
223 |
+
<?php
|
224 |
+
yasr_right_settings_panel();
|
225 |
+
?>
|
226 |
|
227 |
+
<div class="yasr-space-settings-div">
|
228 |
+
</div>
|
229 |
|
230 |
+
<?php do_action('yasr_add_content_bottom_style_options_tab', $active_tab); ?>
|
231 |
|
|
|
232 |
|
233 |
+
<?php
|
234 |
|
235 |
+
} //End tab style
|
|
|
236 |
|
|
|
237 |
|
238 |
+
do_action('yasr_settings_check_active_tab', $active_tab);
|
|
|
239 |
|
240 |
|
241 |
+
yasr_right_settings_panel('bottom');
|
242 |
|
243 |
+
?>
|
244 |
|
245 |
+
<!--End div wrap-->
|
246 |
+
</div>
|
247 |
|
|
|
248 |
|
249 |
+
<script type="text/javascript">
|
250 |
|
251 |
+
jQuery(document).ready(function () {
|
252 |
|
253 |
+
var activeTab = <?php echo(json_encode("$active_tab")); ?>;
|
254 |
+
var nMultiSet = <?php echo(json_encode("$n_multi_set")); ?> ;//Null in php is different from javascript NULL
|
255 |
+
var autoInsertEnabled = <?php echo(json_encode(YASR_AUTO_INSERT_ENABLED)); ?>;
|
256 |
+
var textBeforeStars = <?php echo(json_encode(YASR_TEXT_BEFORE_STARS)); ?>;
|
257 |
+
var nonceHideAskRating = <?php echo(json_encode("$ajax_nonce_hide_ask_rating")); ?>
|
258 |
|
259 |
+
YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled, textBeforeStars);
|
260 |
|
261 |
+
YasrAsk5Stars(nonceHideAskRating);
|
262 |
|
263 |
+
}); //End jquery document ready
|
264 |
|
265 |
+
</script>
|
yasr-stats-page.php
CHANGED
@@ -65,10 +65,9 @@ $ajax_nonce_hide_ask_rating = wp_create_nonce("yasr_nonce_hide_ask_rating");
|
|
65 |
</div>
|
66 |
|
67 |
<?php
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
?>
|
73 |
|
74 |
<div class="yasr-space-settings-div">
|
65 |
</div>
|
66 |
|
67 |
<?php
|
68 |
+
yasr_upgrade_pro_box();
|
69 |
+
yasr_resources_box();
|
70 |
+
yasr_ask_rating();
|
|
|
71 |
?>
|
72 |
|
73 |
<div class="yasr-space-settings-div">
|
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: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
|
7 |
-
* Version: 1.9.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
-
define( 'YASR_VERSION_NUM', '1.9.
|
80 |
//Plugin relative path
|
81 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
82 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
@@ -229,7 +229,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
229 |
global $yasr_version_installed ;
|
230 |
global $yasr_stored_options ;
|
231 |
if ( $yasr_version_installed && $yasr_version_installed < '1.7.3' ) {
|
232 |
-
$wpdb->query( "ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name varchar(40) COLLATE 'utf8_unicode_ci' NOT NULL AFTER parent_set_id;" );
|
233 |
}
|
234 |
|
235 |
if ( $yasr_version_installed && $yasr_version_installed < '1.6.5' ) {
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
|
7 |
+
* Version: 1.9.5
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
+
define( 'YASR_VERSION_NUM', '1.9.5' );
|
80 |
//Plugin relative path
|
81 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
82 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
229 |
global $yasr_version_installed ;
|
230 |
global $yasr_stored_options ;
|
231 |
if ( $yasr_version_installed && $yasr_version_installed < '1.7.3' ) {
|
232 |
+
$wpdb->query( "ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name varchar(40) \n COLLATE 'utf8_unicode_ci' NOT NULL AFTER parent_set_id;" );
|
233 |
}
|
234 |
|
235 |
if ( $yasr_version_installed && $yasr_version_installed < '1.6.5' ) {
|