Yasr – Yet Another Stars Rating - Version 2.0.3

Version Description

  • TWEAKED: some changes in settings page
  • TWEAKED: new default values for new installations.
Download this release

Release Info

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

Code changes from version 2.0.2 to 2.0.3

js/yasr-admin.js CHANGED
@@ -240,7 +240,7 @@ function YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled, textBeforeSta
240
 
241
  jQuery('.yasr-general-options-text-before').prop('disabled', false);
242
  jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
243
- jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
244
  jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
245
  jQuery('#yasr-general-options-custom-text-must-sign-in').val('You must sign in to vote');
246
  jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
@@ -276,6 +276,11 @@ function YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled, textBeforeSta
276
  return false; // prevent default click action from happening!
277
  });
278
 
 
 
 
 
 
279
 
280
  /*//If on document ready "BlogPosting" is checked show the additional fields
281
  if (jQuery('#yasr_choose_snippet_blogposting').is(':checked')) {
240
 
241
  jQuery('.yasr-general-options-text-before').prop('disabled', false);
242
  jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
243
+ jQuery('#yasr-general-options-custom-text-before-visitor').val('Click to rate this post!');
244
  jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
245
  jQuery('#yasr-general-options-custom-text-must-sign-in').val('You must sign in to vote');
246
  jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
276
  return false; // prevent default click action from happening!
277
  });
278
 
279
+ jQuery('#yasr-stats-explained-link').on('click', function () {
280
+ jQuery('#yasr-stats-explained').toggle('slow');
281
+ return false; // prevent default click action from happening!
282
+ });
283
+
284
 
285
  /*//If on document ready "BlogPosting" is checked show the additional fields
