Yasr – Yet Another Stars Rating - Version 1.9.5

Version Description

  • TWEAKED: settings redesigned
  • TWEAKED: code cleanup
Download this release

Release Info

Developer Dudo
Plugin Icon 128x128 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 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; width: 85px;
137
- -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
138
}
139
.yasr-onoffswitch-checkbox {
140
display: none !important;
141
}
142
.yasr-onoffswitch-label {
143
- display: block; overflow: hidden; cursor: pointer;
144
- border: 2px solid #FFFFFF; border-radius: 35px;
145
}
146
.yasr-onoffswitch-inner {
147
- display: block; width: 200%; margin-left: -100%;
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; color: #34A7C1;
168
}
169
.yasr-onoffswitch-inner:after {
170
content: "NO";
171
padding-right: 15px;
172
- background-color: #EEEEEE; color: #999999;
173
text-align: right;
174
}
175
.yasr-onoffswitch-switch {
176
display: block;
177
width: 30px;
178
margin: 0px;
179
background: #A1A1A1;
180
- position: absolute; top: 0; bottom: 0;
181
right: 51px;
182
- border: 2px solid #FFFFFF; border-radius: 35px;
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; color: #34A7C1;
199
}
200
.yasr-onoffswitch-onoff-inner:after {
201
content: "OFF";
202
padding-right: 9px;
203
- background-color: #EEEEEE; color: #999999;
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; color: #34A7C1;
212
}
213
.yasr-onoffswitch-notext-inner:after {
214
content: "";
215
padding-right: 15px;
216
- background-color: #EEEEEE; color: #999999;
217
text-align: right;
218
}
219
220
-
221
/*** End on of switch ***/
222
223
-
224
@media (min-width: 1177px) {
225
226
.yasr-settingsdiv {
227
- float:left;
228
- display:block;
229
- width:60%;
230
- background-color:#FFF;
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:#FFF;
244
border: 1px solid #DDD;
245
- padding: 25px;
246
- font-size: 12px;
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:#FFF;
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:#FFF;
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
- .yasr_table_multi_set_admin td {
460
- width: 50%
461
- }
462
463
.yasr_table_multi_set_admin tr:nth-child(odd) {
464
- background: #feffd3;
465
- }
466
- /* Define the background color for all the EVEN background rows */
467
.yasr_table_multi_set_admin tr:nth-child(even) {
468
- background: #FFFFFF;
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(postid, overallRating) {
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 (setId, postid, nonceMulti, nMultiSet) {
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 (postid, setId, nonceMulti);
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 (postid, setId, nonceMulti) {
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
- function YasrSettingsPage (activeTab, nMultiSet, autoInsertEnabled, textBeforeStars) {
215
-
216
- //-------------------General Settings Code---------------------
217
218
- if (activeTab === 'general_settings') {
219
220
- if (autoInsertEnabled == 0) {
221
- jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
222
- }
223
224
- //First Div, for auto insert
225
- jQuery('#yasr_auto_insert_switch').change(function() {
226
- if (jQuery(this).is(':checked')) {
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
- //for text before stars
235
- if(textBeforeStars == 0) {
236
- jQuery('.yasr-general-options-text-before').prop('disabled', true);
237
}
238
239
- jQuery('#yasr-general-options-text-before-stars-switch').change(function() {
240
- if (jQuery(this).is(':checked')) {
241
242
- jQuery('.yasr-general-options-text-before').prop('disabled', false);
243
- jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
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
- else {
252
- jQuery('.yasr-general-options-text-before').prop('disabled', true);
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
- jQuery('#yasr_text_before_star_on').on('click', function(){
263
264
- jQuery('.yasr-general-options-text-before').prop('disabled', false);
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
- jQuery('#yasr-doc-custom-text-link').on('click', function() {
273
- jQuery('#yasr-doc-custom-text-div').toggle('slow');
274
- return false;
275
- });
276
277
- jQuery('#yasr-snippet-explained-link').on('click', function () {
278
- jQuery('#yasr-snippet-explained').toggle('slow');
279
- return false; // prevent default click action from happening!
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
- //On change show or hide the additional fields
290
- jQuery('#yasr-choose-snippet-type input[type=radio]').change(function(){
291
- var snippet_type = jQuery(this).val();
292
293
- if (snippet_type === 'Other') {
294
295
- jQuery('#yasr-blogPosting-additional-info').show();
296
- jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', false);
297
298
- }
299
300
- else {
301
- jQuery('.yasr-blogPosting-additional-info-inputs').prop('disabled', true);
302
- jQuery('#yasr-blogPosting-additional-info').hide();
303
304
- }
305
306
- return false;
307
308
- });*/
309
310
- } //End if general settings
311
312
- //--------------Multi Sets Page ------------------
313
314
- if (activeTab === 'manage_multi') {
315
316
- jQuery('#yasr-multi-set-doc-link').on('click', function() {
317
- jQuery('#yasr-multi-set-doc-box').toggle("slow");
318
- });
319
320
- jQuery('#yasr-multi-set-doc-link-hide').on('click', function() {
321
- jQuery('#yasr-multi-set-doc-box').toggle("slow");
322
- });
323
324
- if (nMultiSet == 1) {
325
326
- var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
327
328
- counter++;
329
330
- jQuery("#yasr-add-field-edit-multiset").on('click', function() {
331
332
- if(counter>9){
333
- jQuery('#yasr-element-limit').show();
334
- jQuery('#yasr-add-field-edit-multiset').hide();
335
- return false;
336
- }
337
338
- var newTextBoxDiv = jQuery(document.createElement('tr'))
339
340
- newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
341
342
- newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
343
344
- counter++;
345
346
- });
347
348
349
- } //End if ($n_multi_set == 1)
350
351
- if (nMultiSet > 1) {
352
353
- //If more then 1 set is used...
354
- jQuery('#yasr-button-select-set-edit-form').on("click", function() {
355
356
- var data = {
357
- action : 'yasr_get_multi_set',
358
- set_id : jQuery('#yasr_select_edit_set').val()
359
- }
360
361
- jQuery.post(ajaxurl, data, function(response) {
362
- jQuery('#yasr-multi-set-response').show();
363
- jQuery('#yasr-multi-set-response').html(response);
364
- });
365
366
- return false; // prevent default click action from happening!
367
368
- });
369
370
- jQuery(document).ajaxComplete(function(){
371
372
- var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
373
374
- counter++;
375
376
- jQuery("#yasr-add-field-edit-multiset").on('click', function() {
377
378
- if(counter>9){
379
- jQuery('#yasr-element-limit').show();
380
- jQuery('#yasr-add-field-edit-multiset').hide();
381
- return false;
382
- }
383
384
- var newTextBoxDiv = jQuery(document.createElement('tr'))
385
386
- newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
387
388
- newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
389
390
- counter++;
391
392
- });
393
394
- });
395
396
- } //End if ($n_multi_set > 1)
397
398
399
400
- } //end if active_tab=='manage_multi'
401
402
403
- if (activeTab === 'style_options') {
404
405
- jQuery('#yasr-color-scheme-preview-link').on('click', function () {
406
- jQuery('#yasr-color-scheme-preview').toggle('slow');
407
- return false; // prevent default click action from happening!
408
- });
409
410
- }
411
412
413
- }
414
415
- function YasrAsk5Stars(nonceHideAskRating) {
416
417
- //This will call an ajax action that set a site transite to hide
418
- //for a week the metabok
419
- jQuery('#yasr-ask-five-star-later').on("click", function(){
420
421
- jQuery('#yasr-ask-five-stars').hide();
422
423
- var data = {
424
- action: 'yasr_hide_ask_rating_metabox',
425
- choose: 'hide',
426
- nonce: nonceHideAskRating
427
428
- };
429
430
- jQuery.post(ajaxurl, data);
431
432
- });
433
434
435
- //This will close the ask rating metabox forever
436
- jQuery('#yasr-ask-five-close').on("click", function(){
437
438
- jQuery('#yasr-ask-five-stars').hide();
439
440
- var data = {
441
- action: 'yasr_hide_ask_rating_metabox',
442
- choose: 'close',
443
- nonce: nonceHideAskRating
444
- };
445
446
- jQuery.post(ajaxurl, data);
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
- // When click on chart hide tab-main and show tab-charts
460
461
- function yasrShortcodeCreator(nMultiSet) {
462
463
- // When click on main tab hide tab-main and show tab-charts
464
- jQuery('#yasr-link-tab-main').on("click", function(){
465
466
- jQuery('.yasr-nav-tab').removeClass('nav-tab-active');
467
- jQuery('#yasr-link-tab-main').addClass('nav-tab-active');
468
469
- jQuery('.yasr-content-tab-tinymce').hide();
470
- jQuery('#yasr-content-tab-main').show();
471
472
- });
473
474
- jQuery('#yasr-link-tab-charts').on("click", function(){
475
476
- jQuery('.yasr-nav-tab').removeClass('nav-tab-active');
477
- jQuery('#yasr-link-tab-charts').addClass('nav-tab-active');
478
479
- jQuery('.yasr-content-tab-tinymce').hide();
480
- jQuery('#yasr-content-tab-charts').show();
481
482
- });
483
484
- // Add shortcode for overall rating
485
- jQuery('#yasr-overall').on("click", function(){
486
- jQuery('#yasr-overall-choose-size').toggle('slow');
487
- });
488
489
- jQuery('#yasr-overall-insert-small').on("click", function(){
490
- var shortcode = '[yasr_overall_rating size="small"]';
491
492
- if(tinyMCE.activeEditor==null) {
493
494
- //this is for tinymce used in text mode
495
- jQuery("#content").append(shortcode);
496
497
- }
498
499
- else {
500
501
- // inserts the shortcode into the active editor
502
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
503
504
- }
505
506
- // close
507
- tb_remove();
508
- //jQuery('#yasr-tinypopup-form').dialog('close');
509
-
510
- });
511
512
- jQuery('#yasr-overall-insert-medium').on("click", function(){
513
- var shortcode = '[yasr_overall_rating size="medium"]';
514
-
515
- // inserts the shortcode into the active editor
516
- if(tinyMCE.activeEditor==null) {
517
518
- //this is for tinymce used in text mode
519
- jQuery("#content").append(shortcode);
520
521
- }
522
523
- else {
524
525
- // inserts the shortcode into the active editor
526
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
527
528
- }
529
530
- // close
531
- tb_remove();
532
- //jQuery('#yasr-tinypopup-form').dialog('close');
533
- });
534
535
- jQuery('#yasr-overall-insert-large').on("click", function(){
536
- var shortcode = '[yasr_overall_rating size="large"]';
537
-
538
- if(tinyMCE.activeEditor==null) {
539
540
- //this is for tinymce used in text mode
541
- jQuery("#content").append(shortcode);
542
543
- }
544
545
- else {
546
547
- // inserts the shortcode into the active editor
548
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
549
550
- }
551
552
- // close
553
- tb_remove();
554
- //jQuery('#yasr-tinypopup-form').dialog('close');
555
- });
556
557
- //Add shortcode for visitors rating
558
- jQuery('#yasr-visitor-votes').on("click", function(){
559
- jQuery('#yasr-visitor-choose-size').toggle('slow');
560
- });
561
562
- jQuery('#yasr-visitor-insert-small').on("click", function(){
563
- var shortcode = '[yasr_visitor_votes size="small"]';
564
565
- // inserts the shortcode into the active editor
566
- if(tinyMCE.activeEditor==null) {
567
568
- //this is for tinymce used in text mode
569
- jQuery("#content").append(shortcode);
570
571
- }
572
573
- else {
574
575
- // inserts the shortcode into the active editor
576
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
577
578
- }
579
580
- // close
581
- tb_remove();
582
- //jQuery('#yasr-tinypopup-form').dialog('close');
583
- });
584
585
- jQuery('#yasr-visitor-insert-medium').on("click", function(){
586
- var shortcode = '[yasr_visitor_votes size="medium"]';
587
588
- if(tinyMCE.activeEditor==null) {
589
590
- //this is for tinymce used in text mode
591
- jQuery("#content").append(shortcode);
592
593
- }
594
595
- else {
596
597
- // inserts the shortcode into the active editor
598
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
599
600
- }
601
602
- // close
603
- tb_remove();
604
- //jQuery('#yasr-tinypopup-form').dialog('close');
605
- });
606
607
- jQuery('#yasr-visitor-insert-large').on("click", function(){
608
- var shortcode = '[yasr_visitor_votes size="large"]';
609
-
610
- // inserts the shortcode into the active editor
611
- if(tinyMCE.activeEditor==null) {
612
613
- //this is for tinymce used in text mode
614
- jQuery("#content").append(shortcode);
615
616
- }
617
618
- else {
619
620
- // inserts the shortcode into the active editor
621
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
622
623
- }
624
625
- // close
626
- tb_remove();
627
- //jQuery('#yasr-tinypopup-form').dialog('close');
628
- });
629
630
- if (nMultiSet > 1) {
631
632
- //Add shortcode for multiple set
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
- if (!visitorSet) {
639
640
- var shortcode = '[yasr_visitor_multiset setid=';
641
642
- }
643
644
- else {
645
646
- var shortcode = '[yasr_multiset setid=';
647
648
- }
649
650
- shortcode += setType;
651
652
- if (showAverage) {
653
654
- shortcode += ' show_average=\'no\'';
655
656
- }
657
658
659
- shortcode += ']';
660
-
661
- // inserts the shortcode into the active editor
662
- if(tinyMCE.activeEditor==null) {
663
664
- //this is for tinymce used in text mode
665
- jQuery("#content").append(shortcode);
666
667
- }
668
669
- else {
670
671
- // inserts the shortcode into the active editor
672
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
673
674
- }
675
676
- // close
677
- tb_remove();
678
- //jQuery('#yasr-tinypopup-form').dialog('close');
679
- });
680
681
- } //End if
682
683
- else if (nMultiSet == 1) {
684
685
- //Add shortcode for single set (if only 1 are found)
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
- var visitorSet = jQuery("#yasr-allow-vote-multiset").is(':checked');
691
692
- if (!visitorSet) {
693
694
- var shortcode = '[yasr_visitor_multiset setid=';
695
696
- }
697
698
- else {
699
700
- var shortcode = '[yasr_multiset setid=';
701
702
- }
703
704
- shortcode += setType;
705
706
- if (showAverage) {
707
708
- shortcode += ' show_average=\'no\'';
709
710
- }
711
712
- shortcode += ']';
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
- }
721
722
- else {
723
724
- // inserts the shortcode into the active editor
725
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
726
727
- }
728
729
- // close
730
- tb_remove();
731
- //jQuery('#yasr-tinypopup-form').dialog('close');
732
- });
733
734
- } //End elseif
735
736
- // Add shortcode for top 10 by overall ratings
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
- //this is for tinymce used in text mode
744
- jQuery("#content").append(shortcode);
745
746
- }
747
748
- else {
749
750
- // inserts the shortcode into the active editor
751
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
752
753
- }
754
755
- // close
756
- tb_remove();
757
- //jQuery('#yasr-tinypopup-form').dialog('close');
758
- });
759
760
- // Add shortcode for 10 highest most rated
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
- //this is for tinymce used in text mode
768
- jQuery("#content").append(shortcode);
769
770
- }
771
772
- else {
773
774
- // inserts the shortcode into the active editor
775
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
776
777
- }
778
779
- // close
780
- tb_remove();
781
- //jQuery('#yasr-tinypopup-form').dialog('close');
782
- });
783
784
- // Add shortcode for top 5 active reviewer
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
- //this is for tinymce used in text mode
792
- jQuery("#content").append(shortcode);
793
794
- }
795
796
- else {
797
798
- // inserts the shortcode into the active editor
799
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
800
801
- }
802
803
- // close
804
- tb_remove();
805
- //jQuery('#yasr-tinypopup-form').dialog('close');
806
- });
807
808
- // Add shortcode for top 10 active users
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
- //this is for tinymce used in text mode
816
- jQuery("#content").append(shortcode);
817
818
- }
819
820
- else {
821
822
- // inserts the shortcode into the active editor
823
- tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
824
825
- }
826
827
- // close
828
- tb_remove();
829
- //jQuery('#yasr-tinypopup-form').dialog('close');
830
- });
831
832
- } //End function
833
834
- /****** End YAsr Ajax page ******/
835
836
- /****** Yasr db functions ******/
837
838
- //Vote log
839
- jQuery(document).ready(function() {
840
841
- //Log
842
- jQuery('.yasr-log-pagenum').on('click', function() {
843
844
- jQuery('#yasr-loader-log-metabox').show();
845
846
- var data = {
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
- jQuery.post(ajaxurl, data, function(response) {
854
- jQuery('#yasr-loader-log-metabox').hide();
855
- jQuery('#yasr-log-container').html(response);
856
- });
857
858
- });
859
860
- jQuery(document).ajaxComplete(function() {
861
862
- jQuery('.yasr-log-page-num').on('click', function() {
863
864
- jQuery('#yasr-loader-log-metabox').show();
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
- jQuery.post(ajaxurl, data, function(response) {
873
- jQuery('#yasr-log-container').html(response); //This will hide the loader gif too
874
- });
875
876
- });
877
878
- });
879
880
- });
881
882
883
884
- //Vote user log
885
- jQuery(document).ready(function() {
886
887
- //Log
888
- jQuery('.yasr-user-log-pagenum').on('click', function() {
889
890
jQuery('#yasr-loader-user-log-metabox').show();
891
892
var data = {
893
- action : 'yasr_change_user_log_page',
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-loader-log-metabox').hide();
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
- $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,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("Rate this article / item", 'yet-another-stars-rating'); ?>
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" id="yasr-auto-insert-disabled-switch" <?php if ($is_this_post_exluded === 'yes') echo " checked='checked' "; ?> >
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 (postid, overallRating);
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
- /** Add a box on the right for asking to rate 5 stars on Wordpress.org
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
- $transient = get_site_transient('yasr_hide_ask_rating');
51
-
52
- if (!$transient) {
53
-
54
- if ($position && $position == "bottom") {
55
- $yasr_metabox_class = "yasr-donatedivbottom";
56
- } else {
57
- $yasr_metabox_class = "yasr-donatedivdx";
58
- }
59
60
- $n_stored_ratings = yasr_count_logged_vote();
61
62
- $div = "<div class=\"$yasr_metabox_class\" id=\"yasr-ask-five-stars\" style=\" display:none; border-left: 3px solid #7AD03A; font-size: 14px;\">";
63
64
- if ($n_stored_ratings > 20) {
65
- $text = sprintf(
66
- __('Hey, seems like you reached %s votes on your site throught YASR! That\'s cool!', 'yet-another-stars-rating'),
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
- $text .= "<ul>
79
80
- <li><a href=\"https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5\">" . __("Ok, I'm glad to help!", 'yet-another-stars-rating') . "</a></li>
81
- <li><a href=\"#\" id=\"yasr-ask-five-star-later\">" . __("Remind me later!", 'yet-another-stars-rating') . "</a></li>
82
- <li><a href=\"#\" id=\"yasr-ask-five-close\">" . __("Don't need to ask, I already did it!", 'yet-another-stars-rating') . "</a></li>
83
84
- </ul>";
85
86
87
- $div_and_text = $div . $text . '</div>';
88
89
- echo $div_and_text;
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
- <strong><?php
194
_e( 'Use Auto Insert?', 'yet-another-stars-rating' );
195
?></strong>
196
-
197
-
198
- <div class="yasr-onoffswitch-big">
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
- <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
206
- <span class="yasr-onoffswitch-inner"></span>
207
- <span class="yasr-onoffswitch-switch"></span>
208
- </label>
209
- </div>
210
211
- <p>&nbsp;</p>
212
213
- <strong><?php
214
_e( 'What?', 'yet-another-stars-rating' );
215
?></strong>
216
217
- <div class="yasr-indented-answer">
218
219
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="overall_rating"
220
- class="yasr-auto-insert-options-class" <?php
221
if ( $option['auto_insert_what'] === 'overall_rating' ) {
222
echo " checked=\"checked\" " ;
223
}
224
?> >
225
- <?php
226
_e( 'Overall Rating / Author Rating', 'yet-another-stars-rating' );
227
?>
228
- <br/>
229
230
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="visitor_rating"
231
- class="yasr-auto-insert-options-class" <?php
232
if ( $option['auto_insert_what'] === 'visitor_rating' ) {
233
echo " checked=\"checked\" " ;
234
}
235
?> >
236
- <?php
237
_e( 'Visitor Votes', 'yet-another-stars-rating' );
238
?>
239
- <br/>
240
241
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="both"
242
- class="yasr-auto-insert-options-class" <?php
243
if ( $option['auto_insert_what'] === 'both' ) {
244
echo " checked=\"checked\" " ;
245
}
246
?> >
247
- <?php
248
_e( 'Both', 'yet-another-stars-rating' );
249
?>
250
251
- <p>&nbsp;</p>
252
253
- </div>
254
255
- <strong><?php
256
_e( 'Where?', 'yet-another-stars-rating' );
257
?></strong>
258
259
- <div class="yasr-indented-answer">
260
261
- <input type="radio" name="yasr_general_options[auto_insert_where]" value="top"
262
- class="yasr-auto-insert-options-class" <?php
263
if ( $option['auto_insert_where'] === 'top' ) {
264
echo " checked=\"checked\" " ;
265
}
266
?> >
267
- <?php
268
_e( 'Before the post', 'yet-another-stars-rating' );
269
?>
270
- <br/>
271
272
- <input type="radio" name="yasr_general_options[auto_insert_where]" value="bottom"
273
- class="yasr-auto-insert-options-class" <?php
274
if ( $option['auto_insert_where'] === 'bottom' ) {
275
echo " checked=\"checked\" " ;
276
}
277
?> >
278
- <?php
279
_e( 'After the post', 'yet-another-stars-rating' );
280
?>
281
- <br/>
282
283
- <p>&nbsp;</p>
284
285
- </div>
286
287
- <strong><?php
288
_e( 'Size', 'yet-another-stars-rating' );
289
?></strong>
290
291
- <div class="yasr-indented-answer">
292
293
- <div class="yasr-option-size">
294
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="small"
295
- class="yasr-auto-insert-options-class" <?php
296
if ( $option['auto_insert_size'] === 'small' ) {
297
echo " checked=\"checked\" " ;
298
}
299
?> >
300
- <img src="<?php
301
echo YASR_IMG_DIR . "yasr-stars-small.png" ;
302
?>" class="yasr-img-option-size"><span
303
- class="yasr-text-options-size"><?php
304
_e( 'Small', 'yet-another-stars-rating' );
305
?></span>
306
- </div>
307
308
- <div class="yasr-option-size">
309
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="medium"
310
- class="yasr-auto-insert-options-class" <?php
311
if ( $option['auto_insert_size'] === 'medium' ) {
312
echo " checked=\"checked\" " ;
313
}
314
?> >
315
- <img src="<?php
316
echo YASR_IMG_DIR . "yasr-stars-medium.png" ;
317
?>" class="yasr-img-option-size"><span
318
- class="yasr-text-options-size"><?php
319
_e( 'Medium', 'yet-another-stars-rating' );
320
?></span>
321
- </div>
322
323
- <div class="yasr-option-size">
324
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="large"
325
- class="yasr-auto-insert-options-class" <?php
326
if ( $option['auto_insert_size'] === 'large' ) {
327
echo " checked=\"checked\" " ;
328
}
329
?> >
330
- <img src="<?php
331
echo YASR_IMG_DIR . "yasr-stars-large.png" ;
332
?>" class="yasr-img-option-size"><span
333
- class="yasr-text-options-size"><?php
334
_e( 'Large', 'yet-another-stars-rating' );
335
?></span>
336
- </div>
337
338
- <p>&nbsp;</p>
339
340
- </div>
341
342
- <strong><?php
343
_e( 'Exclude Pages?', 'yet-another-stars-rating' );
344
?></strong>
345
346
- <div class="yasr-indented-answer">
347
- <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="yes"
348
- class="yasr-auto-insert-options-class" <?php
349
if ( $option['auto_insert_exclude_pages'] === 'yes' ) {
350
echo " checked=\"checked\" " ;
351
}
352
?> >
353
- <?php
354
_e( 'Yes', 'yet-another-stars-rating' );
355
?>
356
357
- &nbsp;&nbsp;&nbsp;
358
359
- <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="no"
360
- class="yasr-auto-insert-options-class" <?php
361
if ( $option['auto_insert_exclude_pages'] === 'no' ) {
362
echo " checked=\"checked\" " ;
363
}
364
?> >
365
- <?php
366
_e( 'No', 'yet-another-stars-rating' );
367
?>
368
- <br/>
369
370
- <p>&nbsp;</p>
371
372
- </div>
373
374
- <?php
375
$custom_post_types = yasr_get_custom_post_type( 'bool' );
376
377
if ( $custom_post_types ) {
378
?>
379
- <strong><?php
380
_e( 'Use only in custom post types?', 'yet-another-stars-rating' );
381
?></strong>
382
- <div class="yasr-indented-answer">
383
- <input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="yes"
384
- class="yasr-auto-insert-options-class" <?php
385
if ( $option['auto_insert_custom_post_only'] === 'yes' ) {
386
echo " checked=\"checked\" " ;
387
}
388
?> >
389
- <?php
390
_e( 'Yes', 'yet-another-stars-rating' );
391
?>
392
393
- &nbsp;&nbsp;&nbsp;
394
395
- <input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="no"
396
- class="yasr-auto-insert-options-class" <?php
397
if ( $option['auto_insert_custom_post_only'] === 'no' ) {
398
echo " checked=\"checked\" " ;
399
}
400
?> >
401
- <?php
402
_e( 'No', 'yet-another-stars-rating' );
403
?>
404
405
- <p>
406
407
- <?php
408
_e( "You see this because you use custom post types.", 'yet-another-stars-rating' );
409
?>
410
- <br/>
411
- <?php
412
_e( "If you want to use auto insert only in custom post types, choose Yes", 'yet-another-stars-rating' );
413
?>
414
415
- <p>&nbsp;</p>
416
417
- </div>
418
419
- <?php
420
} else {
421
?>
422
- <input type="hidden" name="yasr_general_options[auto_insert_custom_post_only]" value="no" ?>
423
- <?php
424
}
425
426
?>
427
428
- <?php
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>&nbsp;</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
- <br/> <br/>
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>&nbsp;</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