Yasr – Yet Another Stars Rating - Version 0.3.8

Version Description

  • Added new chart: Top 10 most rated / highest rated posts from visitors (show up only posts rated at least twice)
  • New setting: it's possibile now to explude pages from auto insert
  • Css changes
  • Various bugfixes
Download this release

Release Info

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

Code changes from version 0.3.7 to 0.3.8

css/yasr-table-dark.css CHANGED
@@ -45,6 +45,32 @@
45
  }
46
 
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  .yasr-top-5-active-reviewer {
50
  color: #ffffff;
45
  }
46
 
47
 
48
+ .yasr-most-or-highest-rated-posts {
49
+ color: #ffffff;
50
+ border-spacing: 1px;
51
+ margin-top: 10px;
52
+ margin-bottom: 24px;
53
+ width: 100%;
54
+ }
55
+
56
+ .yasr-most-or-highest-rated-posts th {
57
+ padding: 12px;
58
+ color: white;
59
+ }
60
+
61
+ .yasr-most-or-highest-rated-posts td {
62
+ padding: 8px;
63
+ width: 50%;
64
+ }
65
+
66
+ .yasr-most-or-highest-rated-posts tr:nth-child(odd) {
67
+ background: #292929;
68
+ }
69
+ /* Define the background color for all the EVEN background rows */
70
+ .yasr-most-or-highest-rated-posts tr:nth-child(even) {
71
+ background: #161616;
72
+ }
73
+
74
 
75
  .yasr-top-5-active-reviewer {
76
  color: #ffffff;
css/yasr-table-light.css CHANGED
@@ -44,6 +44,32 @@
44
  background: #FFFFFF;
45
  }
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  .yasr-top-5-active-reviewer {
49
  border-spacing: 1px;
44
  background: #FFFFFF;
45
  }
46
 
47
+ .yasr-most-or-highest-rated-posts {
48
+ border-spacing: 1px;
49
+ margin-top: 10px;
50
+ margin-bottom: 24px;
51
+ width: 100%;
52
+ }
53
+
54
+ .yasr-most-or-highest-rated-posts th {
55
+ padding: 12px;
56
+ color: #555;
57
+ }
58
+
59
+ .yasr-most-or-highest-rated-posts td {
60
+ padding: 8px;
61
+ width: 50%;
62
+ color: #555;
63
+ }
64
+
65
+ .yasr-most-or-highest-rated-posts tr:nth-child(odd) {
66
+ background: #FFFFec;
67
+ }
68
+ /* Define the background color for all the EVEN background rows */
69
+ .yasr-most-or-highest-rated-posts tr:nth-child(even) {
70
+ background: #FFFFFF;
71
+ }
72
+
73
 
74
  .yasr-top-5-active-reviewer {
75
  border-spacing: 1px;
css/yasr.css CHANGED
@@ -279,6 +279,10 @@ h2.nav-tab-wrapper, h3.nav-tab-wrapper {
279
 
280
  /****** NON ADMIN RULES ******/
281
 
 
 
 
 
282
  #yasr-custom-text-before-overall {
283
  padding-right: 5px;
284
  padding-bottom: 10px;
@@ -296,6 +300,7 @@ h2.nav-tab-wrapper, h3.nav-tab-wrapper {
296
  }
297
 
298
  #yasr_visitor_votes {
 
299
  display: inline-block;
300
  vertical-align: top;
301
  }
279
 
280
  /****** NON ADMIN RULES ******/
281
 
282
+ .yasr_schema{
283
+ font-size: small;
284
+ }
285
+
286
  #yasr-custom-text-before-overall {
287
  padding-right: 5px;
288
  padding-bottom: 10px;
300
  }
301
 
302
  #yasr_visitor_votes {
303
+ font-size: small;
304
  display: inline-block;
305
  vertical-align: top;
306
  }