286
  if (jQuery('#yasr_choose_snippet_blogposting').is(':checked')) {
lib/admin/settings/yasr-settings-functions.php CHANGED
@@ -38,8 +38,8 @@ function yasr_general_options_init() {
38
 
39
  //This is to avoid undefined offset
40
  if ($option && $option['auto_insert_enabled'] == 0) {
41
- $option['auto_insert_what'] = 'overall_rating';
42
- $option['auto_insert_where'] = 'top';
43
  $option['auto_insert_exclude_pages'] = 'yes';
44
  $option['auto_insert_size'] = 'large';
45
  $option['auto_insert_custom_post_only'] = 'no';
@@ -47,13 +47,17 @@ function yasr_general_options_init() {
47
 
48
  //This is to avoid undefined offset
49
  if ($option && $option['text_before_stars'] == 0) {
50
- $option['text_before_overall'] = '';
51
- $option['text_before_visitor_rating'] = '';
52
- $option['text_after_visitor_rating'] = '';
53
- $option['custom_text_user_voted'] = '';
54
- $option['custom_text_must_sign_in'] = '';
 
 
 
55
  }
56
 
 
57
  //if it's not blogposting avoid undefined variable
58
  if (!isset($option['blogposting_organization_name'])) {
59
  $option['blogposting_organization_name'] = get_bloginfo('name');
@@ -63,15 +67,21 @@ function yasr_general_options_init() {
63
  $option['blogposting_organization_logo'] = get_site_icon_url();
64
  }
65
 
 
 
 
 
 
 
66
  add_settings_section('yasr_general_options_section_id', __('General settings', 'yet-another-stars-rating'), 'yasr_section_callback', 'yasr_general_settings_tab');
67
- add_settings_field('yasr_use_auto_insert_id', __('Auto insert options', 'yet-another-stars-rating'), 'yasr_auto_insert_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
68
- add_settings_field('yasr_custom_text', __('Insert custom text to show before / after stars', 'yet-another-stars-rating'), 'yasr_custom_text_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
69
- add_settings_field('yasr_show_overall_in_loop', __('Show "Overall Rating" in Archive Page?', 'yet-another-stars-rating'), 'yasr_show_overall_in_loop_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
70
- add_settings_field('yasr_show_visitor_votes_in_loop', __('Show "Visitor Votes" in Archive Page?', 'yet-another-stars-rating'), 'yasr_show_visitor_votes_in_loop_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
71
- add_settings_field('yasr_visitors_stats', __('Do you want show stats for visitors votes?', 'yet-another-stars-rating'), 'yasr_visitors_stats_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
72
- add_settings_field('yasr_allow_only_logged_in_id', __('Allow only logged in user to vote?', 'yet-another-stars-rating'), 'yasr_allow_only_logged_in_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
73
- add_settings_field('yasr_enable_ip', __('Do you want to save ip address?', 'yet-another-stars-rating'), 'yasr_enable_ip_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
74
- add_settings_field('yasr_choose_snippet_id', __('Rich snippet options', 'yet-another-stars-rating'), 'yasr_choose_snippet_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
75
  }
76
 
77
  function yasr_section_callback() {
@@ -97,91 +107,92 @@ function yasr_auto_insert_callback($option) {
97
 
98
  <p>&nbsp;</p>
99
 
100
- <strong><?php _e('What?', 'yet-another-stars-rating'); ?></strong>
101
-
102
- <div class="yasr-indented-answer">
103
-
104
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="overall_rating"
105
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what'] === 'overall_rating') {
106
- echo " checked=\"checked\" ";
107
- } ?> >
108
- <?php _e('Overall Rating / Author Rating', 'yet-another-stars-rating') ?>
109
- <br/>
110
-
111
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="visitor_rating"
112
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what'] === 'visitor_rating') {
113
- echo " checked=\"checked\" ";
114
- } ?> >
115
- <?php _e('Visitor Votes', 'yet-another-stars-rating') ?>
116
- <br/>
117
-
118
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="both"
119
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what'] === 'both') {
120
- echo " checked=\"checked\" ";
121
- } ?> >
122
- <?php _e('Both', 'yet-another-stars-rating') ?>
123
-
124
- <p>&nbsp;</p>
125
-
126
- </div>
127
-
128
- <strong><?php _e('Where?', 'yet-another-stars-rating'); ?></strong>
129
-
130
- <div class="yasr-indented-answer">
131
-
132
- <input type="radio" name="yasr_general_options[auto_insert_where]" value="top"
133
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_where'] === 'top') {
134
- echo " checked=\"checked\" ";
135
- } ?> >
136
- <?php _e('Before the post', 'yet-another-stars-rating') ?>
137
- <br/>
138
-
139
- <input type="radio" name="yasr_general_options[auto_insert_where]" value="bottom"
140
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_where'] === 'bottom') {
141
- echo " checked=\"checked\" ";
142
- } ?> >
143
- <?php _e('After the post', 'yet-another-stars-rating') ?>
144
- <br/>
145
-
146
- <p>&nbsp;</p>
147
 
148
- </div>
149
 
150
- <strong><?php _e('Size', 'yet-another-stars-rating'); ?></strong>
 
 
 
 
 
151
 
152
- <div class="yasr-indented-answer">
 
 
 
 
 
153
 
154
- <div class="yasr-option-size">
155
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="small"
156
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'small') {
157
  echo " checked=\"checked\" ";
158
  } ?> >
159
- <img src="<?php echo YASR_IMG_DIR . "yasr-stars-small.png" ?>" class="yasr-img-option-size"><span
160
- class="yasr-text-options-size"><?php _e('Small', 'yet-another-stars-rating') ?></span>
161
  </div>
 
 
 
162
 
163
- <div class="yasr-option-size">
164
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="medium"
165
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'medium') {
 
 
166
  echo " checked=\"checked\" ";
167
  } ?> >
168
- <img src="<?php echo YASR_IMG_DIR . "yasr-stars-medium.png" ?>" class="yasr-img-option-size"><span
169
- class="yasr-text-options-size"><?php _e('Medium', 'yet-another-stars-rating') ?></span>
170
- </div>
171
 
172
- <div class="yasr-option-size">
173
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="large"
174
- class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'large') {
175
  echo " checked=\"checked\" ";
176
  } ?> >
177
- <img src="<?php echo YASR_IMG_DIR . "yasr-stars-large.png" ?>" class="yasr-img-option-size"><span
178
- class="yasr-text-options-size"><?php _e('Large', 'yet-another-stars-rating') ?></span>
179
  </div>
 
180
 
181
- <p>&nbsp;</p>
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  </div>
184
 
 
 
185
  <strong><?php _e('Exclude Pages?', 'yet-another-stars-rating'); ?></strong>
186
 
187
  <div class="yasr-indented-answer">
@@ -247,9 +258,7 @@ function yasr_auto_insert_callback($option) {
247
  ?>
248
 
249
  <?php
250
-
251
- submit_button(__('Save Settings'));
252
-
253
  ?>
254
 
255
  </div>
@@ -351,8 +360,8 @@ function yasr_custom_text_callback($option) {
351
  <p>&nbsp;</p>
352
 
353
  <?php
354
-
355
- submit_button(__('Save Settings'));
356
 
357
  }
358
 
@@ -377,9 +386,6 @@ function yasr_show_overall_in_loop_callback($option) {
377
 
378
  <p>&nbsp;</p>
379
 
380
- <br/>
381
-
382
- <hr>
383
 
384
  <?php
385
 
@@ -431,6 +437,30 @@ function yasr_visitors_stats_callback($option) {
431
 
432
  <br/> <br/>
433
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  <p>&nbsp;</p>
435
 
436
  <hr>
@@ -457,6 +487,13 @@ function yasr_allow_only_logged_in_callback($option) {
457
  <?php _e('Allow everybody (logged in and anonymous)', 'yet-another-stars-rating') ?>
458
  <br/>
459
 
 
 
 
 
 
 
 
460
  <p>&nbsp;</p>
461
 
462
  <hr>
@@ -516,12 +553,6 @@ function yasr_choose_snippet_callback($option) {
516
  <strong><?php _e('Which rich snippet do you want to use?', 'yet-another-stars-rating'); ?></strong>
517
 
518
  <div class="yasr-indented-answer">
519
- <input type="radio" name="yasr_general_options[snippet]" value="overall_rating"
520
- class="yasr_choose_snippet" <?php if ($option['snippet'] === 'overall_rating') {
521
- echo " checked=\"checked\" ";
522
- } ?> >
523
- <?php _e('Review Rating', 'yet-another-stars-rating') ?>
524
- <br/>
525
 
526
  <input type="radio" name="yasr_general_options[snippet]" value="visitor_rating"
527
  class="yasr_choose_snippet" <?php if ($option['snippet'] === 'visitor_rating') {
@@ -530,6 +561,13 @@ function yasr_choose_snippet_callback($option) {
530
  <?php _e('Aggregate Rating', 'yet-another-stars-rating') ?>
531
  <br/>
532
 
 
 
 
 
 
 
 
533
  <p>&nbsp;</p>
534
 
535
  <a href="#" id="yasr-snippet-explained-link"><?php _e("What is this?", 'yet-another-stars-rating') ?></a>
@@ -539,12 +577,15 @@ function yasr_choose_snippet_callback($option) {
539
 
540
  _e('If you select "Review Rating", rating average is get from yasr_overall_rating shortcode.
541
  Your site will be indexed from search engines like this: ', 'yet-another-stars-rating');
542
- echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_review.png>";
543
 
544
  echo "<br /> <br />";
545
 
546
- _e('If, instead, you choose "Aggregate Rating", your site will be indexed like this', 'yet-another-stars-rating');
547
- echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_aggregate.jpg>";
 
 
 
548
  ?>
549
  </div>
550
 
@@ -612,9 +653,11 @@ function yasr_choose_snippet_callback($option) {
612
 
613
  <br/>
614
 
615
- <small><?php _e('You can always change it in the single post or page.', 'yet-another-stars-rating'); ?></small>
616
  <br/>
617
- <small><?php _e('This will affect only the post/page where you didn\'t change manually the itemtype yet.', 'yet-another-stars-rating'); ?> </small>
 
 
618
 
619
  <p>&nbsp;</p>
620
 
38
 
39
  //This is to avoid undefined offset
40
  if ($option && $option['auto_insert_enabled'] == 0) {
41
+ $option['auto_insert_what'] = 'visitor_rating';
42
+ $option['auto_insert_where'] = 'bottom';
43
  $option['auto_insert_exclude_pages'] = 'yes';
44
  $option['auto_insert_size'] = 'large';
45
  $option['auto_insert_custom_post_only'] = 'no';
47
 
48
  //This is to avoid undefined offset
49
  if ($option && $option['text_before_stars'] == 0) {
50
+ $option['text_before_overall'] = __('Our Score', 'yet-another-stars-rating');
51
+ $option['text_before_visitor_rating'] = __('Click to rate this post!', 'yet-another-stars-rating');
52
+ $option['text_after_visitor_rating'] = sprintf(
53
+ __('[Total: %s Average: %s]', 'yet-another-stars-rating'),
54
+ '%total_count%', '%average%'
55
+ );
56
+ $option['custom_text_user_voted'] = __('You must sign in to vote', 'yet-another-stars-rating');
57
+ $option['custom_text_must_sign_in'] = __('You have already voted for this article', 'yet-another-stars-rating');
58
  }
59
 
60
+
61
  //if it's not blogposting avoid undefined variable
62
  if (!isset($option['blogposting_organization_name'])) {
63
  $option['blogposting_organization_name'] = get_bloginfo('name');
67
  $option['blogposting_organization_logo'] = get_site_icon_url();
68
  }
69
 
70
+ $description_auto_insert = sprintf(__('Auto Insert Options %s
71
+ Automatically adds YASR in your post or page. %s
72
+ Disable this if you prefer to use shortcodes.',
73
+ 'yet-another-stars-rating'),
74
+ '<p>&nbsp;</p>', '<br />');
75
+
76
  add_settings_section('yasr_general_options_section_id', __('General settings', 'yet-another-stars-rating'), 'yasr_section_callback', 'yasr_general_settings_tab');
77
+ add_settings_field('yasr_use_auto_insert_id', $description_auto_insert, 'yasr_auto_insert_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
78
+ add_settings_field('yasr_custom_text', __('Insert custom text to show before / after stars', 'yet-another-stars-rating'), 'yasr_custom_text_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
79
+ add_settings_field('yasr_show_overall_in_loop', __('Show "Overall Rating" in Archive Page?', 'yet-another-stars-rating'), 'yasr_show_overall_in_loop_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
80
+ add_settings_field('yasr_show_visitor_votes_in_loop', __('Show "Visitor Votes" in Archive Page?', 'yet-another-stars-rating'), 'yasr_show_visitor_votes_in_loop_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
81
+ add_settings_field('yasr_visitors_stats', __('Do you want show stats for visitors votes?', 'yet-another-stars-rating'), 'yasr_visitors_stats_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
82
+ add_settings_field('yasr_allow_only_logged_in_id', __('Allow only logged in user to vote?', 'yet-another-stars-rating'), 'yasr_allow_only_logged_in_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
83
+ add_settings_field('yasr_enable_ip', __('Do you want to save ip address?', 'yet-another-stars-rating'), 'yasr_enable_ip_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
84
+ add_settings_field('yasr_choose_snippet_id', __('Rich snippet options', 'yet-another-stars-rating'), 'yasr_choose_snippet_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option);
85
  }
86
 
87
  function yasr_section_callback() {
107
 
108
  <p>&nbsp;</p>
109
 
110
+ <div>
111
+ <strong><?php _e('What?', 'yet-another-stars-rating'); ?></strong>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
+ <div class="yasr-indented-answer">
114
 
115
+ <input type="radio" name="yasr_general_options[auto_insert_what]" value="visitor_rating"
116
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what'] === 'visitor_rating') {
117
+ echo " checked=\"checked\" ";
118
+ } ?> >
119
+ <?php _e('Visitor Votes', 'yet-another-stars-rating') ?>
120
+ <br/>
121
 
122
+ <input type="radio" name="yasr_general_options[auto_insert_what]" value="overall_rating"
123
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what'] === 'overall_rating') {
124
+ echo " checked=\"checked\" ";
125
+ } ?> >
126
+ <?php _e('Overall Rating / Author Rating', 'yet-another-stars-rating') ?>
127
+ <br/>
128
 
129
+ <input type="radio" name="yasr_general_options[auto_insert_what]" value="both"
130
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what'] === 'both') {
 
131
  echo " checked=\"checked\" ";
132
  } ?> >
133
+ <?php _e('Both', 'yet-another-stars-rating') ?>
 
134
  </div>
135
+ </div>
136
+
137
+ <p>&nbsp;</p>
138
 
139
+ <div>
140
+ <strong><?php _e('Where?', 'yet-another-stars-rating'); ?></strong>
141
+ <div class="yasr-indented-answer">
142
+ <input type="radio" name="yasr_general_options[auto_insert_where]" value="top"
143
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_where'] === 'top') {
144
  echo " checked=\"checked\" ";
145
  } ?> >
146
+ <?php _e('Before the content', 'yet-another-stars-rating') ?>
147
+ <br/>
 
148
 
149
+ <input type="radio" name="yasr_general_options[auto_insert_where]" value="bottom"
150
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_where'] === 'bottom') {
 
151
  echo " checked=\"checked\" ";
152
  } ?> >
153
+ <?php _e('After the content', 'yet-another-stars-rating') ?>
154
+ <br/>
155
  </div>
156
+ </div>
157
 
158
+ <p>&nbsp;</p>
159
 
160
+ <div>
161
+ <strong><?php _e('Size', 'yet-another-stars-rating'); ?></strong>
162
+
163
+ <div class="yasr-indented-answer">
164
+
165
+ <div class="yasr-option-size">
166
+ <input type="radio" name="yasr_general_options[auto_insert_size]" value="small"
167
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'small') {
168
+ echo " checked=\"checked\" ";
169
+ } ?> >
170
+ <img src="<?php echo YASR_IMG_DIR . "yasr-stars-small.png" ?>" class="yasr-img-option-size"><span
171
+ class="yasr-text-options-size"><?php _e('Small', 'yet-another-stars-rating') ?></span>
172
+ </div>
173
+
174
+ <div class="yasr-option-size">
175
+ <input type="radio" name="yasr_general_options[auto_insert_size]" value="medium"
176
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'medium') {
177
+ echo " checked=\"checked\" ";
178
+ } ?> >
179
+ <img src="<?php echo YASR_IMG_DIR . "yasr-stars-medium.png" ?>" class="yasr-img-option-size"><span
180
+ class="yasr-text-options-size"><?php _e('Medium', 'yet-another-stars-rating') ?></span>
181
+ </div>
182
+
183
+ <div class="yasr-option-size">
184
+ <input type="radio" name="yasr_general_options[auto_insert_size]" value="large"
185
+ class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size'] === 'large') {
186
+ echo " checked=\"checked\" ";
187
+ } ?> >
188
+ <img src="<?php echo YASR_IMG_DIR . "yasr-stars-large.png" ?>" class="yasr-img-option-size"><span
189
+ class="yasr-text-options-size"><?php _e('Large', 'yet-another-stars-rating') ?></span>
190
+ </div>
191
+ </div>
192
  </div>
193
 
194
+ <p>&nbsp;</p>
195
+
196
  <strong><?php _e('Exclude Pages?', 'yet-another-stars-rating'); ?></strong>
197
 
198
  <div class="yasr-indented-answer">
258
  ?>
259
 
260
  <?php
261
+ submit_button(__('Save Settings'));
 
 
262
  ?>
263
 
264
  </div>
360
  <p>&nbsp;</p>
361
 
362
  <?php
363
+ submit_button(__('Save Settings'));
364
+ echo '<hr />';
365
 
366
  }
367
 
386
 
387
  <p>&nbsp;</p>
388
 
 
 
 
389
 
390
  <?php
391
 
437
 
438
  <br/> <br/>
439
 
440
+ <?php
441
+ _e('Enable or disable the chart bar icon (and tooltip hover it) near the yasr_visitor_votes shortcode.');
442
+ ?>
443
+
444
+ <p>&nbsp;</p>
445
+
446
+ <a href="#" id="yasr-stats-explained-link"><?php _e("Example", 'yet-another-stars-rating') ?></a>
447
+
448
+ <div id="yasr-stats-explained" class="yasr-help-box-settings">
449
+ <?php
450
+ echo '<strong>';
451
+ _e('ENABLED:', 'yet-another-stars-rating');
452
+ echo "</strong>
453
+ <hr />
454
+ <img src=" . YASR_IMG_DIR . "yasr_settings_stats_enabled.png>";
455
+
456
+ echo '<br /><br /><strong>';
457
+ _e('DISABLED:', 'yet-another-stars-rating');
458
+ echo "</strong>
459
+ <hr />
460
+ <img src=" . YASR_IMG_DIR . "yasr_settings_stats_disabled.png>";
461
+ ?>
462
+ </div>
463
+
464
  <p>&nbsp;</p>
465
 
466
  <hr>
487
  <?php _e('Allow everybody (logged in and anonymous)', 'yet-another-stars-rating') ?>
488
  <br/>
489
 
490
+ <br /><br />
491
+ <?php
492
+ _e(
493
+ 'Select who can rate your posts for yasr_visitor_votes shortcode.',
494
+ 'yet-another-stars-rating')
495
+ ?>
496
+
497
  <p>&nbsp;</p>
498
 
499
  <hr>
553
  <strong><?php _e('Which rich snippet do you want to use?', 'yet-another-stars-rating'); ?></strong>
554
 
555
  <div class="yasr-indented-answer">
 
 
 
 
 
 
556
 
557
  <input type="radio" name="yasr_general_options[snippet]" value="visitor_rating"
558
  class="yasr_choose_snippet" <?php if ($option['snippet'] === 'visitor_rating') {
561
  <?php _e('Aggregate Rating', 'yet-another-stars-rating') ?>
562
  <br/>
563
 
564
+ <input type="radio" name="yasr_general_options[snippet]" value="overall_rating"
565
+ class="yasr_choose_snippet" <?php if ($option['snippet'] === 'overall_rating') {
566
+ echo " checked=\"checked\" ";
567
+ } ?> >
568
+ <?php _e('Review Rating', 'yet-another-stars-rating') ?>
569
+ <br/>
570
+
571
  <p>&nbsp;</p>
572
 
573
  <a href="#" id="yasr-snippet-explained-link"><?php _e("What is this?", 'yet-another-stars-rating') ?></a>
577
 
578
  _e('If you select "Review Rating", rating average is get from yasr_overall_rating shortcode.
579
  Your site will be indexed from search engines like this: ', 'yet-another-stars-rating');
580
+ echo "<hr /><img src=" . YASR_IMG_DIR . "yasr_review.png>";
581
 
582
  echo "<br /> <br />";
583
 
584
+ $string_aggregate=sprintf(__(
585
+ '%sIf, instead,%s you choose "Aggregate Rating", your site will be indexed like this, getting the data from your visitors ratings',
586
+ 'yet-another-stars-rating'
587
+ ),'<strong>', '</strong>');
588
+ echo "$string_aggregate<hr /><img src=" . YASR_IMG_DIR . "yasr_aggregate.jpg>";
589
  ?>
590
  </div>
591
 
653
 
654
  <br/>
655
 
656
+ <?php _e('You can always change it in the single post or page.', 'yet-another-stars-rating'); ?>
657
  <br/>
658
+ <?php _e(
659
+ 'This will affect only the post/page where you didn\'t change manually the itemtype yet.',
660
+ 'yet-another-stars-rating'); ?>
661
 
662
  <p>&nbsp;</p>
663
 
lib/yasr-db-functions.php CHANGED
@@ -44,15 +44,23 @@ function yasr_on_activation_install($network_wide) {
44
 
45
  if (!$option) {
46
  $option = array();
47
- $option['auto_insert_enabled'] = 0;
48
- $option['auto_insert_what'] = 'overall_rating';
49
- $option['auto_insert_where'] = 'top';
50
  $option['auto_insert_size'] = 'large';
51
  $option['auto_insert_exclude_pages'] = 'yes';
52
  $option['auto_insert_custom_post_only'] = 'no';
53
  $option['show_overall_in_loop'] = 'disabled';
54
  $option['show_visitor_votes_in_loop'] = 'disabled';
55
- $option['text_before_stars'] = 0;
 
 
 
 
 
 
 
 
56
  $option['enable_ip'] = 'no';
57
  $option['snippet'] = 'overall_rating';
58
  $option['snippet_itemtype'] = 'Product';
@@ -97,7 +105,7 @@ function yasr_create_tables () {
97
  set_name varchar(64) COLLATE utf8_unicode_ci NOT NULL,
98
  UNIQUE KEY set_id (set_id),
99
  UNIQUE KEY set_name (set_name)
100
- )";
101
 
102
  $sql_yasr_multi_set_fields = "CREATE TABLE IF NOT EXISTS $yasr_multi_set_fields (
103
  id bigint(20) NOT NULL,
@@ -106,7 +114,7 @@ function yasr_create_tables () {
106
  field_id int(2) NOT NULL,
107
  PRIMARY KEY (id),
108
  UNIQUE KEY id (id)
109
- )";
110
 
111
  $sql_yasr_multi_value_table = "CREATE TABLE IF NOT EXISTS $yasr_multi_values_table (
112
  id bigint(20) NOT NULL,
@@ -118,7 +126,7 @@ function yasr_create_tables () {
118
  sum_votes decimal(11, 1) NOT NULL,
119
  PRIMARY KEY (id),
120
  UNIQUE KEY id (id)
121
- );";
122
 
123
  $sql_yasr_log_table = "CREATE TABLE IF NOT EXISTS $yasr_log_table (
124
  id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -130,7 +138,7 @@ function yasr_create_tables () {
130
  ip varchar(45) COLLATE utf8_unicode_ci NOT NULL,
131
  PRIMARY KEY (id),
132
  UNIQUE KEY id (id)
133
- );";
134
 
135
 
136
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
44
 
45
  if (!$option) {
46
  $option = array();
47
+ $option['auto_insert_enabled'] = 1;
48
+ $option['auto_insert_what'] = 'visitor_rating';
49
+ $option['auto_insert_where'] = 'bottom';
50
  $option['auto_insert_size'] = 'large';
51
  $option['auto_insert_exclude_pages'] = 'yes';
52
  $option['auto_insert_custom_post_only'] = 'no';
53
  $option['show_overall_in_loop'] = 'disabled';
54
  $option['show_visitor_votes_in_loop'] = 'disabled';
55
+ $option['text_before_stars'] = 1;
56
+ $option['text_before_overall'] = __('Our Score', 'yet-another-stars-rating');
57
+ $option['text_before_visitor_rating'] = __('Click to rate this post!', 'yet-another-stars-rating');
58
+ $option['text_after_visitor_rating'] = sprintf(
59
+ __('[Total: %s Average: %s]', 'yet-another-stars-rating'),
60
+ '%total_count%', '%average%'
61
+ );
62
+ $option['custom_text_user_voted'] = __('You must sign in to vote', 'yet-another-stars-rating');
63
+ $option['custom_text_must_sign_in'] = __('You have already voted for this article', 'yet-another-stars-rating');
64
  $option['enable_ip'] = 'no';
65
  $option['snippet'] = 'overall_rating';
66
  $option['snippet_itemtype'] = 'Product';
105
  set_name varchar(64) COLLATE utf8_unicode_ci NOT NULL,
106
  UNIQUE KEY set_id (set_id),
107
  UNIQUE KEY set_name (set_name)
108
+ ) COLLATE 'utf8_unicode_ci';";
109
 
110
  $sql_yasr_multi_set_fields = "CREATE TABLE IF NOT EXISTS $yasr_multi_set_fields (
111
  id bigint(20) NOT NULL,
114
  field_id int(2) NOT NULL,
115
  PRIMARY KEY (id),
116
  UNIQUE KEY id (id)
117
+ ) COLLATE 'utf8_unicode_ci';";
118
 
119
  $sql_yasr_multi_value_table = "CREATE TABLE IF NOT EXISTS $yasr_multi_values_table (
120
  id bigint(20) NOT NULL,
126
  sum_votes decimal(11, 1) NOT NULL,
127
  PRIMARY KEY (id),
128
  UNIQUE KEY id (id)
129
+ ) COLLATE 'utf8_unicode_ci';;";
130
 
131
  $sql_yasr_log_table = "CREATE TABLE IF NOT EXISTS $yasr_log_table (
132
  id bigint(20) NOT NULL AUTO_INCREMENT,
138
  ip varchar(45) COLLATE utf8_unicode_ci NOT NULL,
139
  PRIMARY KEY (id),
140
  UNIQUE KEY id (id)
141
+ ) COLLATE 'utf8_unicode_ci';;";
142
 
143
 
144
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.3.0
5
  Contributors: Dudo
6
  Tested up to: 5.2.2
7
  Requires PHP: 5.3
8
- Stable tag: 2.0.2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
@@ -133,6 +133,10 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
133
 
134
  The full changelog can be found in the plugin's directory. Recent entries:
135
 
 
 
 
 
136
  = 2.0.2 =
137
  * TWEAKED: Multisite support!!
138
  * TWEAKED: In gutenberg editor, now a link for Yasr Sidebar is available
5
  Contributors: Dudo
6
  Tested up to: 5.2.2
7
  Requires PHP: 5.3
8
+ Stable tag: 2.0.3
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
133
 
134
  The full changelog can be found in the plugin's directory. Recent entries:
135
 
136
+ = 2.0.3 =
137
+ * TWEAKED: some changes in settings page
138
+ * TWEAKED: new default values for new installations.
139
+
140
  = 2.0.2 =
141
  * TWEAKED: Multisite support!!
142
  * TWEAKED: In gutenberg editor, now a link for Yasr Sidebar is available
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
- * Version: 2.0.2
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
- define( 'YASR_VERSION_NUM', '2.0.2' );
80
  //Plugin relative path
81
  define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
  //Plugin RELATIVE PATH without slashes (just the directory's name)
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
+ * Version: 2.0.3
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
+ define( 'YASR_VERSION_NUM', '2.0.3' );
80
  //Plugin relative path
81
  define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
  //Plugin RELATIVE PATH without slashes (just the directory's name)