img/paypal.png ADDED
Binary file
js/addButton_tinymcs.js CHANGED
@@ -4,7 +4,7 @@ jQuery(document).ready(function() {
4
  init : function(ed, url) {
5
  // Register command for when button is clicked
6
  ed.addCommand('yasr_insert_shortcode', function() {
7
-
8
  jQuery('#yasr-form').dialog({
9
  title: 'Insert YASR shortcode',
10
  width: 'auto', // overcomes width:'auto' and maxWidth bug
4
  init : function(ed, url) {
5
  // Register command for when button is clicked
6
  ed.addCommand('yasr_insert_shortcode', function() {
7
+
8
  jQuery('#yasr-form').dialog({
9
  title: 'Insert YASR shortcode',
10
  width: 'auto', // overcomes width:'auto' and maxWidth bug
languages/yasr.mo CHANGED
Binary file
languages/yasr.pot CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Yasr Translation\n"
4
- "POT-Creation-Date: 2014-06-07 16:41+0100\n"
5
- "PO-Revision-Date: 2014-06-07 16:41+0100\n"
6
  "Last-Translator: Dario <thedudoworld@gmail.com>\n"
7
  "Language-Team: Me\n"
8
  "Language: en-gb\n"
@@ -15,395 +15,657 @@ msgstr ""
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-SearchPath-0: ..\n"
17
 
18
- #: ../yasr-settings-page.php:6 ../lib/yasr-functions.php:134
19
- #: ../lib/yasr-functions.php:216 ../lib/yasr-functions.php:223
20
- #: ../lib/yasr-ajax-functions.php:29 ../lib/yasr-ajax-functions.php:202
21
  msgid "You do not have sufficient permissions to access this page."
22
  msgstr ""
23
 
24
- #: ../yasr-settings-page.php:12 ../yasr-settings-page.php:131
 
 
 
 
 
25
  msgid "Donations"
26
  msgstr ""
27
 
28
- #: ../yasr-settings-page.php:14 ../yasr-settings-page.php:133
 
29
  msgid ""
30
  "If you have found this plugin useful, please consider making a donation to "
31
  "help support future development. Your support will be much appreciated. "
32
  msgstr ""
33
 
34
- #: ../yasr-settings-page.php:16 ../yasr-settings-page.php:135
 
35
  msgid "Thank you!"
36
  msgstr ""
37
 
38
- #: ../yasr-settings-page.php:31
39
- msgid "Manage multi set"
40
- msgstr ""
41
-
42
- #: ../yasr-settings-page.php:35
43
- msgid "Add new multi-set"
44
- msgstr ""
45
-
46
- #: ../yasr-settings-page.php:71
47
  msgid "Import Gd Star Rating"
48
  msgstr ""
49
 
50
- #: ../yasr-settings-page.php:72
51
  msgid ""
52
  "I've found a previous installation of Gd Star Rating . <br />Do you want "
53
  "proceed to import data?"
54
  msgstr ""
55
 
56
- #: ../yasr-settings-page.php:74
57
  msgid "Yes, Begin Import"
58
  msgstr ""
59
 
60
- #: ../yasr-settings-page.php:78
61
  msgid "Click on Proceed to Import Gd Star Rating Data."
62
  msgstr ""
63
 
64
- #: ../yasr-settings-page.php:81 ../yasr-settings-page.php:110
65
  msgid "Proceed"
66
  msgstr ""
67
 
68
- #: ../yasr-settings-page.php:99
69
  msgid "Manage GD Star Data"
70
  msgstr ""
71
 
72
- #: ../yasr-settings-page.php:100
73
  msgid "Gd Star Rating has been already imported."
74
  msgstr ""
75
 
76
- #: ../yasr-settings-page.php:101
77
  msgid "If you wish you can import it again, but"
78
  msgstr ""
79
 
80
- #: ../yasr-settings-page.php:101
81
  msgid "you will lose all data you've collect since the import!"
82
  msgstr ""
83
 
84
- #: ../yasr-settings-page.php:103
85
  msgid "Ok, Import Again"
86
  msgstr ""
87
 
88
- #: ../yasr-settings-page.php:107
89
  msgid ""
90
  "Click on Proceed to Import again Gd Star Rating Data. This may take a while!"
91
  msgstr ""
92
 
93
- #: ../yasr-metabox-multiple-rating.php:13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  msgid "Choose wich set you want to use"
95
  msgstr ""
96
 
97
- #: ../yasr-metabox-overall-rating.php:16
98
- msgid "Rate this article / item"
 
99
  msgstr ""
100
 
101
- #: ../lib/yasr-shortcode-functions.php:51 ../lib/yasr-ajax-functions.php:878
102
- #: ../lib/yasr-ajax-functions.php:906
103
- msgid "Average Rating"
104
  msgstr ""
105
 
106
- #: ../lib/yasr-shortcode-functions.php:55
107
- msgid "No rating yet"
 
108
  msgstr ""
109
 
110
- #: ../lib/yasr-db-functions.php:96
111
- msgid "Gd Star Rating non trovato"
 
 
 
 
 
 
 
 
 
112
  msgstr ""
113
 
114
- #: ../lib/yasr-db-functions.php:506 ../lib/yasr-db-functions.php:721
115
- msgid "Settings Saved"
 
 
116
  msgstr ""
117
 
118
- #: ../lib/yasr-db-functions.php:511
119
- msgid "Something goes wrong trying insert set field name. Please report it"
 
 
 
 
 
120
  msgstr ""
121
 
122
- #: ../lib/yasr-db-functions.php:517
123
- msgid "Something goes wrong trying insert multi set name. Please report it"
 
 
124
  msgstr ""
125
 
126
- #: ../lib/yasr-db-functions.php:584
127
- msgid "Something goes wrong trying to delete a multi-set . Please report it"
128
  msgstr ""
129
 
130
- #: ../lib/yasr-db-functions.php:589
131
- msgid ""
132
- "Something goes wrong trying to delete data values for a set. Please report it"
133
  msgstr ""
134
 
135
- #: ../lib/yasr-db-functions.php:620
136
- msgid ""
137
- "Something goes wrong trying to delete a multi-set element. Please report it"
138
  msgstr ""
139
 
140
- #: ../lib/yasr-db-functions.php:625
141
- msgid ""
142
- "Something goes wrong trying to delete data value for an element. Please "
143
- "report it"
144
  msgstr ""
145
 
146
- #: ../lib/yasr-db-functions.php:665
147
  msgid ""
148
- "Something goes wrong trying to update a multi set element. Please report it"
 
149
  msgstr ""
150
 
151
- #: ../lib/yasr-db-functions.php:706
152
  msgid ""
153
- "Something goes wrong trying to insert set field name in edit form. Please "
154
- "report it"
155
  msgstr ""
156
 
157
- #: ../lib/yasr-db-functions.php:765 ../lib/yasr-ajax-functions.php:678
158
- msgid "anonymous"
159
  msgstr ""
160
 
161
- #: ../lib/yasr-db-functions.php:788 ../lib/yasr-ajax-functions.php:701
162
- msgid "Ip address"
163
  msgstr ""
164
 
165
- #: ../lib/yasr-db-functions.php:826 ../lib/yasr-ajax-functions.php:739
166
- msgid "Pages"
167
  msgstr ""
168
 
169
- #: ../lib/yasr-functions.php:40
170
- msgid "Yet Another Stars Rating: Settings"
171
  msgstr ""
172
 
173
- #: ../lib/yasr-functions.php:64
174
- msgid "Auto insert Settings"
175
  msgstr ""
176
 
177
- #: ../lib/yasr-functions.php:65
178
- msgid "Use auto insert?"
179
  msgstr ""
180
 
181
- #: ../lib/yasr-functions.php:66
182
- msgid "What?"
183
  msgstr ""
184
 
185
- #: ../lib/yasr-functions.php:67
186
- msgid "Where?"
187
  msgstr ""
188
 
189
- #: ../lib/yasr-functions.php:80
 
 
 
190
  msgid "Yes"
191
  msgstr ""
192
 
193
- #: ../lib/yasr-functions.php:84
 
 
 
194
  msgid "No"
195
  msgstr ""
196
 
197
- #: ../lib/yasr-functions.php:104
 
 
 
 
198
  msgid "Overall Rating / Author Rating"
199
  msgstr ""
200
 
201
- #: ../lib/yasr-functions.php:108 ../lib/yasr-ajax-functions.php:299
202
  msgid "Visitor Votes"
203
  msgstr ""
204
 
205
- #: ../lib/yasr-functions.php:112
206
  msgid "Both"
207
  msgstr ""
208
 
209
- #: ../lib/yasr-functions.php:121
 
 
 
 
210
  msgid "Before the post"
211
  msgstr ""
212
 
213
- #: ../lib/yasr-functions.php:125
214
  msgid "After the post"
215
  msgstr ""
216
 
217
- #: ../lib/yasr-functions.php:176
218
- msgid "Save"
219
  msgstr ""
220
 
221
- #: ../lib/yasr-functions.php:202 ../lib/yasr-functions.php:209
222
- msgid "Overall Rating"
 
 
 
223
  msgstr ""
224
 
225
- #: ../lib/yasr-functions.php:203
226
- msgid "Yet Another Stars Rating: Multiple set"
227
  msgstr ""
228
 
229
- #: ../lib/yasr-functions.php:248
230
- msgid " reviewed by "
231
  msgstr ""
232
 
233
- #: ../lib/yasr-functions.php:249
234
- msgid " on "
235
  msgstr ""
236
 
237
- #: ../lib/yasr-functions.php:250
238
- msgid " rated "
239
  msgstr ""
240
 
241
- #: ../lib/yasr-functions.php:250
242
- msgid " on 5.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  msgstr ""
244
 
245
- #: ../lib/yasr-functions.php:369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  msgid ""
247
  "Field Name, Element#1 and Element#2 MUST be filled and must be long at least "
248
  "3 characters"
249
  msgstr ""
250
 
251
- #: ../lib/yasr-functions.php:372
252
  msgid "Name"
253
  msgstr ""
254
 
255
- #: ../lib/yasr-functions.php:377
256
  msgid "You can insert up to nine element"
257
  msgstr ""
258
 
259
- #: ../lib/yasr-functions.php:382
260
  msgid "Element "
261
  msgstr ""
262
 
263
- #: ../lib/yasr-functions.php:392
264
  msgid "Create New Set"
265
  msgstr ""
266
 
267
- #: ../lib/yasr-functions.php:411 ../lib/yasr-functions.php:431
268
- msgid "Manage existing multi-set"
269
  msgstr ""
270
 
271
- #: ../lib/yasr-functions.php:415
272
- msgid "Wich set do you want to edit or remove?"
 
273
  msgstr ""
274
 
275
- #: ../lib/yasr-functions.php:455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  msgid "No multiple set were found"
277
  msgstr ""
278
 
279
- #: ../lib/yasr-ajax-functions.php:91 ../lib/yasr-ajax-functions.php:151
280
- msgid "Choose a vote for every element"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  msgstr ""
282
 
283
- #: ../lib/yasr-ajax-functions.php:140 ../lib/yasr-ajax-functions.php:174
 
 
 
 
 
 
 
 
284
  msgid "Remember to insert this shortcode"
285
  msgstr ""
286
 
287
- #: ../lib/yasr-ajax-functions.php:142 ../lib/yasr-ajax-functions.php:176
288
  msgid "where you want to display this multi set"
289
  msgstr ""
290
 
291
- #: ../lib/yasr-ajax-functions.php:294
 
 
 
 
292
  msgid "Overall Rating / Review"
293
  msgstr ""
294
 
295
- #: ../lib/yasr-ajax-functions.php:296
296
  msgid "Insert Overall Rating / Review for this post"
297
  msgstr ""
298
 
299
- #: ../lib/yasr-ajax-functions.php:301
300
  msgid "Insert the ability for your visitor to vote"
301
  msgstr ""
302
 
303
- #: ../lib/yasr-ajax-functions.php:307
304
  msgid "If you want to insert a multi-set, pick one:"
305
  msgstr ""
306
 
307
- #: ../lib/yasr-ajax-functions.php:313
308
  msgid "Choose wich set you want to insert."
309
  msgstr ""
310
 
311
- #: ../lib/yasr-ajax-functions.php:321
312
  msgid "Insert Multiset:"
313
  msgstr ""
314
 
315
- #: ../lib/yasr-ajax-functions.php:432
316
- msgid "Field name"
317
  msgstr ""
318
 
319
- #: ../lib/yasr-ajax-functions.php:436
320
- msgid "Remove"
321
  msgstr ""
322
 
323
- #: ../lib/yasr-ajax-functions.php:484
324
- msgid ""
325
- "If you remove something you will remove all the votes for that set or field. "
326
- "This operation CAN'T BE undone."
327
  msgstr ""
328
 
329
- #: ../lib/yasr-ajax-functions.php:491
330
- msgid "You can use up to 9 elements"
331
  msgstr ""
332
 
333
- #: ../lib/yasr-ajax-functions.php:493
334
- msgid "Add element"
335
  msgstr ""
336
 
337
- #: ../lib/yasr-ajax-functions.php:495
338
- msgid "Save changes"
 
 
 
 
 
 
 
 
339
  msgstr ""
340
 
341
- #: ../lib/yasr-ajax-functions.php:536
342
  msgid "Reviews and visitor votes have been successfull imported."
343
  msgstr ""
344
 
345
- #: ../lib/yasr-ajax-functions.php:538
346
  msgid ""
347
  "Step2: I will check if you used multiple set and if so I will import it. "
348
  "THIS MAY TAKE A WHILE!"
349
  msgstr ""
350
 
351
- #: ../lib/yasr-ajax-functions.php:540
352
  msgid "Proceed Step 2"
353
  msgstr ""
354
 
355
- #: ../lib/yasr-ajax-functions.php:547
356
  msgid "Something goes wrong! Refresh the page and try again!"
357
  msgstr ""
358
 
359
- #: ../lib/yasr-ajax-functions.php:571
360
  msgid "I've found multiple set! Importing..."
361
  msgstr ""
362
 
363
- #: ../lib/yasr-ajax-functions.php:580
364
  msgid "Multi set's name has been successfull imported."
365
  msgstr ""
366
 
367
- #: ../lib/yasr-ajax-functions.php:582
368
  msgid "Now I'm going to import multi set data"
369
  msgstr ""
370
 
371
- #: ../lib/yasr-ajax-functions.php:593
372
  msgid "All votes has been successfull imported."
373
  msgstr ""
374
 
375
- #: ../lib/yasr-ajax-functions.php:596
376
  msgid "Done"
377
  msgstr ""
378
 
379
- #: ../lib/yasr-ajax-functions.php:601
380
  msgid "I've found multiple set votes but I couldn't insert into db"
381
  msgstr ""
382
 
383
- #: ../lib/yasr-ajax-functions.php:609
384
  msgid "I've found multi set but with no data"
385
  msgstr ""
386
 
387
- #: ../lib/yasr-ajax-functions.php:618
388
  msgid "I've found multi set name but I couldn't insert into db"
389
  msgstr ""
390
 
391
- #: ../lib/yasr-ajax-functions.php:626
392
  msgid "Multiset was not found. Imported is done!"
393
  msgstr ""
394
 
395
- #: ../lib/yasr-ajax-functions.php:665
396
- msgid "No Recenet votes yet"
397
- msgstr ""
398
-
399
- #: ../lib/yasr-ajax-functions.php:878 ../lib/yasr-ajax-functions.php:883
400
  msgid "Vote Saved"
401
  msgstr ""
402
 
403
- #: ../lib/yasr-ajax-functions.php:878 ../lib/yasr-ajax-functions.php:906
 
404
  msgid "votes casts"
405
  msgstr ""
406
 
407
- #: ../lib/yasr-ajax-functions.php:883
408
- msgid "vote casts"
 
 
 
 
 
 
 
409
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Yasr Translation\n"
4
+ "POT-Creation-Date: 2014-07-18 15:07+0100\n"
5
+ "PO-Revision-Date: 2014-07-18 15:07+0100\n"
6
  "Last-Translator: Dario <thedudoworld@gmail.com>\n"
7
  "Language-Team: Me\n"
8
  "Language: en-gb\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-SearchPath-0: ..\n"
17
 
18
+ #: ../yasr-settings-page.php:6 ../lib/yasr-functions.php:73
19
+ #: ../lib/yasr-ajax-functions.php:29 ../lib/yasr-ajax-functions.php:89
20
+ #: ../lib/yasr-ajax-functions.php:228 ../lib/yasr-ajax-functions.php:646
21
  msgid "You do not have sufficient permissions to access this page."
22
  msgstr ""
23
 
24
+ #: ../yasr-settings-page.php:73
25
+ msgid "Save"
26
+ msgstr ""
27
+
28
+ #: ../yasr-settings-page.php:79 ../yasr-settings-page.php:242
29
+ #: ../yasr-settings-page.php:267
30
  msgid "Donations"
31
  msgstr ""
32
 
33
+ #: ../yasr-settings-page.php:81 ../yasr-settings-page.php:244
34
+ #: ../yasr-settings-page.php:269
35
  msgid ""
36
  "If you have found this plugin useful, please consider making a donation to "
37
  "help support future development. Your support will be much appreciated. "
38
  msgstr ""
39
 
40
+ #: ../yasr-settings-page.php:83 ../yasr-settings-page.php:246
41
+ #: ../yasr-settings-page.php:271
42
  msgid "Thank you!"
43
  msgstr ""
44
 
45
+ #: ../yasr-settings-page.php:103
 
 
 
 
 
 
 
 
46
  msgid "Import Gd Star Rating"
47
  msgstr ""
48
 
49
+ #: ../yasr-settings-page.php:104
50
  msgid ""
51
  "I've found a previous installation of Gd Star Rating . <br />Do you want "
52
  "proceed to import data?"
53
  msgstr ""
54
 
55
+ #: ../yasr-settings-page.php:106
56
  msgid "Yes, Begin Import"
57
  msgstr ""
58
 
59
+ #: ../yasr-settings-page.php:110
60
  msgid "Click on Proceed to Import Gd Star Rating Data."
61
  msgstr ""
62
 
63
+ #: ../yasr-settings-page.php:113 ../yasr-settings-page.php:146
64
  msgid "Proceed"
65
  msgstr ""
66
 
67
+ #: ../yasr-settings-page.php:135
68
  msgid "Manage GD Star Data"
69
  msgstr ""
70
 
71
+ #: ../yasr-settings-page.php:136
72
  msgid "Gd Star Rating has been already imported."
73
  msgstr ""
74
 
75
+ #: ../yasr-settings-page.php:137
76
  msgid "If you wish you can import it again, but"
77
  msgstr ""
78
 
79
+ #: ../yasr-settings-page.php:137
80
  msgid "you will lose all data you've collect since the import!"
81
  msgstr ""
82
 
83
+ #: ../yasr-settings-page.php:139
84
  msgid "Ok, Import Again"
85
  msgstr ""
86
 
87
+ #: ../yasr-settings-page.php:143
88
  msgid ""
89
  "Click on Proceed to Import again Gd Star Rating Data. This may take a while!"
90
  msgstr ""
91
 
92
+ #: ../yasr-settings-page.php:185
93
+ msgid "Manage multi-set"
94
+ msgstr ""
95
+
96
+ #: ../yasr-settings-page.php:189
97
+ msgid "What is a Multi-set?"
98
+ msgstr ""
99
+
100
+ #: ../yasr-settings-page.php:194
101
+ msgid ""
102
+ "Multi-set allows you to insert a rate for each aspect about the product / "
103
+ "local business / whetever\n"
104
+ "\t\t\t\tyou're reviewing, example in the image below."
105
+ msgstr ""
106
+
107
+ #: ../yasr-settings-page.php:199
108
+ msgid ""
109
+ "You can create up to 99 different multi-sets and each one can contain up to "
110
+ "9 different fields. \n"
111
+ "\t\t\t\t\tOnce you've saved it, you can insert the rates while typing your "
112
+ "article in the box below the editor, \n"
113
+ "\t\t\t\t\tas you can see in this image (click to see it larger)"
114
+ msgstr ""
115
+
116
+ #: ../yasr-settings-page.php:205
117
+ msgid ""
118
+ "In order to insert your text into a post or page, you can either past\n"
119
+ "\t\t\t\t\tthe short code that will appear at the bottom of the box or just "
120
+ "click\n"
121
+ "\t\t\t\t\ton the star in the graphic editor and select \"Insert Multi-Set\"."
122
+ msgstr ""
123
+
124
+ #: ../yasr-settings-page.php:213
125
+ msgid "Close this message"
126
+ msgstr ""
127
+
128
+ #: ../yasr-metabox-multiple-rating.php:15
129
  msgid "Choose wich set you want to use"
130
  msgstr ""
131
 
132
+ #: ../yasr-metabox-multiple-rating.php:26
133
+ #: ../lib/yasr-settings-functions.php:350
134
+ msgid "Select"
135
  msgstr ""
136
 
137
+ #: ../yasr-metabox-overall-rating.php:16
138
+ msgid "Rate this article / item"
 
139
  msgstr ""
140
 
141
+ #: ../yasr-metabox-overall-rating.php:24
142
+ #: ../lib/yasr-shortcode-functions.php:108 ../lib/yasr-functions.php:232
143
+ msgid "Loading, please wait"
144
  msgstr ""
145
 
146
+ #: ../lib/yasr-shortcode-functions.php:128
147
+ #: ../lib/yasr-shortcode-functions.php:139
148
+ #: ../lib/yasr-shortcode-functions.php:157
149
+ #: ../lib/yasr-shortcode-functions.php:186
150
+ #: ../lib/yasr-shortcode-functions.php:194
151
+ #: ../lib/yasr-shortcode-functions.php:212 ../lib/yasr-functions.php:253
152
+ #: ../lib/yasr-functions.php:264 ../lib/yasr-functions.php:282
153
+ #: ../lib/yasr-functions.php:311 ../lib/yasr-functions.php:319
154
+ #: ../lib/yasr-functions.php:337 ../lib/yasr-ajax-functions.php:880
155
+ #: ../lib/yasr-ajax-functions.php:916 ../lib/yasr-ajax-functions.php:923
156
+ msgid "Average Rating"
157
  msgstr ""
158
 
159
+ #: ../lib/yasr-shortcode-functions.php:128
160
+ #: ../lib/yasr-shortcode-functions.php:186 ../lib/yasr-functions.php:253
161
+ #: ../lib/yasr-functions.php:311
162
+ msgid "User "
163
  msgstr ""
164
 
165
+ #: ../lib/yasr-shortcode-functions.php:144
166
+ #: ../lib/yasr-shortcode-functions.php:162
167
+ #: ../lib/yasr-shortcode-functions.php:199
168
+ #: ../lib/yasr-shortcode-functions.php:217 ../lib/yasr-functions.php:269
169
+ #: ../lib/yasr-functions.php:287 ../lib/yasr-functions.php:324
170
+ #: ../lib/yasr-functions.php:342
171
+ msgid "No rating yet"
172
  msgstr ""
173
 
174
+ #: ../lib/yasr-shortcode-functions.php:212
175
+ #: ../lib/yasr-shortcode-functions.php:217 ../lib/yasr-functions.php:337
176
+ #: ../lib/yasr-functions.php:342
177
+ msgid "You must sign to vote"
178
  msgstr ""
179
 
180
+ #: ../lib/yasr-shortcode-functions.php:415
181
+ msgid "You don't have any votes stored"
182
  msgstr ""
183
 
184
+ #: ../lib/yasr-shortcode-functions.php:475 ../lib/yasr-ajax-functions.php:987
185
+ #: ../lib/yasr-ajax-functions.php:1032
186
+ msgid "Total:"
187
  msgstr ""
188
 
189
+ #: ../lib/yasr-shortcode-functions.php:475 ../lib/yasr-ajax-functions.php:987
190
+ #: ../lib/yasr-ajax-functions.php:1032
191
+ msgid "Average"
192
  msgstr ""
193
 
194
+ #: ../lib/yasr-shortcode-functions.php:567
195
+ msgid "You don't have any user votes stored"
 
 
196
  msgstr ""
197
 
198
+ #: ../lib/yasr-shortcode-functions.php:636
199
  msgid ""
200
+ "Problem while retriving the top 5 most active reviewers. Did you published "
201
+ "any review?"
202
  msgstr ""
203
 
204
+ #: ../lib/yasr-shortcode-functions.php:704
205
  msgid ""
206
+ "Problem while retriving the top 10 active users chart. Are you sure you have "
207
+ "votes to show?"
208
  msgstr ""
209
 
210
+ #: ../lib/yasr-settings-functions.php:30
211
+ msgid "General settings"
212
  msgstr ""
213
 
214
+ #: ../lib/yasr-settings-functions.php:31
215
+ msgid "Auto insert otions"
216
  msgstr ""
217
 
218
+ #: ../lib/yasr-settings-functions.php:32
219
+ msgid "Show overall rating in Home Page?"
220
  msgstr ""
221
 
222
+ #: ../lib/yasr-settings-functions.php:33
223
+ msgid "Insert custom text to show before / after stars"
224
  msgstr ""
225
 
226
+ #: ../lib/yasr-settings-functions.php:34
227
+ msgid "Which color scheme do you want to use?"
228
  msgstr ""
229
 
230
+ #: ../lib/yasr-settings-functions.php:35
231
+ msgid "Allow only logged in user to vote?"
232
  msgstr ""
233
 
234
+ #: ../lib/yasr-settings-functions.php:36
235
+ msgid "Which rich snippets do you want to use?"
236
  msgstr ""
237
 
238
+ #: ../lib/yasr-settings-functions.php:50
239
+ msgid "Use Auto Insert?"
240
  msgstr ""
241
 
242
+ #: ../lib/yasr-settings-functions.php:53
243
+ #: ../lib/yasr-settings-functions.php:107
244
+ #: ../lib/yasr-settings-functions.php:127
245
+ #: ../lib/yasr-settings-functions.php:152
246
  msgid "Yes"
247
  msgstr ""
248
 
249
+ #: ../lib/yasr-settings-functions.php:71
250
+ #: ../lib/yasr-settings-functions.php:112
251
+ #: ../lib/yasr-settings-functions.php:132
252
+ #: ../lib/yasr-settings-functions.php:169
253
  msgid "No"
254
  msgstr ""
255
 
256
+ #: ../lib/yasr-settings-functions.php:77
257
+ msgid "What?"
258
+ msgstr ""
259
+
260
+ #: ../lib/yasr-settings-functions.php:80
261
  msgid "Overall Rating / Author Rating"
262
  msgstr ""
263
 
264
+ #: ../lib/yasr-settings-functions.php:84 ../lib/yasr-ajax-functions.php:331
265
  msgid "Visitor Votes"
266
  msgstr ""
267
 
268
+ #: ../lib/yasr-settings-functions.php:88
269
  msgid "Both"
270
  msgstr ""
271
 
272
+ #: ../lib/yasr-settings-functions.php:92
273
+ msgid "Where?"
274
+ msgstr ""
275
+
276
+ #: ../lib/yasr-settings-functions.php:95
277
  msgid "Before the post"
278
  msgstr ""
279
 
280
+ #: ../lib/yasr-settings-functions.php:99
281
  msgid "After the post"
282
  msgstr ""
283
 
284
+ #: ../lib/yasr-settings-functions.php:104
285
+ msgid "Exclude Pages?"
286
  msgstr ""
287
 
288
+ #: ../lib/yasr-settings-functions.php:136
289
+ msgid ""
290
+ "If you enable this, \"Overall Rating\" will be showed not only in the single "
291
+ "article or page, but also in pages like Home Page, category pages or "
292
+ "archives."
293
  msgstr ""
294
 
295
+ #: ../lib/yasr-settings-functions.php:176
296
+ msgid "Custom text to display before overall rating"
297
  msgstr ""
298
 
299
+ #: ../lib/yasr-settings-functions.php:181
300
+ msgid "Custom text to display before visitor rating"
301
  msgstr ""
302
 
303
+ #: ../lib/yasr-settings-functions.php:186
304
+ msgid "Custom text to display when a non logged user has already rated"
305
  msgstr ""
306
 
307
+ #: ../lib/yasr-settings-functions.php:202
308
+ msgid "Light"
309
  msgstr ""
310
 
311
+ #: ../lib/yasr-settings-functions.php:207
312
+ msgid "Dark"
313
+ msgstr ""
314
+
315
+ #: ../lib/yasr-settings-functions.php:212
316
+ msgid "Preview"
317
+ msgstr ""
318
+
319
+ #: ../lib/yasr-settings-functions.php:217
320
+ msgid "Light theme"
321
+ msgstr ""
322
+
323
+ #: ../lib/yasr-settings-functions.php:222
324
+ msgid "Dark Theme"
325
+ msgstr ""
326
+
327
+ #: ../lib/yasr-settings-functions.php:240
328
+ msgid "Allow only logged-in users"
329
+ msgstr ""
330
+
331
+ #: ../lib/yasr-settings-functions.php:244
332
+ msgid "Allow everybody (logged in and anonymous)"
333
+ msgstr ""
334
+
335
+ #: ../lib/yasr-settings-functions.php:261
336
+ msgid "Review Rating"
337
  msgstr ""
338
 
339
+ #: ../lib/yasr-settings-functions.php:265
340
+ msgid "Aggregate Rating"
341
+ msgstr ""
342
+
343
+ #: ../lib/yasr-settings-functions.php:270
344
+ msgid "What is this?"
345
+ msgstr ""
346
+
347
+ #: ../lib/yasr-settings-functions.php:275
348
+ msgid ""
349
+ "If you select \"Review Rating\", your site will be indexed from search "
350
+ "engines like this: "
351
+ msgstr ""
352
+
353
+ #: ../lib/yasr-settings-functions.php:280
354
+ msgid ""
355
+ "If, instead, you choose \"Aggregate Rating\", your site will be indexed like "
356
+ "this"
357
+ msgstr ""
358
+
359
+ #: ../lib/yasr-settings-functions.php:296
360
  msgid ""
361
  "Field Name, Element#1 and Element#2 MUST be filled and must be long at least "
362
  "3 characters"
363
  msgstr ""
364
 
365
+ #: ../lib/yasr-settings-functions.php:299
366
  msgid "Name"
367
  msgstr ""
368
 
369
+ #: ../lib/yasr-settings-functions.php:304
370
  msgid "You can insert up to nine element"
371
  msgstr ""
372
 
373
+ #: ../lib/yasr-settings-functions.php:309
374
  msgid "Element "
375
  msgstr ""
376
 
377
+ #: ../lib/yasr-settings-functions.php:319
378
  msgid "Create New Set"
379
  msgstr ""
380
 
381
+ #: ../lib/yasr-settings-functions.php:342
382
+ msgid "Wich set do you want to edit or remove?"
383
  msgstr ""
384
 
385
+ #: ../lib/yasr-settings-functions.php:382
386
+ #: ../lib/yasr-settings-functions.php:500
387
+ msgid "Field name"
388
  msgstr ""
389
 
390
+ #: ../lib/yasr-settings-functions.php:386
391
+ #: ../lib/yasr-settings-functions.php:504
392
+ msgid "Remove"
393
+ msgstr ""
394
+
395
+ #: ../lib/yasr-settings-functions.php:441
396
+ #: ../lib/yasr-settings-functions.php:559
397
+ msgid ""
398
+ "If you remove something you will remove all the votes for that set or field. "
399
+ "This operation CAN'T BE undone."
400
+ msgstr ""
401
+
402
+ #: ../lib/yasr-settings-functions.php:448
403
+ #: ../lib/yasr-settings-functions.php:566
404
+ msgid "You can use up to 9 elements"
405
+ msgstr ""
406
+
407
+ #: ../lib/yasr-settings-functions.php:450
408
+ #: ../lib/yasr-settings-functions.php:568
409
+ msgid "Add element"
410
+ msgstr ""
411
+
412
+ #: ../lib/yasr-settings-functions.php:452
413
+ #: ../lib/yasr-settings-functions.php:570
414
+ msgid "Save changes"
415
+ msgstr ""
416
+
417
+ #: ../lib/yasr-settings-functions.php:462
418
  msgid "No multiple set were found"
419
  msgstr ""
420
 
421
+ #: ../lib/yasr-settings-functions.php:701
422
+ #: ../lib/yasr-settings-functions.php:956
423
+ msgid "Settings Saved"
424
+ msgstr ""
425
+
426
+ #: ../lib/yasr-settings-functions.php:706
427
+ msgid "Something goes wrong trying insert set field name. Please report it"
428
+ msgstr ""
429
+
430
+ #: ../lib/yasr-settings-functions.php:712
431
+ msgid "Something goes wrong trying insert multi set name. Please report it"
432
+ msgstr ""
433
+
434
+ #: ../lib/yasr-settings-functions.php:787
435
+ msgid "Something goes wrong trying to delete a multi-set . Please report it"
436
+ msgstr ""
437
+
438
+ #: ../lib/yasr-settings-functions.php:792
439
+ msgid ""
440
+ "Something goes wrong trying to delete data fields for a set. Please report it"
441
+ msgstr ""
442
+
443
+ #: ../lib/yasr-settings-functions.php:830
444
+ msgid ""
445
+ "Something goes wrong trying to delete a multi-set element. Please report it"
446
+ msgstr ""
447
+
448
+ #: ../lib/yasr-settings-functions.php:889
449
+ msgid ""
450
+ "Something goes wrong trying to update a multi set element. Please report it"
451
+ msgstr ""
452
+
453
+ #: ../lib/yasr-settings-functions.php:941
454
+ msgid ""
455
+ "Something goes wrong trying to insert set field name in edit form. Please "
456
+ "report it"
457
+ msgstr ""
458
+
459
+ #: ../lib/yasr-settings-functions.php:987
460
+ msgid "No previous Gd Star Ratings installation was found"
461
+ msgstr ""
462
+
463
+ #: ../lib/yasr-db-functions.php:213 ../lib/yasr-ajax-functions.php:658
464
+ msgid "No Recenet votes yet"
465
+ msgstr ""
466
+
467
+ #: ../lib/yasr-db-functions.php:228 ../lib/yasr-ajax-functions.php:671
468
+ msgid "anonymous"
469
+ msgstr ""
470
+
471
+ #: ../lib/yasr-db-functions.php:251 ../lib/yasr-ajax-functions.php:694
472
+ msgid "Ip address"
473
+ msgstr ""
474
+
475
+ #: ../lib/yasr-db-functions.php:292 ../lib/yasr-ajax-functions.php:735
476
+ msgid "Pages"
477
+ msgstr ""
478
+
479
+ #: ../lib/yasr-functions.php:62
480
+ msgid "Yet Another Stars Rating: Settings"
481
+ msgstr ""
482
+
483
+ #: ../lib/yasr-functions.php:92 ../lib/yasr-functions.php:99
484
+ msgid "Overall Rating"
485
+ msgstr ""
486
+
487
+ #: ../lib/yasr-functions.php:93
488
+ msgid "Yet Another Stars Rating: Multiple set"
489
+ msgstr ""
490
+
491
+ #: ../lib/yasr-functions.php:109
492
+ msgid "You don't have enought privileges to insert overall rating"
493
+ msgstr ""
494
+
495
+ #: ../lib/yasr-functions.php:119
496
+ msgid "You don't have enought privileges to insert multi-set"
497
+ msgstr ""
498
+
499
+ #: ../lib/yasr-functions.php:545
500
+ msgid " reviewed by "
501
+ msgstr ""
502
+
503
+ #: ../lib/yasr-functions.php:546
504
+ msgid " on "
505
+ msgstr ""
506
+
507
+ #: ../lib/yasr-functions.php:547 ../lib/yasr-functions.php:578
508
+ msgid " rated "
509
+ msgstr ""
510
+
511
+ #: ../lib/yasr-functions.php:547
512
+ msgid " on 5.0"
513
+ msgstr ""
514
+
515
+ #: ../lib/yasr-functions.php:578
516
+ msgid " out of "
517
+ msgstr ""
518
+
519
+ #: ../lib/yasr-functions.php:579
520
+ msgid " based on "
521
  msgstr ""
522
 
523
+ #: ../lib/yasr-functions.php:579
524
+ msgid " user ratings"
525
+ msgstr ""
526
+
527
+ #: ../lib/yasr-ajax-functions.php:100
528
+ msgid "Choose a vote for each element"
529
+ msgstr ""
530
+
531
+ #: ../lib/yasr-ajax-functions.php:156 ../lib/yasr-ajax-functions.php:199
532
  msgid "Remember to insert this shortcode"
533
  msgstr ""
534
 
535
+ #: ../lib/yasr-ajax-functions.php:158 ../lib/yasr-ajax-functions.php:201
536
  msgid "where you want to display this multi set"
537
  msgstr ""
538
 
539
+ #: ../lib/yasr-ajax-functions.php:166
540
+ msgid "Choose a vote for every element"
541
+ msgstr ""
542
+
543
+ #: ../lib/yasr-ajax-functions.php:326
544
  msgid "Overall Rating / Review"
545
  msgstr ""
546
 
547
+ #: ../lib/yasr-ajax-functions.php:328
548
  msgid "Insert Overall Rating / Review for this post"
549
  msgstr ""
550
 
551
+ #: ../lib/yasr-ajax-functions.php:333
552
  msgid "Insert the ability for your visitor to vote"
553
  msgstr ""
554
 
555
+ #: ../lib/yasr-ajax-functions.php:339
556
  msgid "If you want to insert a multi-set, pick one:"
557
  msgstr ""
558
 
559
+ #: ../lib/yasr-ajax-functions.php:345
560
  msgid "Choose wich set you want to insert."
561
  msgstr ""
562
 
563
+ #: ../lib/yasr-ajax-functions.php:353
564
  msgid "Insert Multiset:"
565
  msgstr ""
566
 
567
+ #: ../lib/yasr-ajax-functions.php:366
568
+ msgid "Top 10 overall ratings"
569
  msgstr ""
570
 
571
+ #: ../lib/yasr-ajax-functions.php:368
572
+ msgid "Insert Top 10 highest rated by post author"
573
  msgstr ""
574
 
575
+ #: ../lib/yasr-ajax-functions.php:372
576
+ msgid "Top 10 by visitors"
 
 
577
  msgstr ""
578
 
579
+ #: ../lib/yasr-ajax-functions.php:374
580
+ msgid "Insert Top 10 most or higher rated posts from visitors"
581
  msgstr ""
582
 
583
+ #: ../lib/yasr-ajax-functions.php:378
584
+ msgid "Most active reviewers"
585
  msgstr ""
586
 
587
+ #: ../lib/yasr-ajax-functions.php:380
588
+ msgid "Insert Top 5 active reviewers"
589
+ msgstr ""
590
+
591
+ #: ../lib/yasr-ajax-functions.php:384
592
+ msgid "Most active users"
593
+ msgstr ""
594
+
595
+ #: ../lib/yasr-ajax-functions.php:386
596
+ msgid "Insert Top 10 active users in visitor ratings"
597
  msgstr ""
598
 
599
+ #: ../lib/yasr-ajax-functions.php:515
600
  msgid "Reviews and visitor votes have been successfull imported."
601
  msgstr ""
602
 
603
+ #: ../lib/yasr-ajax-functions.php:521
604
  msgid ""
605
  "Step2: I will check if you used multiple set and if so I will import it. "
606
  "THIS MAY TAKE A WHILE!"
607
  msgstr ""
608
 
609
+ #: ../lib/yasr-ajax-functions.php:523
610
  msgid "Proceed Step 2"
611
  msgstr ""
612
 
613
+ #: ../lib/yasr-ajax-functions.php:530
614
  msgid "Something goes wrong! Refresh the page and try again!"
615
  msgstr ""
616
 
617
+ #: ../lib/yasr-ajax-functions.php:559
618
  msgid "I've found multiple set! Importing..."
619
  msgstr ""
620
 
621
+ #: ../lib/yasr-ajax-functions.php:568
622
  msgid "Multi set's name has been successfull imported."
623
  msgstr ""
624
 
625
+ #: ../lib/yasr-ajax-functions.php:570
626
  msgid "Now I'm going to import multi set data"
627
  msgstr ""
628
 
629
+ #: ../lib/yasr-ajax-functions.php:581
630
  msgid "All votes has been successfull imported."
631
  msgstr ""
632
 
633
+ #: ../lib/yasr-ajax-functions.php:584
634
  msgid "Done"
635
  msgstr ""
636
 
637
+ #: ../lib/yasr-ajax-functions.php:589
638
  msgid "I've found multiple set votes but I couldn't insert into db"
639
  msgstr ""
640
 
641
+ #: ../lib/yasr-ajax-functions.php:597
642
  msgid "I've found multi set but with no data"
643
  msgstr ""
644
 
645
+ #: ../lib/yasr-ajax-functions.php:606
646
  msgid "I've found multi set name but I couldn't insert into db"
647
  msgstr ""
648
 
649
+ #: ../lib/yasr-ajax-functions.php:614
650
  msgid "Multiset was not found. Imported is done!"
651
  msgstr ""
652
 
653
+ #: ../lib/yasr-ajax-functions.php:880 ../lib/yasr-ajax-functions.php:885
 
 
 
 
654
  msgid "Vote Saved"
655
  msgstr ""
656
 
657
+ #: ../lib/yasr-ajax-functions.php:880 ../lib/yasr-ajax-functions.php:916
658
+ #: ../lib/yasr-ajax-functions.php:923
659
  msgid "votes casts"
660
  msgstr ""
661
 
662
+ #: ../lib/yasr-ajax-functions.php:885
663
+ msgid "vote cast"
664
+ msgstr ""
665
+
666
+ #: ../lib/yasr-ajax-functions.php:1043
667
+ msgid ""
668
+ "You don't have any user votes stored, or they're not enought. In order to "
669
+ "appear in this chart, post must have at least 2 votes. Post whith less than "
670
+ "2 vote are ignored"
671
  msgstr ""
lib/yasr-ajax-functions.php CHANGED
@@ -320,6 +320,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
320
  ?>
321
 
322
  <div id="yasr-form">
 
323
  <table id="yasr-table" class="form-table">
324
  <tr>
325
  <th><label for="yasr-overall"><?php _e("Overall Rating / Review"); ?></label></th>
@@ -367,6 +368,12 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
367
  <small><?php _e("Insert Top 10 highest rated by post author"); ?></small></td>
368
  </tr>
369
 
 
 
 
 
 
 
370
  <tr>
371
  <th><label for="yasr-5-active-reviewers"><?php _e("Most active reviewers"); ?></label></th>
372
  <td><input type="button" class="button-primary" name="yasr-5-active-reviewers" id="yasr-5-active-reviewers" value="Insert Top 5 most active reviewers"/><br />
@@ -383,6 +390,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
383
  </div>
384
 
385
  <script>
 
386
  // Add shortcode for overall rating
387
  jQuery('#yasr-overall').on("click", function(){
388
  var shortcode = '[yasr_overall_rating]';
@@ -444,6 +452,15 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
444
  jQuery('#yasr-form').dialog('close');
445
  });
446
 
 
 
 
 
 
 
 
 
 
447
  // Add shortcode for top 5 active reviewer
448
  jQuery('#yasr-5-active-reviewers').on("click", function(){
449
  var shortcode = '[yasr_top_5_reviewers]';
@@ -704,10 +721,13 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
704
 
705
  else {
706
  echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
 
707
  }
708
 
709
  }
710
 
 
 
711
  }
712
 
713
  else {
@@ -911,4 +931,122 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
911
  } //End callback function
912
 
913
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
914
  ?>
320
  ?>
321
 
322
  <div id="yasr-form">
323
+
324
  <table id="yasr-table" class="form-table">
325
  <tr>
326
  <th><label for="yasr-overall"><?php _e("Overall Rating / Review"); ?></label></th>
368
  <small><?php _e("Insert Top 10 highest rated by post author"); ?></small></td>
369
  </tr>
370
 
371
+ <tr>
372
+ <th><label for="yasr-10-highest-most-rated"><?php _e("Top 10 by visitors"); ?></label></th>
373
+ <td><input type="button" class="button-primary" name="yasr-10-highest-most-rated" id="yasr-10-highest-most-rated" value="Insert Top 10 posts by visitors"/><br />
374
+ <small><?php _e("Insert Top 10 most or higher rated posts from visitors"); ?></small></td>
375
+ </tr>
376
+
377
  <tr>
378
  <th><label for="yasr-5-active-reviewers"><?php _e("Most active reviewers"); ?></label></th>
379
  <td><input type="button" class="button-primary" name="yasr-5-active-reviewers" id="yasr-5-active-reviewers" value="Insert Top 5 most active reviewers"/><br />
390
  </div>
391
 
392
  <script>
393
+
394
  // Add shortcode for overall rating
395
  jQuery('#yasr-overall').on("click", function(){
396
  var shortcode = '[yasr_overall_rating]';
452
  jQuery('#yasr-form').dialog('close');
453
  });
454
 
455
+ // Add shortcode for 10 highest most rated
456
+ jQuery('#yasr-10-highest-most-rated').on("click", function(){
457
+ var shortcode = '[yasr_most_or_highest_rated_posts]';
458
+ // inserts the shortcode into the active editor
459
+ tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
460
+ // closes jqueryui
461
+ jQuery('#yasr-form').dialog('close');
462
+ });
463
+
464
  // Add shortcode for top 5 active reviewer
465
  jQuery('#yasr-5-active-reviewers').on("click", function(){
466
  var shortcode = '[yasr_top_5_reviewers]';
721
 
722
  else {
723
  echo "<button class=\"yasr-log-page-num\" value=\"$i\">$i</button>&nbsp;&nbsp;";
724
+
725
  }
726
 
727
  }
728
 
729
+ echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
730
+
731
  }
732
 
733
  else {
931
  } //End callback function
932
 
933
 
934
+ /****** Order yasr_multi_chart ******/
935
+
936
+ add_action ( 'wp_ajax_yasr_multi_chart_most_highest', 'yasr_multi_chart_most_highest_callback' );
937
+ add_action ( 'wp_ajax_nopriv_yasr_multi_chart_most_highest', 'yasr_multi_chart_most_highest_callback' );
938
+
939
+ function yasr_multi_chart_most_highest_callback () {
940
+
941
+ global $wpdb;
942
+
943
+ $chart_type = 'most'; //default value;
944
+
945
+ if (isset($_POST['order_by'])) {
946
+
947
+ $chart_type = $_POST['order_by'];
948
+
949
+ if ($chart_type != 'most' && $chart_type != 'highest') {
950
+
951
+ $chart_type = 'most';
952
+
953
+ }
954
+
955
+ }
956
+
957
+ if ($chart_type === 'most' ) {
958
+
959
+ $query_result_most_rated = $wpdb->get_results("SELECT post_id, number_of_votes, sum_votes
960
+ FROM " . YASR_VOTES_TABLE . ", $wpdb->posts AS p
961
+ WHERE post_id = p.ID
962
+ AND p.post_status = 'publish'
963
+ ORDER BY number_of_votes DESC, sum_votes DESC LIMIT 10");
964
+
965
+ if ($query_result_most_rated) {
966
+
967
+ echo ( "<table class=\"yasr-most-or-highest-rated-posts\">
968
+ <tr>
969
+ <th>Post / Page</th>
970
+ <th>Order By:&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_link_to_nothing\">Most Rated</a> | <a href=\"#\" id=\"yasr_multi_chart_highest\">Highest Rated</a></th>
971
+ </tr>"
972
+ );
973
+
974
+ foreach ($query_result_most_rated as $result) {
975
+
976
+ $rating = $result->sum_votes / $result->number_of_votes;
977
+
978
+ $rating = round($rating, 1);
979
+
980
+ $post_title = get_the_title($result->post_id);
981
+
982
+ $link = get_permalink($result->post_id); //Get permalink from post it
983
+
984
+ echo ( "<tr>
985
+ <td width=\"60%\"><a href=\"$link\">$post_title</a></td>
986
+ <td width=\"40%\"><div id=\"yasr_visitor_votes\"><div class=\"rateit charts\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
987
+ <br /> [" . __("Total:" , "yasr") . "$result->number_of_votes &nbsp;&nbsp;&nbsp;" . __("Average" , "yasr") . " $rating]</td>
988
+ </tr>"
989
+
990
+ );
991
+
992
+
993
+ } //End foreach
994
+
995
+ echo ("</table>") ;
996
+
997
+ } //End if $query_result_most_rated)
998
+
999
+ } // End if ($chart_type === 'most' )
1000
+
1001
+ elseif ($chart_type ==='highest') {
1002
+
1003
+ $query_result_highest = $wpdb->get_results("SELECT (sum_votes / number_of_votes) as result, post_id, number_of_votes
1004
+ FROM " . YASR_VOTES_TABLE . ", $wpdb->posts AS p
1005
+ WHERE post_id = p.ID
1006
+ AND number_of_votes >= 2
1007
+ AND p.post_status = 'publish'
1008
+ ORDER BY result DESC, number_of_votes DESC LIMIT 10
1009
+ ");
1010
+
1011
+ if ($query_result_highest) {
1012
+
1013
+ echo ( "<table class=\"yasr-most-or-highest-rated-posts\">
1014
+ <tr>
1015
+ <th>Post / Page</th>
1016
+ <th>Order By:&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_most\">Most Rated</a> | <a href=\"#\" id=\"yasr_multi_chart_link_to_nothing\">Highest Rated</a></th>
1017
+ </tr>"
1018
+
1019
+ );
1020
+
1021
+ foreach ($query_result_highest as $result) {
1022
+
1023
+ $rating = round($result->result, 1);
1024
+
1025
+ $post_title = get_the_title($result->post_id);
1026
+
1027
+ $link = get_permalink($result->post_id); //Get permalink from post it
1028
+
1029
+ echo ("<tr>
1030
+ <td width=\"60%\"><a href=\"$link\">$post_title</a></td>
1031
+ <td width=\"40%\"><div id=\"yasr_visitor_votes\"><div class=\"rateit charts\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
1032
+ <br /> [" . __("Total:" , "yasr") . "$result->number_of_votes &nbsp;&nbsp;&nbsp;" . __("Average" , "yasr") . " $rating]</td>
1033
+ </tr>");
1034
+
1035
+
1036
+ } //End foreach
1037
+
1038
+ echo "</table>";
1039
+
1040
+ } //end if $query_result
1041
+
1042
+ else {
1043
+ _e("You don't have any user votes stored, or they're not enought. In order to appear in this chart, post must have at least 2 votes. Post whith less than 2 vote are ignored", "yasr");
1044
+ }
1045
+
1046
+ } //End if ($chart_type ==='highest')
1047
+
1048
+ die();
1049
+
1050
+ } //End function
1051
+
1052
  ?>
lib/yasr-db-functions.php CHANGED
@@ -81,6 +81,7 @@ function yasr_install() {
81
  $option['auto_insert_enabled'] = 0;
82
  $option['auto_insert_what'] = 'overall_rating';
83
  $option['auto_insert_where'] = 'top';
 
84
  $option['show_overall_in_loop'] = 'disabled';
85
  $option['text_before_stars'] = 0;
86
  $option['snippet'] = 'overall_rating';
@@ -277,10 +278,13 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
277
 
278
  else {
279
  echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
 
280
  }
281
 
282
  }
283
 
 
 
284
  }
285
 
286
  else {
@@ -301,7 +305,7 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
301
 
302
  echo "...&nbsp;&nbsp;<button class=\"yasr-log-pagenum\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
303
 
304
- echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
305
 
306
  }
307
 
@@ -329,7 +333,7 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
329
  };
330
 
331
  jQuery.post(ajaxurl, data, function(response) {
332
- jQuery('yasr-loader-log-metabox').hide();
333
  jQuery('#yasr-log-container').html(response);
334
  });
335
 
@@ -347,8 +351,7 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
347
  };
348
 
349
  jQuery.post(ajaxurl, data, function(response) {
350
- jQuery('yasr-loader-log-metabox').hide();
351
- jQuery('#yasr-log-container').html(response);
352
  });
353
 
354
  });
81
  $option['auto_insert_enabled'] = 0;
82
  $option['auto_insert_what'] = 'overall_rating';
83
  $option['auto_insert_where'] = 'top';
84
+ $option['auto_insert_exclude_pages'] = 'yes';
85
  $option['show_overall_in_loop'] = 'disabled';
86
  $option['text_before_stars'] = 0;
87
  $option['snippet'] = 'overall_rating';
278
 
279
  else {
280
  echo "<button class=\"yasr-log-pagenum\" value=\"$i\">$i</button>&nbsp;&nbsp;";
281
+
282
  }
283
 
284
  }
285
 
286
+ echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
287
+
288
  }
289
 
290
  else {
305
 
306
  echo "...&nbsp;&nbsp;<button class=\"yasr-log-pagenum\" value=\"$num_of_pages\">Last &raquo;</button>&nbsp;&nbsp;";
307
 
308
+ echo "<span id=\"yasr-loader-log-metabox\" style=\"display:none;\">&nbsp;<img src=\"" . YASR_IMG_DIR . "/loader.gif\" ></span>";
309
 
310
  }
311
 
333
  };
334
 
335
  jQuery.post(ajaxurl, data, function(response) {
336
+ jQuery('#yasr-loader-log-metabox').hide();
337
  jQuery('#yasr-log-container').html(response);
338
  });
339
 
351
  };
352
 
353
  jQuery.post(ajaxurl, data, function(response) {
354
+ jQuery('#yasr-log-container').html(response); //This will hide the loader gif too
 
355
  });
356
 
357
  });
lib/yasr-functions.php CHANGED
@@ -82,7 +82,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
82
  /****** Create 2 metaboxes in post and pages ******/
83
 
84
  add_action( 'add_meta_boxes', 'yasr_add_metaboxes' );
85
-
86
  function yasr_add_metaboxes() {
87
  $post_type_where_display_metabox=array('post', 'page');
88
  $multi_set=yasr_get_multi_set();
@@ -135,36 +135,46 @@ function overall_rating_auto_insert_code () {
135
 
136
  $option = get_option( 'yasr_general_options' );
137
 
138
- if($option['text_before_stars'] == 1 && $option['text_before_overall'] != '') {
139
- $shortcode_html = "<div class=\"yasr-container-custom-text-and-overall\">
140
- <span id=\"yasr-custom-text-before-overall\">$option[text_before_overall]</span>
141
- <div class=\"rateit bigstars\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
142
- </div>
143
- </div>";
 
 
 
 
 
 
 
 
 
144
  }
145
 
146
- else {
 
147
 
148
- $shortcode_html="<div class=\"rateit bigstars\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
149
- </div>";
150
 
151
- }
 
 
152
 
153
- //IF show overall rating in loop is disabled use is_singular && is_main query
154
- if ($option['show_overall_in_loop'] === 'disabled') {
155
 
156
- if( is_singular() && is_main_query() ) {
 
157
 
158
  return $shortcode_html;
159
 
160
  }
161
 
162
- }
163
 
164
- //else don't
165
- elseif ($option['show_overall_in_loop'] === 'enabled') {
166
 
167
- return $shortcode_html;
168
 
169
  }
170
 
@@ -178,72 +188,94 @@ is called and have initial different conditions ******/
178
 
179
  function visitor_votes_auto_insert_code () {
180
 
181
- $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
 
 
182
 
183
- if( is_singular() && is_main_query() ) {
184
 
185
- $ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
186
 
187
- $votes=yasr_get_visitor_votes();
188
 
189
- $medium_rating=0; //Avoid undefined variable
190
 
191
- if (!$votes) {
192
- $votes=0; //Avoid undefined variable if there is not overall rating
193
- $votes_number=0; //Avoid undefined variable
194
- }
195
 
196
- else {
197
- foreach ($votes as $user_votes) {
198
- $votes_number = $user_votes->number_of_votes;
199
- if ($votes_number !=0 ) {
200
- $medium_rating = ($user_votes->sum_votes/$votes_number);
 
 
 
 
 
 
201
  }
202
  }
203
- }
204
 
205
- $option = get_option( 'yasr_general_options' );
206
 
207
- if ( !$option ) {
208
- $allow_logged_option = array();
209
- $allow_logged_option['allowed_user']='allow_anonymous';
210
- }
211
 
212
- else {
213
- $allow_logged_option = $option;
214
- }
215
 
216
- $image = YASR_IMG_DIR . "/loader.gif";
217
 
218
- $loader_html = "<div id=\"loader-visitor-rating\" >&nbsp; " . __("Loading, please wait","yasr") . " <img src= \" $image \"></div>";
219
 
220
- $medium_rating=round($medium_rating, 1);
221
 
222
 
223
- //if anonymous are allowed to vote
224
- if ($allow_logged_option['allowed_user']==='allow_anonymous') {
225
 
226
- //I've to block a logged in user that has already rated
227
- if ( is_user_logged_in() ) {
228
 
229
- //Chek if a logged in user has already rated for this post
230
- $vote_if_user_already_rated = yasr_check_if_user_already_voted();
231
 
232
- //If user has already rated show readonly stars
233
- if ($vote_if_user_already_rated) {
234
 
235
- global $current_user;
236
- get_currentuserinfo();
237
 
238
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes_logged_rated\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
239
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
240
 
241
- }
242
 
243
- //else logged user can vote
244
- else {
 
 
 
 
 
 
 
245
 
246
- $vote_if_user_already_rated = 0;
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  if ($votes_number>0) {
249
  $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
@@ -255,178 +287,168 @@ function visitor_votes_auto_insert_code () {
255
  </div><br /> " . __("No rating yet" , "yasr") . "</div>";
256
  }
257
 
258
- } //End else
 
 
259
 
260
- } //End if user is logged
261
 
262
 
263
- //else is not logged can vote
264
- else {
265
 
266
- if ($votes_number>0) {
267
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
268
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
269
- }
270
 
271
- else {
272
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
273
- </div><br /> " . __("No rating yet" , "yasr") . "</div>";
274
- }
275
 
276
- } //end else
277
-
278
- } //end if ($allow_logged_option['allowed_user']==='allow_anonymous') {
279
 
 
 
280
 
 
 
281
 
282
- //If only logged in users can vote
283
- elseif ($allow_logged_option['allowed_user']==='logged_only') {
284
 
285
- //If user is logged in and can vote
286
- if ( is_user_logged_in() ) {
287
 
288
- //Chek if a logged in user has already rated for this post
289
- $vote_if_user_already_rated = yasr_check_if_user_already_voted();
 
 
290
 
291
- if ($vote_if_user_already_rated) {
 
 
 
292
 
293
- global $current_user;
294
- get_currentuserinfo();
295
 
296
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes_logged_rated\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
297
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
298
 
299
- }
300
 
 
301
  else {
302
 
303
  if ($votes_number>0) {
304
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
305
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
306
  }
307
 
308
  else {
309
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
310
- </div><br /> " . __("No rating yet" , "yasr") . "</div>";
311
  }
312
 
313
  }
 
 
314
 
315
 
316
- } //End if user is logged in
 
 
 
317
 
318
- //Else mean user is not logged in
319
- else {
320
 
321
- if ($votes_number>0) {
322
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
323
- </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br />" . __("You must sign to vote", "yasr") . "</div>";
324
- }
325
 
326
- else {
327
- $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
328
- </div><br /> " . __("No rating yet" , "yasr") . "<br />" . __("You must sign to vote", "") . "</div>";
329
- }
330
 
331
- }
332
-
333
- } //end ($allow_logged_option['allowed_user']==='logged_only')
334
 
 
 
335
 
336
- if($option['text_before_stars'] == 1 && $option['text_before_visitor_rating'] != '') {
337
-
338
- $shortcode_html_tmp = "<div class=\"yasr-container-custom-text-and-visitor-rating\">
339
- <div id=\"yasr-custom-text-before-visitor-rating\">$option[text_before_visitor_rating]</div>" . $shortcode_html . "</div>";
340
 
341
- $shortcode_html = $shortcode_html_tmp;
342
 
343
- }
 
 
344
 
 
345
 
346
- ?>
 
347
 
348
- <script>
349
- jQuery(document).ready(function() {
350
 
351
- var logged_message_showed = false;
 
352
 
353
- logged_message_showed = jQuery("#yasr_rateit_visitor_votes_logged_rated").attr("data-rateit-value");
 
 
 
 
354
 
355
- if (logged_message_showed) {
356
- logged_message_showed = true;
357
- }
358
 
359
-
 
 
 
 
 
360
 
361
- var tooltipvalues = ['bad', 'poor', 'ok', 'good', 'super'];
362
- jQuery("#yasr_rateit_visitor_votes").bind('over', function (event, value) { jQuery(this).attr('title', tooltipvalues[value-1]); });
363
-
364
- var postid = <?php the_ID(); ?>;
365
- var cookiename = "yasr_visitor_vote_" + postid;
366
-
367
- //If there is not cookie allow visitor to vote
368
- if (!jQuery.cookie(cookiename)) {
369
-
370
- jQuery('#yasr_rateit_visitor_votes').on('rated', function() {
371
- var el = jQuery(this);
372
- var value = el.rateit('value');
373
- var value = value.toFixed(1); //
374
- var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
375
-
376
- jQuery('#yasr_visitor_votes').html( ' <?php echo "$loader_html" ?> ');
377
-
378
- var data = {
379
- action: 'yasr_send_visitor_rating',
380
- rating: value,
381
- post_id: postid,
382
- nonce_visitor: "<?php echo "$ajax_nonce_visitor"; ?>"
383
- };
384
-
385
- //Send value to the Server
386
- jQuery.post(ajaxurl, data, function(response) {
387
- jQuery('#yasr_visitor_votes').html(response);
388
- jQuery('.rateit').rateit();
389
- //Create a cookie to disable double vote
390
- jQuery.cookie(cookiename, value, { expires : 360 });
391
- }) ;
392
- });
393
- } //End if (!jQuery.cookie(cookiename))
394
-
395
- //Else user cannot vote
396
- else {
397
 
398
- //if php read only stars are not be showes echo readonly stars from cookie
399
- if (!logged_message_showed) {
400
 
401
- var cookievote=jQuery.cookie(cookiename);
402
- var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
 
404
- var data = {
405
- action: 'yasr_readonly_visitor_shortcode',
406
- rating: cookievote,
407
- votes: <?php echo $medium_rating ?>,
408
- votes_number: <?php echo $votes_number ?>,
409
- post_id: postid
410
  }
411
 
412
- jQuery.post(ajaxurl, data, function(response) {
413
- jQuery('#yasr_visitor_votes').html(response);
414
- jQuery('.rateit').rateit();
415
- });
416
 
417
- }
418
 
419
- } //End else !logged_user_already_rated)
420
 
421
- });
422
 
423
- </script>
 
 
424
 
425
- <?php
426
 
427
- return $shortcode_html;
428
 
429
- } //End if is singular
 
 
430
 
431
  } //End function shortcode_visitor_votes_callback
432
 
@@ -518,7 +540,7 @@ function visitor_votes_auto_insert_code () {
518
  if(is_singular() && is_main_query() ) {
519
  global $post;
520
 
521
- $div = "<div itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\">";
522
  $title = "<span itemprop=\"about\">". get_the_title() ."</span>";
523
  $author = __(' reviewed by ', 'yasr') . "<span itemprop=\"author\">" . get_the_author() . "</span>";
524
  $date = __(' on ', 'yasr') . "<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date();
@@ -550,7 +572,7 @@ function visitor_votes_auto_insert_code () {
550
 
551
  $average_rating=round($average_rating, 1);
552
 
553
- $div_1 = "<div itemscope itemtype=\"http://schema.org/Product\">";
554
  $title = "<span itemprop=\"name\">". get_the_title() ."</span>";
555
  $span_1 = "<span itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">";
556
  $rating = __( ' rated ' , 'yasr' ) . "<span itemprop=\"ratingValue\">" . $average_rating . "</span>" . __(' out of ' ,'yasr') . "<span itemprop=\"bestRating\">5</span>";
82
  /****** Create 2 metaboxes in post and pages ******/
83
 
84
  add_action( 'add_meta_boxes', 'yasr_add_metaboxes' );
85
+
86
  function yasr_add_metaboxes() {
87
  $post_type_where_display_metabox=array('post', 'page');
88
  $multi_set=yasr_get_multi_set();
135
 
136
  $option = get_option( 'yasr_general_options' );
137
 
138
+ if ($option['auto_insert_exclude_pages'] === 'no') {
139
+
140
+ if($option['text_before_stars'] == 1 && $option['text_before_overall'] != '') {
141
+ $shortcode_html = "<div class=\"yasr-container-custom-text-and-overall\">
142
+ <span id=\"yasr-custom-text-before-overall\">$option[text_before_overall]</span>
143
+ <div class=\"rateit bigstars\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
144
+ </div>
145
+ </div>";
146
+ }
147
+
148
+ else {
149
+
150
+ $shortcode_html="<div class=\"rateit bigstars\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
151
+ </div>";
152
+
153
  }
154
 
155
+ //IF show overall rating in loop is disabled use is_singular && is_main query
156
+ if ($option['show_overall_in_loop'] === 'disabled') {
157
 
158
+ if( is_singular() && is_main_query() ) {
 
159
 
160
+ return $shortcode_html;
161
+
162
+ }
163
 
164
+ }
 
165
 
166
+ //else don't
167
+ elseif ($option['show_overall_in_loop'] === 'enabled') {
168
 
169
  return $shortcode_html;
170
 
171
  }
172
 
173
+ } // End if ($option['auto_insert_exclude_pages'] === 'no') {
174
 
175
+ elseif ($option['auto_insert_exclude_pages'] === 'yes') {
 
176
 
177
+ return NULL;
178
 
179
  }
180
 
188
 
189
  function visitor_votes_auto_insert_code () {
190
 
191
+ $option = get_option( 'yasr_general_options' );
192
+
193
+ if ($option['auto_insert_exclude_pages'] === 'no') {
194
 
195
+ $shortcode_html = NULL; //Avoid undefined variable outside is_singular && is_main_query
196
 
197
+ if( is_singular() && is_main_query() ) {
198
 
199
+ $ajax_nonce_visitor = wp_create_nonce( "yasr_nonce_insert_visitor_rating" );
200
 
201
+ $votes=yasr_get_visitor_votes();
202
 
203
+ $medium_rating=0; //Avoid undefined variable
 
 
 
204
 
205
+ if (!$votes) {
206
+ $votes=0; //Avoid undefined variable if there is not overall rating
207
+ $votes_number=0; //Avoid undefined variable
208
+ }
209
+
210
+ else {
211
+ foreach ($votes as $user_votes) {
212
+ $votes_number = $user_votes->number_of_votes;
213
+ if ($votes_number !=0 ) {
214
+ $medium_rating = ($user_votes->sum_votes/$votes_number);
215
+ }
216
  }
217
  }
 
218
 
219
+ $option = get_option( 'yasr_general_options' );
220
 
221
+ if ( !$option ) {
222
+ $allow_logged_option = array();
223
+ $allow_logged_option['allowed_user']='allow_anonymous';
224
+ }
225
 
226
+ else {
227
+ $allow_logged_option = $option;
228
+ }
229
 
230
+ $image = YASR_IMG_DIR . "/loader.gif";
231
 
232
+ $loader_html = "<div id=\"loader-visitor-rating\" >&nbsp; " . __("Loading, please wait","yasr") . " <img src= \" $image \"></div>";
233
 
234
+ $medium_rating=round($medium_rating, 1);
235
 
236
 
237
+ //if anonymous are allowed to vote
238
+ if ($allow_logged_option['allowed_user']==='allow_anonymous') {
239
 
240
+ //I've to block a logged in user that has already rated
241
+ if ( is_user_logged_in() ) {
242
 
243
+ //Chek if a logged in user has already rated for this post
244
+ $vote_if_user_already_rated = yasr_check_if_user_already_voted();
245
 
246
+ //If user has already rated show readonly stars
247
+ if ($vote_if_user_already_rated) {
248
 
249
+ global $current_user;
250
+ get_currentuserinfo();
251
 
252
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes_logged_rated\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
253
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
254
 
255
+ }
256
 
257
+ //else logged user can vote
258
+ else {
259
+
260
+ $vote_if_user_already_rated = 0;
261
+
262
+ if ($votes_number>0) {
263
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
264
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
265
+ }
266
 
267
+ else {
268
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
269
+ </div><br /> " . __("No rating yet" , "yasr") . "</div>";
270
+ }
271
+
272
+ } //End else
273
+
274
+ } //End if user is logged
275
+
276
+
277
+ //else is not logged can vote
278
+ else {
279
 
280
  if ($votes_number>0) {
281
  $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
287
  </div><br /> " . __("No rating yet" , "yasr") . "</div>";
288
  }
289
 
290
+ } //end else
291
+
292
+ } //end if ($allow_logged_option['allowed_user']==='allow_anonymous') {
293
 
 
294
 
295
 
296
+ //If only logged in users can vote
297
+ elseif ($allow_logged_option['allowed_user']==='logged_only') {
298
 
299
+ //If user is logged in and can vote
300
+ if ( is_user_logged_in() ) {
 
 
301
 
302
+ //Chek if a logged in user has already rated for this post
303
+ $vote_if_user_already_rated = yasr_check_if_user_already_voted();
 
 
304
 
305
+ if ($vote_if_user_already_rated) {
 
 
306
 
307
+ global $current_user;
308
+ get_currentuserinfo();
309
 
310
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes_logged_rated\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
311
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
312
 
313
+ }
 
314
 
315
+ else {
 
316
 
317
+ if ($votes_number>0) {
318
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
319
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
320
+ }
321
 
322
+ else {
323
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
324
+ </div><br /> " . __("No rating yet" , "yasr") . "</div>";
325
+ }
326
 
327
+ }
 
328
 
 
 
329
 
330
+ } //End if user is logged in
331
 
332
+ //Else mean user is not logged in
333
  else {
334
 
335
  if ($votes_number>0) {
336
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
337
+ </div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br />" . __("You must sign to vote", "yasr") . "</div>";
338
  }
339
 
340
  else {
341
+ $shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
342
+ </div><br /> " . __("No rating yet" , "yasr") . "<br />" . __("You must sign to vote", "") . "</div>";
343
  }
344
 
345
  }
346
+
347
+ } //end ($allow_logged_option['allowed_user']==='logged_only')
348
 
349
 
350
+ if($option['text_before_stars'] == 1 && $option['text_before_visitor_rating'] != '') {
351
+
352
+ $shortcode_html_tmp = "<div class=\"yasr-container-custom-text-and-visitor-rating\">
353
+ <div id=\"yasr-custom-text-before-visitor-rating\">$option[text_before_visitor_rating]</div>" . $shortcode_html . "</div>";
354
 
355
+ $shortcode_html = $shortcode_html_tmp;
 
356
 
357
+ }
 
 
 
358
 
 
 
 
 
359
 
360
+ ?>
 
 
361
 
362
+ <script>
363
+ jQuery(document).ready(function() {
364
 
365
+ var logged_message_showed = false;
 
 
 
366
 
367
+ logged_message_showed = jQuery("#yasr_rateit_visitor_votes_logged_rated").attr("data-rateit-value");
368
 
369
+ if (logged_message_showed) {
370
+ logged_message_showed = true;
371
+ }
372
 
373
+
374
 
375
+ var tooltipvalues = ['bad', 'poor', 'ok', 'good', 'super'];
376
+ jQuery("#yasr_rateit_visitor_votes").bind('over', function (event, value) { jQuery(this).attr('title', tooltipvalues[value-1]); });
377
 
378
+ var postid = <?php the_ID(); ?>;
379
+ var cookiename = "yasr_visitor_vote_" + postid;
380
 
381
+ //If there is not cookie allow visitor to vote
382
+ if (!jQuery.cookie(cookiename)) {
383
 
384
+ jQuery('#yasr_rateit_visitor_votes').on('rated', function() {
385
+ var el = jQuery(this);
386
+ var value = el.rateit('value');
387
+ var value = value.toFixed(1); //
388
+ var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
389
 
390
+ jQuery('#yasr_visitor_votes').html( ' <?php echo "$loader_html" ?> ');
 
 
391
 
392
+ var data = {
393
+ action: 'yasr_send_visitor_rating',
394
+ rating: value,
395
+ post_id: postid,
396
+ nonce_visitor: "<?php echo "$ajax_nonce_visitor"; ?>"
397
+ };
398
 
399
+ //Send value to the Server
400
+ jQuery.post(ajaxurl, data, function(response) {
401
+ jQuery('#yasr_visitor_votes').html(response);
402
+ jQuery('.rateit').rateit();
403
+ //Create a cookie to disable double vote
404
+ jQuery.cookie(cookiename, value, { expires : 360 });
405
+ }) ;
406
+ });
407
+ } //End if (!jQuery.cookie(cookiename))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
 
409
+ //Else user cannot vote
410
+ else {
411
 
412
+ //if php read only stars are not be showes echo readonly stars from cookie
413
+ if (!logged_message_showed) {
414
+
415
+ var cookievote=jQuery.cookie(cookiename);
416
+ var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
417
+
418
+ var data = {
419
+ action: 'yasr_readonly_visitor_shortcode',
420
+ rating: cookievote,
421
+ votes: <?php echo $medium_rating ?>,
422
+ votes_number: <?php echo $votes_number ?>,
423
+ post_id: postid
424
+ }
425
+
426
+ jQuery.post(ajaxurl, data, function(response) {
427
+ jQuery('#yasr_visitor_votes').html(response);
428
+ jQuery('.rateit').rateit();
429
+ });
430
 
 
 
 
 
 
 
431
  }
432
 
433
+ } //End else !logged_user_already_rated)
 
 
 
434
 
435
+ });
436
 
437
+ </script>
438
 
439
+ <?php
440
 
441
+ return $shortcode_html;
442
+
443
+ } //End if is singular
444
 
445
+ } // End if ($option['auto_insert_exclude_pages'] === 'no')
446
 
447
+ elseif ($option['auto_insert_exclude_pages'] === 'yes') {
448
 
449
+ return NULL;
450
+
451
+ }
452
 
453
  } //End function shortcode_visitor_votes_callback
454
 
540
  if(is_singular() && is_main_query() ) {
541
  global $post;
542
 
543
+ $div = "<div class=\"yasr_schema\" itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\">";
544
  $title = "<span itemprop=\"about\">". get_the_title() ."</span>";
545
  $author = __(' reviewed by ', 'yasr') . "<span itemprop=\"author\">" . get_the_author() . "</span>";
546
  $date = __(' on ', 'yasr') . "<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date();
572
 
573
  $average_rating=round($average_rating, 1);
574
 
575
+ $div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Product\">";
576
  $title = "<span itemprop=\"name\">". get_the_title() ."</span>";
577
  $span_1 = "<span itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">";
578
  $rating = __( ' rated ' , 'yasr' ) . "<span itemprop=\"ratingValue\">" . $average_rating . "</span>" . __(' out of ' ,'yasr') . "<span itemprop=\"bestRating\">5</span>";
lib/yasr-settings-functions.php CHANGED
@@ -17,6 +17,7 @@
17
  if ($option && $option['auto_insert_enabled']==0) {
18
  $option['auto_insert_what']='overall_rating';
19
  $option['auto_insert_where']='top';
 
20
  }
21
 
22
  //This is to avoid undefined offset
@@ -27,7 +28,7 @@
27
  }
28
 
29
  add_settings_section( 'yasr_general_options_section_id', __('General settings', 'yasr'), 'yasr_section_callback', 'yasr_settings_page' );
30
- add_settings_field( 'yasr_use_auto_insert_id', __('Use auto insert?', 'yasr'), 'yasr_auto_insert_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option );
31
  add_settings_field( 'yasr_show_overall_in_loop', __('Show overall rating in Home Page?', 'yasr'), 'yasr_show_overall_in_loop_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option);
32
  add_settings_field( 'yasr_custom_text', __('Insert custom text to show before / after stars', 'yasr'), 'yasr_custom_text_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option);
33
  add_settings_field( 'yasr_color_scheme', __('Which color scheme do you want to use?', 'yasr') , 'yasr_color_scheme_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option);
@@ -45,6 +46,9 @@
45
 
46
  ?>
47
 
 
 
 
48
  <input type='radio' name='yasr_general_options[auto_insert_enabled]' value='1' id='yasr_auto_insert_radio_on' <?php if ($option['auto_insert_enabled']==1) echo " checked='checked' "; ?> />
49
  <?php _e('Yes', 'yasr') ?>
50
  &nbsp;&nbsp;&nbsp;
@@ -97,6 +101,17 @@
97
 
98
  <p>&nbsp;</p>
99
 
 
 
 
 
 
 
 
 
 
 
 
100
  <hr />
101
 
102
 
17
  if ($option && $option['auto_insert_enabled']==0) {
18
  $option['auto_insert_what']='overall_rating';
19
  $option['auto_insert_where']='top';
20
+ $option['auto_insert_exclude_pages']='yes';
21
  }
22
 
23
  //This is to avoid undefined offset
28
  }
29
 
30
  add_settings_section( 'yasr_general_options_section_id', __('General settings', 'yasr'), 'yasr_section_callback', 'yasr_settings_page' );
31
+ add_settings_field( 'yasr_use_auto_insert_id', __('Auto insert otions', 'yasr'), 'yasr_auto_insert_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option );
32
  add_settings_field( 'yasr_show_overall_in_loop', __('Show overall rating in Home Page?', 'yasr'), 'yasr_show_overall_in_loop_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option);
33
  add_settings_field( 'yasr_custom_text', __('Insert custom text to show before / after stars', 'yasr'), 'yasr_custom_text_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option);
34
  add_settings_field( 'yasr_color_scheme', __('Which color scheme do you want to use?', 'yasr') , 'yasr_color_scheme_callback', 'yasr_settings_page', 'yasr_general_options_section_id', $option);
46
 
47
  ?>
48
 
49
+
50
+ <strong><?php _e('Use Auto Insert?', 'yasr'); ?></strong>
51
+ <br />
52
  <input type='radio' name='yasr_general_options[auto_insert_enabled]' value='1' id='yasr_auto_insert_radio_on' <?php if ($option['auto_insert_enabled']==1) echo " checked='checked' "; ?> />
53
  <?php _e('Yes', 'yasr') ?>
54
  &nbsp;&nbsp;&nbsp;
101
 
102
  <p>&nbsp;</p>
103
 
104
+ <strong><?php _e('Exclude Pages?', 'yasr'); ?></strong>
105
+ <br />
106
+ <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="yes" class="yasr_auto_insert_where_what_radio" <?php if ($option['auto_insert_exclude_pages']==='yes' ) echo " checked=\"checked\" "; ?> >
107
+ <?php _e('Yes', 'yasr')?>
108
+
109
+ &nbsp;&nbsp;&nbsp;
110
+
111
+ <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="no" class="yasr_auto_insert_where_what_radio" <?php if ($option['auto_insert_exclude_pages']==='no') echo " checked=\"checked\" "; ?> >
112
+ <?php _e('No', 'yasr')?>
113
+ <br />
114
+
115
  <hr />
116
 
117
 
lib/yasr-shortcode-functions.php CHANGED
@@ -418,6 +418,160 @@ function yasr_top_ten_highest_rated_callback () {
418
  } //End function
419
 
420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  /****** Add top 5 most active reviewer ******/
422
 
423
  add_shortcode ('yasr_top_5_reviewers', 'yasr_top_5_reviewers_callback');
418
  } //End function
419
 
420
 
421
+ /****** Add top 10 most rated / highest rated post *****/
422
+
423
+ add_shortcode ('yasr_most_or_highest_rated_posts', 'yasr_most_or_highest_rated_posts_callback');
424
+
425
+ function yasr_most_or_highest_rated_posts_callback () {
426
+
427
+ $chart_type = 'most'; //default value;
428
+
429
+ if (isset($_GET['yasr-order-by'])) {
430
+
431
+ $chart_type = $_GET['yasr-order-by'];
432
+
433
+ if ($chart_type != 'most' && $chart_type != 'highest') {
434
+
435
+ $chart_type = 'most';
436
+
437
+ }
438
+
439
+ }
440
+
441
+ global $wpdb;
442
+
443
+ $post_url = get_permalink();
444
+
445
+ if ($chart_type === 'most' ) {
446
+
447
+ $query_result_most_rated = $wpdb->get_results("SELECT post_id, number_of_votes, sum_votes
448
+ FROM " . YASR_VOTES_TABLE . ", $wpdb->posts AS p
449
+ WHERE post_id = p.ID
450
+ AND p.post_status = 'publish'
451
+ ORDER BY number_of_votes DESC, sum_votes DESC LIMIT 10");
452
+
453
+ if ($query_result_most_rated) {
454
+
455
+ $shortcode_html = "<div class=\"yasr_multi_chart_container\"><table class=\"yasr-most-or-highest-rated-posts\">
456
+ <tr>
457
+ <th>Post / Page</th>
458
+ <th>Order By:&nbsp;&nbsp; <a href=\"#\" id=\"yasr_multi_chart_link_to_nothing\">Most Rated</a> | <a href=\"#\" id=\"yasr_multi_chart_highest\">Highest Rated</a></th>
459
+ </tr>
460
+ </div>";
461
+
462
+ foreach ($query_result_most_rated as $result) {
463
+
464
+ $rating = $result->sum_votes / $result->number_of_votes;
465
+
466
+ $rating = round($rating, 1);
467
+
468
+ $post_title = get_the_title($result->post_id);
469
+
470
+ $link = get_permalink($result->post_id); //Get permalink from post it
471
+
472
+ $shortcode_html .= "<tr>
473
+ <td width=\"60%\"><a href=\"$link\">$post_title</a></td>
474
+ <td width=\"40%\"><div id=\"yasr_visitor_votes\"><div class=\"rateit charts\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
475
+ <br /> [" . __("Total:" , "yasr") . "$result->number_of_votes &nbsp;&nbsp;&nbsp;" . __("Average" , "yasr") . " $rating]</td>
476
+ </tr>";
477
+
478
+
479
+ } //End foreach
480
+
481
+ $shortcode_html .= "</table>";
482
+
483
+ ?>
484
+
485
+ <script>
486
+
487
+ jQuery(document).ready(function() {
488
+
489
+ //Link do nothing
490
+ jQuery('#yasr_multi_chart_link_to_nothing').on("click", function () {
491
+
492
+ return false; // prevent default click action from happening!
493
+
494
+ });
495
+
496
+ var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
497
+
498
+ //This send an ajax request to show the highest rated:
499
+ //THIS WORK ONLY ON FIRST PAGE LOAD.
500
+ jQuery('#yasr_multi_chart_highest').on("click", function () {
501
+
502
+ var data = {
503
+ order_by: 'highest',
504
+ action : 'yasr_multi_chart_most_highest' //declared in yasr-ajax-functions
505
+ };
506
+
507
+ jQuery.post(ajaxurl, data, function(response) {
508
+ jQuery('.yasr_multi_chart_container').html(response);
509
+ jQuery('.rateit').rateit();
510
+ });
511
+
512
+ return false; // prevent default click action from happening!
513
+
514
+ });
515
+
516
+
517
+ jQuery(document).ajaxComplete(function() {
518
+
519
+ //This send an ajax request to show the highest rated.
520
+ //I need this again to make it work after ajax has been called
521
+ jQuery('#yasr_multi_chart_highest').on("click", function () {
522
+
523
+ var data = {
524
+ order_by: 'highest',
525
+ action : 'yasr_multi_chart_most_highest' //declared in yasr-ajax-functions
526
+ };
527
+
528
+ jQuery.post(ajaxurl, data, function(response) {
529
+ jQuery('.yasr_multi_chart_container').html(response);
530
+ jQuery('.rateit').rateit();
531
+ });
532
+
533
+ return false; // prevent default click action from happening!
534
+
535
+ });
536
+
537
+ //This send an ajax to come back to most rated
538
+ jQuery('#yasr_multi_chart_most').on("click", function () {
539
+
540
+ var data = {
541
+ order_by: 'most',
542
+ action : 'yasr_multi_chart_most_highest' //declared in yasr-ajax-functions
543
+ };
544
+
545
+ jQuery.post(ajaxurl, data, function(response) {
546
+ jQuery('.yasr_multi_chart_container').html(response);
547
+ jQuery('.rateit').rateit();
548
+ });
549
+
550
+ return false; // prevent default click action from happening!
551
+
552
+ });
553
+
554
+ });
555
+
556
+ });
557
+
558
+ </script>
559
+
560
+ <?php
561
+
562
+ return $shortcode_html;
563
+
564
+ } //end if $query_result
565
+
566
+ else {
567
+ _e("You don't have any user votes stored", "yasr");
568
+ }
569
+
570
+ }
571
+
572
+ } //End function
573
+
574
+
575
  /****** Add top 5 most active reviewer ******/
576
 
577
  add_shortcode ('yasr_top_5_reviewers', 'yasr_top_5_reviewers_callback');
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Yasr - Yet Another Stars Rating ===
2
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8S963KJ3UW5XG
3
  Tags: Rating, Review, Star, Snippet, Rich snippet, Schema, Schema.org, Serp
4
  Requires at least: 3.5
5
  Tested up to: 3.9.1
6
- Stable tag: 0.3.7
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -46,8 +46,15 @@ If with gd-star-rating you're using a different number of stars from the default
46
  1. Example of yasr in a videogame review
47
  2. Another example of a restaurant review
48
 
 
49
  == Changelog ==
50
 
 
 
 
 
 
 
51
  = 0.3.7 =
52
  * Added new chart: Top 5 most active reviewers
53
  * Added new chart: Top 10 most active users (in visitor rating)
1
  === Yasr - Yet Another Stars Rating ===
2
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
3
  Tags: Rating, Review, Star, Snippet, Rich snippet, Schema, Schema.org, Serp
4
  Requires at least: 3.5
5
  Tested up to: 3.9.1
6
+ Stable tag: 0.3.8
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
46
  1. Example of yasr in a videogame review
47
  2. Another example of a restaurant review
48
 
49
+
50
  == Changelog ==
51
 
52
+ = 0.3.8 =
53
+ * Added new chart: Top 10 most rated / highest rated posts from visitors (show up only posts rated at least twice)
54
+ * New setting: it's possibile now to explude pages from auto insert
55
+ * Css changes
56
+ * Various bugfixes
57
+
58
  = 0.3.7 =
59
  * Added new chart: Top 5 most active reviewers
60
  * Added new chart: Top 10 most active users (in visitor rating)
yasr-settings-page.php CHANGED
@@ -82,12 +82,9 @@ if ( !current_user_can( 'manage_options' ) ) {
82
  <br />
83
  <?php _e('Thank you!'); ?>
84
  <br />
85
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
86
- <input type="hidden" name="cmd" value="_s-xclick">
87
- <input type="hidden" name="hosted_button_id" value="F3XJX2BSG3H4J">
88
- <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
89
- <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
90
- </form>
91
  </div>
92
 
93
  <div class="yasr-space-settings-div">
@@ -248,12 +245,11 @@ if ( !current_user_can( 'manage_options' ) ) {
248
  <br />
249
  <?php _e('Thank you!'); ?>
250
  <br />
251
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
252
- <input type="hidden" name="cmd" value="_s-xclick">
253
- <input type="hidden" name="hosted_button_id" value="F3XJX2BSG3H4J">
254
- <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
255
- <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
256
- </form>
257
  </div>
258
 
259
  <div class="yasr-space-settings-div">
@@ -274,12 +270,10 @@ if ( !current_user_can( 'manage_options' ) ) {
274
  <br />
275
  <?php _e('Thank you!'); ?>
276
  <br />
277
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
278
- <input type="hidden" name="cmd" value="_s-xclick">
279
- <input type="hidden" name="hosted_button_id" value="F3XJX2BSG3H4J">
280
- <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
281
- <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
282
- </form>
283
 
284
  </div>
285
 
@@ -312,13 +306,11 @@ if ( !current_user_can( 'manage_options' ) ) {
312
  jQuery('#yasr-color-scheme-preview-link').on('click', function () {
313
  jQuery('#yasr-color-scheme-preview').toggle('slow');
314
  return false; // prevent default click action from happening!
315
- preventDefault(); // prevent default click action from happening!
316
  });
317
 
318
  jQuery('#yasr-snippet-explained-link').on('click', function () {
319
  jQuery('#yasr-snippet-explained').toggle('slow');
320
  return false; // prevent default click action from happening!
321
- preventDefault(); // prevent default click action from happening!
322
  });
323
 
324
 
@@ -422,7 +414,7 @@ if ( !current_user_can( 'manage_options' ) ) {
422
  });
423
 
424
  return false; // prevent default click action from happening!
425
- preventDefault(); // same thing as above
426
 
427
  });
428
 
82
  <br />
83
  <?php _e('Thank you!'); ?>
84
  <br />
85
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC">
86
+ <?php echo("<img src=" . YASR_IMG_DIR . "/paypal.png>"); ?>
87
+ </a>
 
 
 
88
  </div>
89
 
90
  <div class="yasr-space-settings-div">
245
  <br />
246
  <?php _e('Thank you!'); ?>
247
  <br />
248
+
249
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC">
250
+ <?php echo("<img src=" . YASR_IMG_DIR . "/paypal.png>"); ?>
251
+ </a>
252
+
 
253
  </div>
254
 
255
  <div class="yasr-space-settings-div">
270
  <br />
271
  <?php _e('Thank you!'); ?>
272
  <br />
273
+
274
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC">
275
+ <?php echo("<img src=\"" . YASR_IMG_DIR . "\"/paypal.png>"); ?>
276
+ </a>
 
 
277
 
278
  </div>
279
 
306
  jQuery('#yasr-color-scheme-preview-link').on('click', function () {
307
  jQuery('#yasr-color-scheme-preview').toggle('slow');
308
  return false; // prevent default click action from happening!
 
309
  });
310
 
311
  jQuery('#yasr-snippet-explained-link').on('click', function () {
312
  jQuery('#yasr-snippet-explained').toggle('slow');
313
  return false; // prevent default click action from happening!
 
314
  });
315
 
316
 
414
  });
415
 
416
  return false; // prevent default click action from happening!
417
+ preventDefault(); // same thing as above
418
 
419
  });
420
 
yet-another-stars-rating.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Yet Another Stars Rating
4
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
  * Description: Rating system with rich snippets
6
- * Version: 0.3.7
7
  * Author: Dario Curvino
8
  * Author URI: http://profiles.wordpress.org/dudo/
9
  * License: GPL2
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
28
  */
29
 
30
 
31
- define('YASR_VERSION_NUM', '0.3.7');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
@@ -44,7 +44,7 @@ define( "YASR_LANG_DIR", YASR_RELATIVE_PATH . '/languages/' );
44
  define ("YASR_JS_DIR", plugins_url( YASR_RELATIVE_PATH . '/js/' ));
45
 
46
  //CSS directory
47
- define ("YASR_CSS_DIR", plugins_url(YASR_RELATIVE_PATH . '/css/' ));
48
 
49
  //IMG directory
50
  define ("YASR_IMG_DIR", plugins_url( YASR_RELATIVE_PATH . '/img/'));
@@ -102,6 +102,16 @@ if ($version_installed && $version_installed < '0.3.4') {
102
 
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
105
  update_option('yasr-version', YASR_VERSION_NUM);
106
 
107
  ?>
3
  * Plugin Name: Yet Another Stars Rating
4
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
  * Description: Rating system with rich snippets
6
+ * Version: 0.3.8
7
  * Author: Dario Curvino
8
  * Author URI: http://profiles.wordpress.org/dudo/
9
  * License: GPL2
28
  */
29
 
30
 
31
+ define('YASR_VERSION_NUM', '0.3.8');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
44
  define ("YASR_JS_DIR", plugins_url( YASR_RELATIVE_PATH . '/js/' ));
45
 
46
  //CSS directory
47
+ define ("YASR_CSS_DIR", plugins_url( YASR_RELATIVE_PATH . '/css/' ));
48
 
49
  //IMG directory
50
  define ("YASR_IMG_DIR", plugins_url( YASR_RELATIVE_PATH . '/img/'));
102
 
103
  }
104
 
105
+ if ($version_installed && $version_installed < '0.3.8') {
106
+
107
+ $option = get_option( 'yasr_general_options' );
108
+
109
+ $option['auto_insert_exclude_pages'] = 'yes';
110
+
111
+ update_option("yasr_general_options", $option);
112
+
113
+ }
114
+
115
  update_option('yasr-version', YASR_VERSION_NUM);
116
 
117
  ?>