Yasr – Yet Another Stars Rating - Version 1.8.3

Version Description

  • FIXED: multiset doesn't show up in the edit screen if only 1 is used
Download this release

Release Info

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

Code changes from version 1.8.2 to 1.8.3

changelog.txt CHANGED
@@ -1,3 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 1.5.6 =
2
  * Fixed Javascript error
3
 
1
+ = 1.7.0 =
2
+ * FIXED: Yasr overall rating not showing up if custom text isn't set
3
+
4
+ = 1.6.9 =
5
+ * TWEAKED: Most of work have been done on making Yasr working without jquery. This is still in beta but now supports all shortcodes
6
+ except "yasr_visitor_multiset" one
7
+ * TWEAKED: yasr_visitor_votes_readonly is now just a call to 'yasr_visitor_votes readonly="yes" '
8
+ * TWEAKED: Huge code cleanup
9
+ * TWEAKED: Php version required is now 5.3 instead 5.4
10
+
11
+ = 1.6.8 =
12
+ * Fixed css for tooltip stats
13
+
14
+ = 1.6.7 =
15
+ * Css fix for gutenberg compatibility
16
+
17
+ = 1.6.6 =
18
+ * Minor changes
19
+
20
+ = 1.6.5 =
21
+ * NEW FEATURE: is it possible to use YASR without jquery
22
+ This functionality is still in beta and for now and works only with yasr_overall_rating and yasr_visitor_votes shortcode.
23
+ You can enable/disable this in every moment in the settings
24
+
25
+ = 1.6.4 =
26
+ * Updated freemius sdk to be gdpr compilant
27
+
28
+ = 1.6.3 =
29
+ * FIXED: Multiset transient are now deleted only under the "Multi Sets" tab
30
+
31
+ = 1.6.2 =
32
+ * Removed showing ip from widget in the user dashboard
33
+ * Better cookie managment
34
+
35
+ = 1.6.1 =
36
+ * To accomplish GDPR european law, now the IP is not stored by default
37
+
38
+ = 1.6.0 =
39
+ * Integreted freemius sdk
40
+
41
+ = 1.5.8 =
42
+ * NEW FEATURE: Logs Page: is now possible to see log page and delete user ratings!
43
+ * TWEAKED: Yasr settings page has now it's own top level page instead under the WordPress Settings section
44
+
45
+ = 1.5.7 =
46
+ * FIXED: star disappear after user rating in some circumstances
47
+ * FIXED: javascript noticies
48
+
49
  = 1.5.6 =
50
  * Fixed Javascript error
51
 
css/yasr-admin.css CHANGED
@@ -489,7 +489,7 @@
489
  width: 50%;
490
  margin: auto;
491
  position: relative;
492
- top: -80px;
493
  background-color: #ffffff;
494
  border: 1px solid black;
495
  opacity: 0.8;
@@ -509,7 +509,7 @@
509
  width: 50%;
510
  margin: auto;
511
  position: relative;
512
- top: -150px;
513
  background-color: #ffffff;
514
  border: 2px solid black;
515
  opacity: 0.8;
489
  width: 50%;
490
  margin: auto;
491
  position: relative;
492
+ top: -140px;
493
  background-color: #ffffff;
494
  border: 1px solid black;
495
  opacity: 0.8;
509
  width: 50%;
510
  margin: auto;
511
  position: relative;
512
+ top: -288px;
513
  background-color: #ffffff;
514
  border: 2px solid black;
515
  opacity: 0.8;
js/yasr-admin.js CHANGED
@@ -31,17 +31,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
31
 
32
  yasrPrintEventSendOverallWithStars(postid, nonceOverall, overallRating);
33
 
34
- } //end if if (defaultbox == 'stars' )
35
 
36
  else if (defaultbox === 'numbers') {
37
 
38
  yasrPrintEventSendOverallWithNumbers(postid, nonceOverall);
39
 
40
- } //End else if (defaultbox == 'numbers')
41
 
42
  yasrSnippetSelect(postid, nonceSnippet);
43
 
44
- } //End function yasr_display_metabox
45
 
46
  //This is for the stars
47
  function yasrPrintEventSendOverallWithStars(postid, nonce, overallRating) {
@@ -60,8 +60,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
60
 
61
  jQuery('#loader-overall-rating').show();
62
 
63
- var rating = rating.toFixed(1);
64
- var rating = parseFloat(rating);
65
  this.setRating(rating);
66
 
67
  var data = {
@@ -171,7 +171,7 @@ function yasrAdminMultiSet(nMultiSet, postid, setId, nonceMulti){
171
 
172
  if (nMultiSet === 1) {
173
 
174
- yasrPrintAdminMultiSet(setId, postid, nonceMulti);
175
 
176
  }
177
 
@@ -193,7 +193,7 @@ function yasrAdminMultiSet(nMultiSet, postid, setId, nonceMulti){
193
  }
194
 
195
  //print the table
196
- function yasrPrintAdminMultiSet (setId, postid, nonceMulti) {
197
 
198
  var data_id = {
199
  action: 'yasr_send_id_nameset',
@@ -203,8 +203,10 @@ function yasrPrintAdminMultiSet (setId, postid, nonceMulti) {
203
 
204
  jQuery.post(ajaxurl, data_id, function(response) {
205
 
206
- //Hide the loader near the select
207
- document.getElementById('yasr-loader-select-multi-set').style.display='none';
 
 
208
 
209
  var yasrMultiSetValue = JSON.parse(response);
210
 
31
 
32
  yasrPrintEventSendOverallWithStars(postid, nonceOverall, overallRating);
33
 
34
+ }
35
 
36
  else if (defaultbox === 'numbers') {
37
 
38
  yasrPrintEventSendOverallWithNumbers(postid, nonceOverall);
39
 
40
+ }
41
 
42
  yasrSnippetSelect(postid, nonceSnippet);
43
 
44
+ }
45
 
46
  //This is for the stars
47
  function yasrPrintEventSendOverallWithStars(postid, nonce, overallRating) {
60
 
61
  jQuery('#loader-overall-rating').show();
62
 
63
+ rating = rating.toFixed(1);
64
+ rating = parseFloat(rating);
65
  this.setRating(rating);
66
 
67
  var data = {
171
 
172
  if (nMultiSet === 1) {
173
 
174
+ yasrPrintAdminMultiSet(setId, postid, nonceMulti, nMultiSet);
175
 
176
  }
177
 
193
  }
194
 
195
  //print the table
196
+ function yasrPrintAdminMultiSet (setId, postid, nonceMulti, nMultiSet) {
197
 
198
  var data_id = {
199
  action: 'yasr_send_id_nameset',
203
 
204
  jQuery.post(ajaxurl, data_id, function(response) {
205
 
206
+ //Hide the loader near the select only if more multiset are used
207
+ if (nMultiSet !== 1) {
208
+ document.getElementById('yasr-loader-select-multi-set').style.display = 'none';
209
+ }
210
 
211
  var yasrMultiSetValue = JSON.parse(response);
212
 
lib/settings/yasr-settings-functions.php CHANGED
@@ -17,95 +17,195 @@ GNU General Public License for more details.
17
  You should have received a copy of the GNU General Public License
18
  along with this program. If not, see <http://www.gnu.org/licenses/>
19
  */
 
 
 
 
 
 
 
20
 
21
- if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
22
-
23
- function yasr_settings_tabs($active_tab) {
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ?>
 
 
 
 
 
 
 
 
 
 
 
26
 
27
- <h2 class="nav-tab-wrapper yasr-no-underline">
28
 
29
- <a href="?page=yasr_settings_page&tab=general_settings" class="nav-tab <?php if ($active_tab == 'general_settings') echo 'nav-tab-active'; ?>" > <?php _e("General Settings", 'yet-another-stars-rating'); ?> </a>
30
- <a href="?page=yasr_settings_page&tab=manage_multi" class="nav-tab <?php if ($active_tab == 'manage_multi') echo 'nav-tab-active'; ?>" > <?php _e("Multi Sets", 'yet-another-stars-rating'); ?> </a>
31
- <a href="?page=yasr_settings_page&tab=style_options" class="nav-tab <?php if ($active_tab == 'style_options') echo 'nav-tab-active'; ?>" > <?php _e("Aspect & Styles", 'yet-another-stars-rating'); ?> </a>
32
- <?php do_action( 'yasr_add_settings_tab', $active_tab ); ?>
33
 
34
  </h2>
35
 
36
- <?php
37
  }
38
 
39
  /************ Add yasr general options ***********/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- add_action( 'admin_init', 'yasr_general_options_init' ); //This is for general options
42
-
43
- function yasr_general_options_init() {
44
-
45
- register_setting(
46
- 'yasr_general_options_group', // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
47
- 'yasr_general_options', //The name of an option to sanitize and save.
48
- 'yasr_general_options_sanitize'
49
- );
50
-
51
- $option = get_option( 'yasr_general_options' );
52
-
53
- //This is to avoid undefined offset
54
- if ($option && $option['auto_insert_enabled']==0) {
55
- $option['auto_insert_what'] = 'overall_rating';
56
- $option['auto_insert_where'] = 'top';
57
- $option['auto_insert_exclude_pages'] = 'yes';
58
- $option['auto_insert_size'] = 'large';
59
- $option['auto_insert_custom_post_only'] = 'no';
60
- }
61
-
62
- //This is to avoid undefined offset
63
- if ($option && $option['text_before_stars']==0) {
64
- $option['text_before_overall'] = '';
65
- $option['text_before_visitor_rating'] = '';
66
- $option['text_after_visitor_rating'] = '';
67
- $option['custom_text_user_voted'] = '';
68
- }
69
-
70
- //if it's not blogposting avoid undefined variable
71
- if (!isset($option['blogposting_organization_name'])) {
72
-
73
- $option['blogposting_organization_name'] = get_bloginfo('name');
74
-
75
- }
76
-
77
- if (!isset($option['blogposting_organization_logo'])) {
78
-
79
- $option['blogposting_organization_logo'] = get_site_icon_url();
80
-
81
- }
82
-
83
- add_settings_section( 'yasr_general_options_section_id', __('General settings', 'yet-another-stars-rating'), 'yasr_section_callback', 'yasr_general_settings_tab' );
84
- 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 );
85
- 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);
86
- 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);
87
- 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);
88
- 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);
89
- 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 );
90
- 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);
91
- 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 );
92
- add_settings_field( 'yasr_choose_overall_rating_method', __('How do you want to rate "Overall Rating"?', 'yet-another-stars-rating'), 'yasr_choose_overall_rating_method_callback', 'yasr_general_settings_tab', 'yasr_general_options_section_id', $option );
93
-
94
- }
95
-
96
- function yasr_section_callback() {
97
- //_e('Manage auto insert', 'yet-another-stars-rating');
98
- }
99
-
100
- function yasr_auto_insert_callback($option) {
101
 
102
- ?>
 
 
103
 
104
- <strong><?php _e('Use Auto Insert?', 'yet-another-stars-rating'); ?></strong>
 
 
105
 
106
 
107
  <div class="yasr-onoffswitch-big">
108
- <input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox" value="1" id="yasr_auto_insert_switch" <?php if ($option['auto_insert_enabled']==1) echo " checked='checked' "; ?> >
 
 
 
 
109
  <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
110
  <span class="yasr-onoffswitch-inner"></span>
111
  <span class="yasr-onoffswitch-switch"></span>
@@ -114,134 +214,224 @@ function yasr_settings_tabs($active_tab) {
114
 
115
  <p>&nbsp;</p>
116
 
117
- <strong><?php _e('What?', 'yet-another-stars-rating'); ?></strong>
 
 
118
 
119
  <div class="yasr-indented-answer">
120
 
121
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="overall_rating" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what']==='overall_rating') echo " checked=\"checked\" "; ?> >
122
- <?php _e('Overall Rating / Author Rating', 'yet-another-stars-rating') ?>
 
 
 
 
 
 
123
  <br />
124
 
125
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="visitor_rating" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what']==='visitor_rating') echo " checked=\"checked\" "; ?> >
126
- <?php _e('Visitor Votes', 'yet-another-stars-rating')?>
 
 
 
 
 
 
127
  <br />
128
 
129
- <input type="radio" name="yasr_general_options[auto_insert_what]" value="both" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_what']==='both') echo " checked=\"checked\" "; ?> >
130
- <?php _e('Both', 'yet-another-stars-rating')?>
 
 
 
 
 
 
131
 
132
  <p>&nbsp;</p>
133
 
134
  </div>
135
 
136
- <strong><?php _e('Where?', 'yet-another-stars-rating'); ?></strong>
 
 
137
 
138
  <div class="yasr-indented-answer">
139
 
140
- <input type="radio" name="yasr_general_options[auto_insert_where]" value="top" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_where']==='top' ) echo " checked=\"checked\" "; ?> >
141
- <?php _e('Before the post', 'yet-another-stars-rating')?>
 
 
 
 
 
 
142
  <br />
143
 
144
- <input type="radio" name="yasr_general_options[auto_insert_where]" value="bottom" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_where']==='bottom') echo " checked=\"checked\" "; ?> >
145
- <?php _e('After the post', 'yet-another-stars-rating')?>
 
 
 
 
 
 
146
  <br />
147
 
148
  <p>&nbsp;</p>
149
 
150
  </div>
151
 
152
- <strong><?php _e('Size', 'yet-another-stars-rating'); ?></strong>
 
 
153
 
154
  <div class="yasr-indented-answer">
155
 
156
  <div class="yasr-option-size">
157
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="small" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size']==='small' ) echo " checked=\"checked\" "; ?> >
158
- <img src="<?php echo YASR_IMG_DIR . "yasr-stars-small.png" ?>" class="yasr-img-option-size"><span class="yasr-text-options-size"><?php _e('Small', 'yet-another-stars-rating')?></span>
 
 
 
 
 
 
 
 
159
  </div>
160
 
161
  <div class="yasr-option-size">
162
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="medium" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size']==='medium' ) echo " checked=\"checked\" "; ?> >
163
- <img src="<?php echo YASR_IMG_DIR . "yasr-stars-medium.png" ?>" class="yasr-img-option-size"><span class="yasr-text-options-size"><?php _e('Medium', 'yet-another-stars-rating')?></span>
 
 
 
 
 
 
 
 
164
  </div>
165
 
166
  <div class="yasr-option-size">
167
- <input type="radio" name="yasr_general_options[auto_insert_size]" value="large" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_size']==='large' ) echo " checked=\"checked\" "; ?> >
168
- <img src="<?php echo YASR_IMG_DIR . "yasr-stars-large.png" ?>" class="yasr-img-option-size"><span class="yasr-text-options-size"><?php _e('Large', 'yet-another-stars-rating')?></span>
 
 
 
 
 
 
 
 
169
  </div>
170
 
171
  <p>&nbsp;</p>
172
 
173
  </div>
174
 
175
- <strong><?php _e('Exclude Pages?', 'yet-another-stars-rating'); ?></strong>
 
 
176
 
177
  <div class="yasr-indented-answer">
178
- <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="yes" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_exclude_pages']==='yes' ) echo " checked=\"checked\" "; ?> >
179
- <?php _e('Yes', 'yet-another-stars-rating'); ?>
 
 
 
 
 
 
180
 
181
  &nbsp;&nbsp;&nbsp;
182
 
183
- <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="no" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_exclude_pages']==='no') echo " checked=\"checked\" "; ?> >
184
- <?php _e('No', 'yet-another-stars-rating'); ?>
 
 
 
 
 
 
185
  <br />
186
 
187
  <p>&nbsp;</p>
188
 
189
  </div>
190
 
191
- <?php
192
-
193
- $custom_post_types = yasr_get_custom_post_type('bool');
194
-
195
- if ($custom_post_types) { ?>
196
- <strong><?php _e('Use only in custom post types?', 'yet-another-stars-rating'); ?></strong>
 
 
197
  <div class="yasr-indented-answer">
198
- <input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="yes" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_custom_post_only']==='yes' ) echo " checked=\"checked\" "; ?> >
199
- <?php _e('Yes', 'yet-another-stars-rating'); ?>
 
 
 
 
 
 
200
 
201
  &nbsp;&nbsp;&nbsp;
202
 
203
- <input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="no" class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_custom_post_only']==='no') echo " checked=\"checked\" "; ?> >
204
- <?php _e('No', 'yet-another-stars-rating'); ?>
 
 
 
 
 
 
205
 
206
  <p>
207
 
208
- <?php _e("You see this because you use custom post types.", 'yet-another-stars-rating'); ?>
 
 
209
  <br/>
210
- <?php _e("If you want to use auto insert only in custom post types, choose Yes", 'yet-another-stars-rating'); ?>
 
 
211
 
212
  <p>&nbsp;</p>
213
 
214
  </div>
215
 
216
- <?php
217
- }
218
-
219
- else {
220
-
221
- ?>
222
 
223
  <input type="hidden" name="yasr_general_options[auto_insert_custom_post_only]" value="no" ?>
224
 
225
- <?php
226
-
227
- }
228
-
229
- ?>
230
-
231
-
232
- <?php
233
-
234
- submit_button( __('Save Settings') );
235
-
236
 
237
- } //End yasr_auto_insert_callback
238
 
239
- function yasr_show_overall_in_loop_callback($option) {
 
 
240
 
241
- ?>
 
 
 
242
 
243
  <div class="yasr-onoffswitch-big">
244
- <input type="checkbox" name="yasr_general_options[show_overall_in_loop]" class="yasr-onoffswitch-checkbox" id="yasr-show-overall-in-loop-switch" <?php if ($option['show_overall_in_loop']==='enabled') echo " checked='checked' "; ?> >
 
 
 
 
245
  <label class="yasr-onoffswitch-label" for="yasr-show-overall-in-loop-switch">
246
  <span class="yasr-onoffswitch-inner"></span>
247
  <span class="yasr-onoffswitch-switch"></span>
@@ -251,7 +441,9 @@ function yasr_settings_tabs($active_tab) {
251
  <br />
252
  <br />
253
 
254
- <?php _e('If you enable this, "Overall Rating" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating')?>
 
 
255
 
256
  <p>&nbsp;</p>
257
 
@@ -259,16 +451,19 @@ function yasr_settings_tabs($active_tab) {
259
 
260
  <hr>
261
 
262
- <?php
263
-
264
- }
265
-
266
- function yasr_show_visitor_votes_in_loop_callback ($option) {
267
 
268
- ?>
 
 
269
 
270
  <div class="yasr-onoffswitch-big">
271
- <input type="checkbox" name="yasr_general_options[show_visitor_votes_in_loop]" class="yasr-onoffswitch-checkbox" id="yasr-show-visitor-votes-in-loop-switch" <?php if ($option['show_visitor_votes_in_loop']==='enabled') echo " checked='checked' "; ?> >
 
 
 
 
272
  <label class="yasr-onoffswitch-label" for="yasr-show-visitor-votes-in-loop-switch">
273
  <span class="yasr-onoffswitch-inner"></span>
274
  <span class="yasr-onoffswitch-switch"></span>
@@ -278,7 +473,9 @@ function yasr_settings_tabs($active_tab) {
278
  <br />
279
  <br />
280
 
281
- <?php _e('If you enable this, "Visitor Votes" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating')?>
 
 
282
 
283
  <p>&nbsp;</p>
284
 
@@ -286,24 +483,23 @@ function yasr_settings_tabs($active_tab) {
286
 
287
  <hr>
288
 
289
- <?php
290
-
291
- }
292
-
293
- function yasr_custom_text_callback($option) {
294
-
295
- $text_before_overall = htmlspecialchars("$option[text_before_overall]");
296
-
297
- $text_before_visitor_rating = htmlspecialchars("$option[text_before_visitor_rating]");
298
-
299
- $text_after_visitor_rating = htmlspecialchars("$option[text_after_visitor_rating]");
300
-
301
- $custom_text_user_votes = htmlentities("$option[custom_text_user_voted]");
302
 
303
- ?>
 
 
 
 
 
 
304
 
305
  <div class="yasr-onoffswitch-big">
306
- <input type="checkbox" name="yasr_general_options[text_before_stars]" class="yasr-onoffswitch-checkbox" id="yasr-general-options-text-before-stars-switch" <?php if ($option['text_before_stars']==1) echo " checked='checked' "; ?> >
 
 
 
 
307
  <label class="yasr-onoffswitch-label" for="yasr-general-options-text-before-stars-switch">
308
  <span class="yasr-onoffswitch-inner"></span>
309
  <span class="yasr-onoffswitch-switch"></span>
@@ -312,54 +508,78 @@ function yasr_settings_tabs($active_tab) {
312
 
313
  <br /> <br />
314
 
315
- <input type='text' name='yasr_general_options[text_before_overall]' id="yasr-general-options-custom-text-before-overall" class='yasr-general-options-text-before' <?php printf('value="%s"', $text_before_overall); ?> maxlength="40"/>
316
- <?php _e('Custom text to display before Overall Rating', 'yet-another-stars-rating')?>
 
 
 
 
317
 
318
  <br /> <br /> <br />
319
 
320
- <input type='text' name='yasr_general_options[text_before_visitor_rating]' id="yasr-general-options-custom-text-before-visitor" class='yasr-general-options-text-before' <?php printf('value="%s"', $text_before_visitor_rating); ?> maxlength="80"/>
321
- <?php _e('Custom text to display BEFORE Visitor Rating', 'yet-another-stars-rating')?>
 
 
 
 
322
 
323
  <br /> <br />
324
 
325
 
326
- <input type='text' name='yasr_general_options[text_after_visitor_rating]' id="yasr-general-options-custom-text-after-visitor" class='yasr-general-options-text-before' <?php printf('value="%s"', $text_after_visitor_rating); ?> maxlength="80"/>
327
- <?php _e('Custom text to display AFTER Visitor Rating', 'yet-another-stars-rating')?>
 
 
 
 
328
 
329
  <br /> <br /> <br />
330
 
331
- <input type='text' name='yasr_general_options[custom_text_user_voted]' id="yasr-general-options-custom-text-already-rated" class='yasr-general-options-text-before' <?php printf('value="%s"', $custom_text_user_votes); ?> maxlength="60"/>
332
- <?php _e('Custom text to display when a non logged user has already rated', 'yet-another-stars-rating')?>
 
 
 
 
333
 
334
 
335
  <br /> <br />
336
 
337
- <a href="#" id="yasr-doc-custom-text-link"><?php _e('Help', 'yet-another-stars-rating'); ?></a>
 
 
338
 
339
  <div id="yasr-doc-custom-text-div" class="yasr-help-box-settings">
340
 
341
- <?php _e('In the first field you can use %overall_rating% pattern to show the overall rating.', 'yet-another-stars-rating');?>
 
 
342
 
343
  <br /> <br />
344
 
345
- <?php _e('In the Second and Third fields you can use %total_count% pattern to show the total count, and %average% pattern to show the average', 'yet-another-stars-rating');?>
 
 
346
 
347
  </div>
348
 
349
  <p>&nbsp;</p>
350
 
351
- <?php
352
-
353
- submit_button( __('Save Settings') );
354
-
355
- }
356
-
357
- function yasr_visitors_stats_callback($option) {
358
 
359
- ?>
 
 
360
 
361
  <div class="yasr-onoffswitch-big">
362
- <input type="checkbox" name="yasr_general_options[visitors_stats]" class="yasr-onoffswitch-checkbox" id="yasr-general-options-visitors-stats-switch" <?php if ($option['visitors_stats']==='yes') echo " checked='checked' "; ?> >
 
 
 
 
363
  <label class="yasr-onoffswitch-label" for="yasr-general-options-visitors-stats-switch">
364
  <span class="yasr-onoffswitch-inner"></span>
365
  <span class="yasr-onoffswitch-switch"></span>
@@ -374,37 +594,52 @@ function yasr_settings_tabs($active_tab) {
374
 
375
  <hr>
376
 
377
- <?php
378
-
379
- }
380
-
381
- function yasr_allow_only_logged_in_callback($option) {
382
 
383
- ?>
 
 
384
 
385
- <input type='radio' name='yasr_general_options[allowed_user]' value='logged_only' class='yasr_auto_insert_loggedonly' <?php if ($option['allowed_user']==='logged_only') echo " checked=\"checked\" "; ?> />
386
- <?php _e('Allow only logged-in users', 'yet-another-stars-rating')?>
 
 
 
 
 
 
387
  <br />
388
 
389
- <input type='radio' name='yasr_general_options[allowed_user]' value='allow_anonymous' class='yasr_auto_insert_loggedonly' <?php if ($option['allowed_user']==='allow_anonymous') echo " checked=\"checked\" "; ?> />
390
- <?php _e('Allow everybody (logged in and anonymous)', 'yet-another-stars-rating')?>
 
 
 
 
 
 
391
  <br />
392
 
393
  <p>&nbsp;</p>
394
 
395
  <hr>
396
 
397
- <?php
398
-
399
- } //End function
400
-
401
- function yasr_enable_ip_callback($option) {
402
 
403
- ?>
 
 
 
404
 
405
 
406
  <div class="yasr-onoffswitch-big">
407
- <input type="checkbox" name="yasr_general_options[enable_ip]" class="yasr-onoffswitch-checkbox" id="yasr-general-options-enable-ip-switch" <?php if ($option['enable_ip']==='yes') echo " checked='checked' "; ?> >
 
 
 
 
408
  <label class="yasr-onoffswitch-label" for="yasr-general-options-enable-ip-switch">
409
  <span class="yasr-onoffswitch-inner"></span>
410
  <span class="yasr-onoffswitch-switch"></span>
@@ -413,56 +648,64 @@ function yasr_settings_tabs($active_tab) {
413
 
414
  <br />
415
 
416
- <?php
417
-
418
- $string = sprintf(__('Please note that to comply with the %s EU law, you must warn your users that you\'re storing their ip', 'yet-another-stars-rating'), '<a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>');
419
-
420
- echo $string;
421
-
422
- ?>
423
 
424
  <br />
425
 
426
  <hr>
427
 
428
- <?php
429
-
430
- } //End function
431
-
432
- function yasr_choose_snippet_callback($option) {
433
-
434
- $blogposting_organization_name = htmlspecialchars("$option[blogposting_organization_name]");
435
-
436
- $blogposting_organization_logo = htmlspecialchars("$option[blogposting_organization_logo]");
437
 
438
- ?>
 
 
 
 
 
439
 
440
- <strong><?php _e('Which rich snippet do you want to use?', 'yet-another-stars-rating'); ?></strong>
 
 
441
 
442
  <div class="yasr-indented-answer">
443
- <input type="radio" name="yasr_general_options[snippet]" value="overall_rating" class="yasr_choose_snippet" <?php if ($option['snippet']==='overall_rating') echo " checked=\"checked\" "; ?> >
444
- <?php _e('Review Rating', 'yet-another-stars-rating') ?>
 
 
 
 
 
 
445
  <br />
446
 
447
- <input type="radio" name="yasr_general_options[snippet]" value="visitor_rating" class="yasr_choose_snippet" <?php if ($option['snippet']==='visitor_rating') echo " checked=\"checked\" "; ?> >
448
- <?php _e('Aggregate Rating', 'yet-another-stars-rating')?>
 
 
 
 
 
 
449
  <br />
450
 
451
  <p>&nbsp;</p>
452
 
453
- <a href="#" id="yasr-snippet-explained-link"><?php _e("What is this?", 'yet-another-stars-rating') ?></a>
 
 
454
 
455
  <div id="yasr-snippet-explained" class="yasr-help-box-settings">
456
- <?php
457
-
458
- _e("If you select \"Review Rating\", your site will be indexed from search engines like this: ", 'yet-another-stars-rating');
459
- echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_review.png>";
460
-
461
- echo "<br /> <br />";
462
-
463
- _e("If, instead, you choose \"Aggregate Rating\", your site will be indexed like this", 'yet-another-stars-rating');
464
- echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_aggregate.jpg>";
465
- ?>
466
  </div>
467
 
468
  </div>
@@ -471,49 +714,89 @@ function yasr_settings_tabs($active_tab) {
471
 
472
  <br />
473
 
474
- <strong><?php _e('Select default item type for all post or pages', 'yet-another-stars-rating'); ?></strong>
 
 
475
 
476
  <div class="yasr-indented-answer" id="yasr-choose-snippet-type">
477
 
478
- <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Product" class="yasr_choose_snippet" <?php if ($option['snippet_itemtype']==='Product') echo " checked=\"checked\" "; ?> >
479
- <?php _e('Product', 'yet-another-stars-rating') ?>
 
 
 
 
 
 
480
  <br />
481
 
482
- <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Place" class="yasr_choose_snippet" <?php if ($option['snippet_itemtype']==='Place') echo " checked=\"checked\" "; ?> >
483
- <?php _e('Place', 'yet-another-stars-rating')?>
 
 
 
 
 
 
484
  <br />
485
 
486
- <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Recipe" class="yasr_choose_snippet" <?php if ($option['snippet_itemtype']==='Recipe') echo " checked=\"checked\" "; ?> >
487
- <?php _e('Recipe', 'yet-another-stars-rating')?>
 
 
 
 
 
 
488
  <br />
489
 
490
- <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Other" class="yasr_choose_snippet" id="yasr_choose_snippet_blogposting" <?php if ($option['snippet_itemtype']==='Other') echo " checked=\"checked\" "; ?> >
491
- <?php _e('BlogPosting')?>
 
 
 
 
 
 
492
  <br />
493
 
494
 
495
  <div class="yasr-help-box-settings" id="yasr-blogPosting-additional-info" style="display:block">
496
 
497
- <?php _e("If you need to use BlogPosting as item type, even for just one post or page, please fill these forms", "yet-another-stars-rating"); ?>
 
 
498
 
499
  <br /> <br />
500
 
501
- <input type='text' name='yasr_general_options[blogposting_organization_name]' id="yasr-general-options-blogposting-organization-name" class="yasr-blogPosting-additional-info-inputs" <?php printf('value="%s"', $blogposting_organization_name); ?> maxlength="180"/>
502
- <?php _e('Publisher name (e.g. Google)', 'yet-another-stars-rating')?>
 
 
 
 
503
 
504
  <br /> <br />
505
 
506
- <input type='text' name='yasr_general_options[blogposting_organization_logo]' id="yasr-general-options-blogposting-organization-logo" class="yasr-blogPosting-additional-info-inputs" <?php printf('value="%s"', $blogposting_organization_logo); ?> maxlength="300"/>
507
- <?php _e('Logo Url (if empty siteicon will be used instead)', 'yet-another-stars-rating')?>
 
 
 
 
508
 
509
  </div>
510
 
511
 
512
  <br />
513
 
514
- <small><?php _e('You can always change it in the single post or page.', 'yet-another-stars-rating'); ?></small>
 
 
515
  <br />
516
- <small><?php _e('This will affect only the post/page where you didn\'t change manually the itemtype yet.', 'yet-another-stars-rating'); ?> </small>
 
 
517
 
518
  <p>&nbsp;</p>
519
 
@@ -524,127 +807,116 @@ function yasr_settings_tabs($active_tab) {
524
 
525
  <hr>
526
 
527
- <?php
528
-
529
- } //End function yasr_choose_snippet_callback
530
-
531
- function yasr_choose_overall_rating_method_callback($option) {
532
 
533
- ?>
 
 
 
534
 
535
- <input type="radio" name="yasr_general_options[metabox_overall_rating]" value="stars" class="yasr_choose_overall_rating_method" <?php if ($option['metabox_overall_rating']==='stars') echo " checked=\"checked\" "; ?> >
536
- <?php _e('Stars', 'yet-another-stars-rating') ?>
 
 
 
 
 
 
537
  <br />
538
 
539
- <input type="radio" name="yasr_general_options[metabox_overall_rating]" value="numbers" class="yasr_choose_overall_rating_method" <?php if ($option['metabox_overall_rating']==='numbers') echo " checked=\"checked\" "; ?> >
540
- <?php _e('Numbers', 'yet-another-stars-rating')?>
 
 
 
 
 
 
541
  <br />
542
 
543
  <p>&nbsp;</p>
544
 
545
- <?php
546
-
547
- }
548
-
549
- function yasr_general_options_sanitize($option) {
550
-
551
- //Array to return
552
- $output = array();
553
-
554
- // Loop through each of the incoming options
555
- foreach( $option as $key => $value ) {
556
-
557
- // Check to see if the current option has a value. If so, process it.
558
- if( isset( $option[$key] ) ) {
559
-
560
- // Strip all HTML and PHP tags and properly handle quoted strings
561
- $output[$key] = strip_tags( stripslashes( $option[ $key ] ) );
562
-
563
- if ($key=='blogposting_organization_logo') {
564
-
565
- //if is not a valid url get_site_icon_url instead
566
- if (filter_var($value, FILTER_VALIDATE_URL) === FALSE) {
567
- $output[$key] = get_site_icon_url();
568
- }
569
-
570
- }
571
-
572
- } // end if
573
-
574
- } // end foreach
575
-
576
- //if in array doesn't exists [auto_insert_enabled] key, create it and set to 0
577
- if(!array_key_exists('auto_insert_enabled', $output)) {
578
- $output['auto_insert_enabled'] = 0;
579
- }
580
- //if exists value must be 1
581
- else {
582
- $output['auto_insert_enabled'] = 1;
583
- }
584
-
585
-
586
- //Same as above but for [show_overall_in_loop] key
587
- if(!array_key_exists('show_overall_in_loop', $output)) {
588
- $output['show_overall_in_loop'] = 'disabled';
589
- }
590
- //if exists must be string 'enabled'
591
- else {
592
- $output['show_overall_in_loop'] = 'enabled';
593
- }
594
-
595
-
596
- //Same as above but for [show_visitor_votes_in_loop] key
597
- if(!array_key_exists('show_visitor_votes_in_loop', $output)) {
598
- $output['show_visitor_votes_in_loop'] = 'disabled';
599
- }
600
- //if exists must be string 'enabled'
601
- else {
602
- $output['show_visitor_votes_in_loop'] = 'enabled';
603
- }
604
-
605
- //Same as above but for text_before_stars key
606
- if(!array_key_exists('text_before_stars', $output)) {
607
- $output['text_before_stars'] = 0;
608
- }
609
- //if exists must be 1
610
- else {
611
- $output['text_before_stars'] = 1;
612
- }
613
-
614
-
615
- //Same as above but for visitors_stats key
616
- if(!array_key_exists('visitors_stats', $output)) {
617
- $output['visitors_stats'] = 'no';
618
- }
619
- //if exists must be string 'yes'
620
- else {
621
- $output['visitors_stats'] = 'yes';
622
- }
623
-
624
- //Same as above but for enable_ip key
625
- if(!array_key_exists('enable_ip', $output)) {
626
- $output['enable_ip'] = 'no';
627
- }
628
- //if exists must be string 'yes'
629
- else {
630
- $output['enable_ip'] = 'yes';
631
- }
632
-
633
- return $output;
634
-
635
- }
636
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
 
638
  /************ End Yasr General Settings ************/
639
-
640
-
641
  //include multiset functions
642
- include( YASR_ABSOLUTE_PATH . '/lib/settings/yasr-settings-functions-multiset.php' );
643
-
644
  //include style functions
645
- include( YASR_ABSOLUTE_PATH . '/lib/settings/yasr-settings-functions-style.php' );
646
-
647
  //Misc
648
- include( YASR_ABSOLUTE_PATH . '/lib/settings/yasr-settings-functions-misc.php' );
649
-
650
- ?>
17
  You should have received a copy of the GNU General Public License
18
  along with this program. If not, see <http://www.gnu.org/licenses/>
19
  */
20
+ if ( !defined( 'ABSPATH' ) ) {
21
+ exit( 'You\'re not allowed to see this page' );
22
+ }
23
+ // Exit if accessed directly
24
+ function yasr_settings_tabs( $active_tab )
25
+ {
26
+ ?>
27
 
28
+ <h2 class="nav-tab-wrapper yasr-no-underline">
 
 
29
 
30
+ <a href="?page=yasr_settings_page&tab=general_settings" class="nav-tab <?php
31
+ if ( $active_tab === 'general_settings' ) {
32
+ echo 'nav-tab-active' ;
33
+ }
34
+ ?>" >
35
+ <?php
36
+ _e( "General Settings", 'yet-another-stars-rating' );
37
+ ?>
38
+ </a>
39
+
40
+ <a href="?page=yasr_settings_page&tab=manage_multi" class="nav-tab <?php
41
+ if ( $active_tab === 'manage_multi' ) {
42
+ echo 'nav-tab-active' ;
43
+ }
44
+ ?>" >
45
+ <?php
46
+ _e( "Multi Sets", 'yet-another-stars-rating' );
47
  ?>
48
+ </a>
49
+
50
+ <a href="?page=yasr_settings_page&tab=style_options" class="nav-tab <?php
51
+ if ( $active_tab === 'style_options' ) {
52
+ echo 'nav-tab-active' ;
53
+ }
54
+ ?>" >
55
+ <?php
56
+ _e( "Aspect & Styles", 'yet-another-stars-rating' );
57
+ ?>
58
+ </a>
59
 
 
60
 
61
+ <?php
62
+ do_action( 'yasr_add_settings_tab', $active_tab );
63
+ ?>
 
64
 
65
  </h2>
66
 
67
+ <?php
68
  }
69
 
70
  /************ Add yasr general options ***********/
71
+ add_action( 'admin_init', 'yasr_general_options_init' );
72
+ //This is for general options
73
+ function yasr_general_options_init()
74
+ {
75
+ register_setting(
76
+ 'yasr_general_options_group',
77
+ // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
78
+ 'yasr_general_options',
79
+ //The name of an option to sanitize and save.
80
+ 'yasr_general_options_sanitize'
81
+ );
82
+ $option = get_option( 'yasr_general_options' );
83
+ //This is to avoid undefined offset
84
+
85
+ if ( $option && $option['auto_insert_enabled'] == 0 ) {
86
+ $option['auto_insert_what'] = 'overall_rating';
87
+ $option['auto_insert_where'] = 'top';
88
+ $option['auto_insert_exclude_pages'] = 'yes';
89
+ $option['auto_insert_size'] = 'large';
90
+ $option['auto_insert_custom_post_only'] = 'no';
91
+ }
92
+
93
+ //This is to avoid undefined offset
94
+
95
+ if ( $option && $option['text_before_stars'] == 0 ) {
96
+ $option['text_before_overall'] = '';
97
+ $option['text_before_visitor_rating'] = '';
98
+ $option['text_after_visitor_rating'] = '';
99
+ $option['custom_text_user_voted'] = '';
100
+ }
101
+
102
+ //if it's not blogposting avoid undefined variable
103
+ if ( !isset( $option['blogposting_organization_name'] ) ) {
104
+ $option['blogposting_organization_name'] = get_bloginfo( 'name' );
105
+ }
106
+ if ( !isset( $option['blogposting_organization_logo'] ) ) {
107
+ $option['blogposting_organization_logo'] = get_site_icon_url();
108
+ }
109
+ add_settings_section(
110
+ 'yasr_general_options_section_id',
111
+ __( 'General settings', 'yet-another-stars-rating' ),
112
+ 'yasr_section_callback',
113
+ 'yasr_general_settings_tab'
114
+ );
115
+ add_settings_field(
116
+ 'yasr_use_auto_insert_id',
117
+ __( 'Auto insert options', 'yet-another-stars-rating' ),
118
+ 'yasr_auto_insert_callback',
119
+ 'yasr_general_settings_tab',
120
+ 'yasr_general_options_section_id',
121
+ $option
122
+ );
123
+ add_settings_field(
124
+ 'yasr_show_overall_in_loop',
125
+ __( 'Show "Overall Rating" in Archive Page?', 'yet-another-stars-rating' ),
126
+ 'yasr_show_overall_in_loop_callback',
127
+ 'yasr_general_settings_tab',
128
+ 'yasr_general_options_section_id',
129
+ $option
130
+ );
131
+ add_settings_field(
132
+ 'yasr_show_visitor_votes_in_loop',
133
+ __( 'Show "Visitor Votes" in Archive Page?', 'yet-another-stars-rating' ),
134
+ 'yasr_show_visitor_votes_in_loop_callback',
135
+ 'yasr_general_settings_tab',
136
+ 'yasr_general_options_section_id',
137
+ $option
138
+ );
139
+ add_settings_field(
140
+ 'yasr_custom_text',
141
+ __( 'Insert custom text to show before / after stars', 'yet-another-stars-rating' ),
142
+ 'yasr_custom_text_callback',
143
+ 'yasr_general_settings_tab',
144
+ 'yasr_general_options_section_id',
145
+ $option
146
+ );
147
+ add_settings_field(
148
+ 'yasr_visitors_stats',
149
+ __( 'Do you want show stats for visitors votes?', 'yet-another-stars-rating' ),
150
+ 'yasr_visitors_stats_callback',
151
+ 'yasr_general_settings_tab',
152
+ 'yasr_general_options_section_id',
153
+ $option
154
+ );
155
+ add_settings_field(
156
+ 'yasr_allow_only_logged_in_id',
157
+ __( 'Allow only logged in user to vote?', 'yet-another-stars-rating' ),
158
+ 'yasr_allow_only_logged_in_callback',
159
+ 'yasr_general_settings_tab',
160
+ 'yasr_general_options_section_id',
161
+ $option
162
+ );
163
+ add_settings_field(
164
+ 'yasr_enable_ip',
165
+ __( 'Do you want to save ip address?', 'yet-another-stars-rating' ),
166
+ 'yasr_enable_ip_callback',
167
+ 'yasr_general_settings_tab',
168
+ 'yasr_general_options_section_id',
169
+ $option
170
+ );
171
+ add_settings_field(
172
+ 'yasr_choose_snippet_id',
173
+ __( 'Rich snippet options', 'yet-another-stars-rating' ),
174
+ 'yasr_choose_snippet_callback',
175
+ 'yasr_general_settings_tab',
176
+ 'yasr_general_options_section_id',
177
+ $option
178
+ );
179
+ add_settings_field(
180
+ 'yasr_choose_overall_rating_method',
181
+ __( 'How do you want to rate "Overall Rating"?', 'yet-another-stars-rating' ),
182
+ 'yasr_choose_overall_rating_method_callback',
183
+ 'yasr_general_settings_tab',
184
+ 'yasr_general_options_section_id',
185
+ $option
186
+ );
187
+ }
188
 
189
+ function yasr_section_callback()
190
+ {
191
+ //_e('Manage auto insert', 'yet-another-stars-rating');
192
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
+ function yasr_auto_insert_callback( $option )
195
+ {
196
+ ?>
197
 
198
+ <strong><?php
199
+ _e( 'Use Auto Insert?', 'yet-another-stars-rating' );
200
+ ?></strong>
201
 
202
 
203
  <div class="yasr-onoffswitch-big">
204
+ <input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox" value="1" id="yasr_auto_insert_switch" <?php
205
+ if ( $option['auto_insert_enabled'] == 1 ) {
206
+ echo " checked='checked' " ;
207
+ }
208
+ ?> >
209
  <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
210
  <span class="yasr-onoffswitch-inner"></span>
211
  <span class="yasr-onoffswitch-switch"></span>
214
 
215
  <p>&nbsp;</p>
216
 
217
+ <strong><?php
218
+ _e( 'What?', 'yet-another-stars-rating' );
219
+ ?></strong>
220
 
221
  <div class="yasr-indented-answer">
222
 
223
+ <input type="radio" name="yasr_general_options[auto_insert_what]" value="overall_rating" class="yasr-auto-insert-options-class" <?php
224
+ if ( $option['auto_insert_what'] === 'overall_rating' ) {
225
+ echo " checked=\"checked\" " ;
226
+ }
227
+ ?> >
228
+ <?php
229
+ _e( 'Overall Rating / Author Rating', 'yet-another-stars-rating' );
230
+ ?>
231
  <br />
232
 
233
+ <input type="radio" name="yasr_general_options[auto_insert_what]" value="visitor_rating" class="yasr-auto-insert-options-class" <?php
234
+ if ( $option['auto_insert_what'] === 'visitor_rating' ) {
235
+ echo " checked=\"checked\" " ;
236
+ }
237
+ ?> >
238
+ <?php
239
+ _e( 'Visitor Votes', 'yet-another-stars-rating' );
240
+ ?>
241
  <br />
242
 
243
+ <input type="radio" name="yasr_general_options[auto_insert_what]" value="both" class="yasr-auto-insert-options-class" <?php
244
+ if ( $option['auto_insert_what'] === 'both' ) {
245
+ echo " checked=\"checked\" " ;
246
+ }
247
+ ?> >
248
+ <?php
249
+ _e( 'Both', 'yet-another-stars-rating' );
250
+ ?>
251
 
252
  <p>&nbsp;</p>
253
 
254
  </div>
255
 
256
+ <strong><?php
257
+ _e( 'Where?', 'yet-another-stars-rating' );
258
+ ?></strong>
259
 
260
  <div class="yasr-indented-answer">
261
 
262
+ <input type="radio" name="yasr_general_options[auto_insert_where]" value="top" class="yasr-auto-insert-options-class" <?php
263
+ if ( $option['auto_insert_where'] === 'top' ) {
264
+ echo " checked=\"checked\" " ;
265
+ }
266
+ ?> >
267
+ <?php
268
+ _e( 'Before the post', 'yet-another-stars-rating' );
269
+ ?>
270
  <br />
271
 
272
+ <input type="radio" name="yasr_general_options[auto_insert_where]" value="bottom" class="yasr-auto-insert-options-class" <?php
273
+ if ( $option['auto_insert_where'] === 'bottom' ) {
274
+ echo " checked=\"checked\" " ;
275
+ }
276
+ ?> >
277
+ <?php
278
+ _e( 'After the post', 'yet-another-stars-rating' );
279
+ ?>
280
  <br />
281
 
282
  <p>&nbsp;</p>
283
 
284
  </div>
285
 
286
+ <strong><?php
287
+ _e( 'Size', 'yet-another-stars-rating' );
288
+ ?></strong>
289
 
290
  <div class="yasr-indented-answer">
291
 
292
  <div class="yasr-option-size">
293
+ <input type="radio" name="yasr_general_options[auto_insert_size]" value="small" class="yasr-auto-insert-options-class" <?php
294
+ if ( $option['auto_insert_size'] === 'small' ) {
295
+ echo " checked=\"checked\" " ;
296
+ }
297
+ ?> >
298
+ <img src="<?php
299
+ echo YASR_IMG_DIR . "yasr-stars-small.png" ;
300
+ ?>" class="yasr-img-option-size"><span class="yasr-text-options-size"><?php
301
+ _e( 'Small', 'yet-another-stars-rating' );
302
+ ?></span>
303
  </div>
304
 
305
  <div class="yasr-option-size">
306
+ <input type="radio" name="yasr_general_options[auto_insert_size]" value="medium" class="yasr-auto-insert-options-class" <?php
307
+ if ( $option['auto_insert_size'] === 'medium' ) {
308
+ echo " checked=\"checked\" " ;
309
+ }
310
+ ?> >
311
+ <img src="<?php
312
+ echo YASR_IMG_DIR . "yasr-stars-medium.png" ;
313
+ ?>" class="yasr-img-option-size"><span class="yasr-text-options-size"><?php
314
+ _e( 'Medium', 'yet-another-stars-rating' );
315
+ ?></span>
316
  </div>
317
 
318
  <div class="yasr-option-size">
319
+ <input type="radio" name="yasr_general_options[auto_insert_size]" value="large" class="yasr-auto-insert-options-class" <?php
320
+ if ( $option['auto_insert_size'] === 'large' ) {
321
+ echo " checked=\"checked\" " ;
322
+ }
323
+ ?> >
324
+ <img src="<?php
325
+ echo YASR_IMG_DIR . "yasr-stars-large.png" ;
326
+ ?>" class="yasr-img-option-size"><span class="yasr-text-options-size"><?php
327
+ _e( 'Large', 'yet-another-stars-rating' );
328
+ ?></span>
329
  </div>
330
 
331
  <p>&nbsp;</p>
332
 
333
  </div>
334
 
335
+ <strong><?php
336
+ _e( 'Exclude Pages?', 'yet-another-stars-rating' );
337
+ ?></strong>
338
 
339
  <div class="yasr-indented-answer">
340
+ <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="yes" class="yasr-auto-insert-options-class" <?php
341
+ if ( $option['auto_insert_exclude_pages'] === 'yes' ) {
342
+ echo " checked=\"checked\" " ;
343
+ }
344
+ ?> >
345
+ <?php
346
+ _e( 'Yes', 'yet-another-stars-rating' );
347
+ ?>
348
 
349
  &nbsp;&nbsp;&nbsp;
350
 
351
+ <input type="radio" name="yasr_general_options[auto_insert_exclude_pages]" value="no" class="yasr-auto-insert-options-class" <?php
352
+ if ( $option['auto_insert_exclude_pages'] === 'no' ) {
353
+ echo " checked=\"checked\" " ;
354
+ }
355
+ ?> >
356
+ <?php
357
+ _e( 'No', 'yet-another-stars-rating' );
358
+ ?>
359
  <br />
360
 
361
  <p>&nbsp;</p>
362
 
363
  </div>
364
 
365
+ <?php
366
+ $custom_post_types = yasr_get_custom_post_type( 'bool' );
367
+
368
+ if ( $custom_post_types ) {
369
+ ?>
370
+ <strong><?php
371
+ _e( 'Use only in custom post types?', 'yet-another-stars-rating' );
372
+ ?></strong>
373
  <div class="yasr-indented-answer">
374
+ <input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="yes" class="yasr-auto-insert-options-class" <?php
375
+ if ( $option['auto_insert_custom_post_only'] === 'yes' ) {
376
+ echo " checked=\"checked\" " ;
377
+ }
378
+ ?> >
379
+ <?php
380
+ _e( 'Yes', 'yet-another-stars-rating' );
381
+ ?>
382
 
383
  &nbsp;&nbsp;&nbsp;
384
 
385
+ <input type="radio" name="yasr_general_options[auto_insert_custom_post_only]" value="no" class="yasr-auto-insert-options-class" <?php
386
+ if ( $option['auto_insert_custom_post_only'] === 'no' ) {
387
+ echo " checked=\"checked\" " ;
388
+ }
389
+ ?> >
390
+ <?php
391
+ _e( 'No', 'yet-another-stars-rating' );
392
+ ?>
393
 
394
  <p>
395
 
396
+ <?php
397
+ _e( "You see this because you use custom post types.", 'yet-another-stars-rating' );
398
+ ?>
399
  <br/>
400
+ <?php
401
+ _e( "If you want to use auto insert only in custom post types, choose Yes", 'yet-another-stars-rating' );
402
+ ?>
403
 
404
  <p>&nbsp;</p>
405
 
406
  </div>
407
 
408
+ <?php
409
+ } else {
410
+ ?>
 
 
 
411
 
412
  <input type="hidden" name="yasr_general_options[auto_insert_custom_post_only]" value="no" ?>
413
 
414
+ <?php
415
+ }
416
+
417
+ ?>
 
 
 
 
 
 
 
418
 
 
419
 
420
+ <?php
421
+ submit_button( __( 'Save Settings' ) );
422
+ }
423
 
424
+ //End yasr_auto_insert_callback
425
+ function yasr_show_overall_in_loop_callback( $option )
426
+ {
427
+ ?>
428
 
429
  <div class="yasr-onoffswitch-big">
430
+ <input type="checkbox" name="yasr_general_options[show_overall_in_loop]" class="yasr-onoffswitch-checkbox" id="yasr-show-overall-in-loop-switch" <?php
431
+ if ( $option['show_overall_in_loop'] === 'enabled' ) {
432
+ echo " checked='checked' " ;
433
+ }
434
+ ?> >
435
  <label class="yasr-onoffswitch-label" for="yasr-show-overall-in-loop-switch">
436
  <span class="yasr-onoffswitch-inner"></span>
437
  <span class="yasr-onoffswitch-switch"></span>
441
  <br />
442
  <br />
443
 
444
+ <?php
445
+ _e( 'If you enable this, "Overall Rating" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating' );
446
+ ?>
447
 
448
  <p>&nbsp;</p>
449
 
451
 
452
  <hr>
453
 
454
+ <?php
455
+ }
 
 
 
456
 
457
+ function yasr_show_visitor_votes_in_loop_callback( $option )
458
+ {
459
+ ?>
460
 
461
  <div class="yasr-onoffswitch-big">
462
+ <input type="checkbox" name="yasr_general_options[show_visitor_votes_in_loop]" class="yasr-onoffswitch-checkbox" id="yasr-show-visitor-votes-in-loop-switch" <?php
463
+ if ( $option['show_visitor_votes_in_loop'] === 'enabled' ) {
464
+ echo " checked='checked' " ;
465
+ }
466
+ ?> >
467
  <label class="yasr-onoffswitch-label" for="yasr-show-visitor-votes-in-loop-switch">
468
  <span class="yasr-onoffswitch-inner"></span>
469
  <span class="yasr-onoffswitch-switch"></span>
473
  <br />
474
  <br />
475
 
476
+ <?php
477
+ _e( 'If you enable this, "Visitor Votes" will be showed not only in the single article or page, but also in pages like Home Page, category pages or archives.', 'yet-another-stars-rating' );
478
+ ?>
479
 
480
  <p>&nbsp;</p>
481
 
483
 
484
  <hr>
485
 
486
+ <?php
487
+ }
 
 
 
 
 
 
 
 
 
 
 
488
 
489
+ function yasr_custom_text_callback( $option )
490
+ {
491
+ $text_before_overall = htmlspecialchars( "{$option['text_before_overall']}" );
492
+ $text_before_visitor_rating = htmlspecialchars( "{$option['text_before_visitor_rating']}" );
493
+ $text_after_visitor_rating = htmlspecialchars( "{$option['text_after_visitor_rating']}" );
494
+ $custom_text_user_votes = htmlentities( "{$option['custom_text_user_voted']}" );
495
+ ?>
496
 
497
  <div class="yasr-onoffswitch-big">
498
+ <input type="checkbox" name="yasr_general_options[text_before_stars]" class="yasr-onoffswitch-checkbox" id="yasr-general-options-text-before-stars-switch" <?php
499
+ if ( $option['text_before_stars'] == 1 ) {
500
+ echo " checked='checked' " ;
501
+ }
502
+ ?> >
503
  <label class="yasr-onoffswitch-label" for="yasr-general-options-text-before-stars-switch">
504
  <span class="yasr-onoffswitch-inner"></span>
505
  <span class="yasr-onoffswitch-switch"></span>
508
 
509
  <br /> <br />
510
 
511
+ <input type='text' name='yasr_general_options[text_before_overall]' id="yasr-general-options-custom-text-before-overall" class='yasr-general-options-text-before' <?php
512
+ printf( 'value="%s"', $text_before_overall );
513
+ ?> maxlength="40"/>
514
+ <?php
515
+ _e( 'Custom text to display before Overall Rating', 'yet-another-stars-rating' );
516
+ ?>
517
 
518
  <br /> <br /> <br />
519
 
520
+ <input type='text' name='yasr_general_options[text_before_visitor_rating]' id="yasr-general-options-custom-text-before-visitor" class='yasr-general-options-text-before' <?php
521
+ printf( 'value="%s"', $text_before_visitor_rating );
522
+ ?> maxlength="80"/>
523
+ <?php
524
+ _e( 'Custom text to display BEFORE Visitor Rating', 'yet-another-stars-rating' );
525
+ ?>
526
 
527
  <br /> <br />
528
 
529
 
530
+ <input type='text' name='yasr_general_options[text_after_visitor_rating]' id="yasr-general-options-custom-text-after-visitor" class='yasr-general-options-text-before' <?php
531
+ printf( 'value="%s"', $text_after_visitor_rating );
532
+ ?> maxlength="80"/>
533
+ <?php
534
+ _e( 'Custom text to display AFTER Visitor Rating', 'yet-another-stars-rating' );
535
+ ?>
536
 
537
  <br /> <br /> <br />
538
 
539
+ <input type='text' name='yasr_general_options[custom_text_user_voted]' id="yasr-general-options-custom-text-already-rated" class='yasr-general-options-text-before' <?php
540
+ printf( 'value="%s"', $custom_text_user_votes );
541
+ ?> maxlength="60"/>
542
+ <?php
543
+ _e( 'Custom text to display when a non logged user has already rated', 'yet-another-stars-rating' );
544
+ ?>
545
 
546
 
547
  <br /> <br />
548
 
549
+ <a href="#" id="yasr-doc-custom-text-link"><?php
550
+ _e( 'Help', 'yet-another-stars-rating' );
551
+ ?></a>
552
 
553
  <div id="yasr-doc-custom-text-div" class="yasr-help-box-settings">
554
 
555
+ <?php
556
+ _e( 'In the first field you can use %overall_rating% pattern to show the overall rating.', 'yet-another-stars-rating' );
557
+ ?>
558
 
559
  <br /> <br />
560
 
561
+ <?php
562
+ _e( 'In the Second and Third fields you can use %total_count% pattern to show the total count, and %average% pattern to show the average', 'yet-another-stars-rating' );
563
+ ?>
564
 
565
  </div>
566
 
567
  <p>&nbsp;</p>
568
 
569
+ <?php
570
+ submit_button( __( 'Save Settings' ) );
571
+ }
 
 
 
 
572
 
573
+ function yasr_visitors_stats_callback( $option )
574
+ {
575
+ ?>
576
 
577
  <div class="yasr-onoffswitch-big">
578
+ <input type="checkbox" name="yasr_general_options[visitors_stats]" class="yasr-onoffswitch-checkbox" id="yasr-general-options-visitors-stats-switch" <?php
579
+ if ( $option['visitors_stats'] === 'yes' ) {
580
+ echo " checked='checked' " ;
581
+ }
582
+ ?> >
583
  <label class="yasr-onoffswitch-label" for="yasr-general-options-visitors-stats-switch">
584
  <span class="yasr-onoffswitch-inner"></span>
585
  <span class="yasr-onoffswitch-switch"></span>
594
 
595
  <hr>
596
 
597
+ <?php
598
+ }
 
 
 
599
 
600
+ function yasr_allow_only_logged_in_callback( $option )
601
+ {
602
+ ?>
603
 
604
+ <input type='radio' name='yasr_general_options[allowed_user]' value='logged_only' class='yasr_auto_insert_loggedonly' <?php
605
+ if ( $option['allowed_user'] === 'logged_only' ) {
606
+ echo " checked=\"checked\" " ;
607
+ }
608
+ ?> />
609
+ <?php
610
+ _e( 'Allow only logged-in users', 'yet-another-stars-rating' );
611
+ ?>
612
  <br />
613
 
614
+ <input type='radio' name='yasr_general_options[allowed_user]' value='allow_anonymous' class='yasr_auto_insert_loggedonly' <?php
615
+ if ( $option['allowed_user'] === 'allow_anonymous' ) {
616
+ echo " checked=\"checked\" " ;
617
+ }
618
+ ?> />
619
+ <?php
620
+ _e( 'Allow everybody (logged in and anonymous)', 'yet-another-stars-rating' );
621
+ ?>
622
  <br />
623
 
624
  <p>&nbsp;</p>
625
 
626
  <hr>
627
 
628
+ <?php
629
+ }
 
 
 
630
 
631
+ //End function
632
+ function yasr_enable_ip_callback( $option )
633
+ {
634
+ ?>
635
 
636
 
637
  <div class="yasr-onoffswitch-big">
638
+ <input type="checkbox" name="yasr_general_options[enable_ip]" class="yasr-onoffswitch-checkbox" id="yasr-general-options-enable-ip-switch" <?php
639
+ if ( $option['enable_ip'] === 'yes' ) {
640
+ echo " checked='checked' " ;
641
+ }
642
+ ?> >
643
  <label class="yasr-onoffswitch-label" for="yasr-general-options-enable-ip-switch">
644
  <span class="yasr-onoffswitch-inner"></span>
645
  <span class="yasr-onoffswitch-switch"></span>
648
 
649
  <br />
650
 
651
+ <?php
652
+ $string = sprintf( __( 'Please note that to comply with the %s EU law, you must warn your users that you\'re storing their ip', 'yet-another-stars-rating' ), '<a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>' );
653
+ echo $string ;
654
+ ?>
 
 
 
655
 
656
  <br />
657
 
658
  <hr>
659
 
660
+ <?php
661
+ }
 
 
 
 
 
 
 
662
 
663
+ //End function
664
+ function yasr_choose_snippet_callback( $option )
665
+ {
666
+ $blogposting_organization_name = htmlspecialchars( "{$option['blogposting_organization_name']}" );
667
+ $blogposting_organization_logo = htmlspecialchars( "{$option['blogposting_organization_logo']}" );
668
+ ?>
669
 
670
+ <strong><?php
671
+ _e( 'Which rich snippet do you want to use?', 'yet-another-stars-rating' );
672
+ ?></strong>
673
 
674
  <div class="yasr-indented-answer">
675
+ <input type="radio" name="yasr_general_options[snippet]" value="overall_rating" class="yasr_choose_snippet" <?php
676
+ if ( $option['snippet'] === 'overall_rating' ) {
677
+ echo " checked=\"checked\" " ;
678
+ }
679
+ ?> >
680
+ <?php
681
+ _e( 'Review Rating', 'yet-another-stars-rating' );
682
+ ?>
683
  <br />
684
 
685
+ <input type="radio" name="yasr_general_options[snippet]" value="visitor_rating" class="yasr_choose_snippet" <?php
686
+ if ( $option['snippet'] === 'visitor_rating' ) {
687
+ echo " checked=\"checked\" " ;
688
+ }
689
+ ?> >
690
+ <?php
691
+ _e( 'Aggregate Rating', 'yet-another-stars-rating' );
692
+ ?>
693
  <br />
694
 
695
  <p>&nbsp;</p>
696
 
697
+ <a href="#" id="yasr-snippet-explained-link"><?php
698
+ _e( "What is this?", 'yet-another-stars-rating' );
699
+ ?></a>
700
 
701
  <div id="yasr-snippet-explained" class="yasr-help-box-settings">
702
+ <?php
703
+ _e( "If you select \"Review Rating\", your site will be indexed from search engines like this: ", 'yet-another-stars-rating' );
704
+ echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_review.png>" ;
705
+ echo "<br /> <br />" ;
706
+ _e( "If, instead, you choose \"Aggregate Rating\", your site will be indexed like this", 'yet-another-stars-rating' );
707
+ echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr_aggregate.jpg>" ;
708
+ ?>
 
 
 
709
  </div>
710
 
711
  </div>
714
 
715
  <br />
716
 
717
+ <strong><?php
718
+ _e( 'Select default item type for all post or pages', 'yet-another-stars-rating' );
719
+ ?></strong>
720
 
721
  <div class="yasr-indented-answer" id="yasr-choose-snippet-type">
722
 
723
+ <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Product" class="yasr_choose_snippet" <?php
724
+ if ( $option['snippet_itemtype'] === 'Product' ) {
725
+ echo " checked=\"checked\" " ;
726
+ }
727
+ ?> >
728
+ <?php
729
+ _e( 'Product', 'yet-another-stars-rating' );
730
+ ?>
731
  <br />
732
 
733
+ <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Place" class="yasr_choose_snippet" <?php
734
+ if ( $option['snippet_itemtype'] === 'Place' ) {
735
+ echo " checked=\"checked\" " ;
736
+ }
737
+ ?> >
738
+ <?php
739
+ _e( 'Place', 'yet-another-stars-rating' );
740
+ ?>
741
  <br />
742
 
743
+ <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Recipe" class="yasr_choose_snippet" <?php
744
+ if ( $option['snippet_itemtype'] === 'Recipe' ) {
745
+ echo " checked=\"checked\" " ;
746
+ }
747
+ ?> >
748
+ <?php
749
+ _e( 'Recipe', 'yet-another-stars-rating' );
750
+ ?>
751
  <br />
752
 
753
+ <input type="radio" name="yasr_general_options[snippet_itemtype]" value="Other" class="yasr_choose_snippet" id="yasr_choose_snippet_blogposting" <?php
754
+ if ( $option['snippet_itemtype'] === 'Other' ) {
755
+ echo " checked=\"checked\" " ;
756
+ }
757
+ ?> >
758
+ <?php
759
+ _e( 'BlogPosting' );
760
+ ?>
761
  <br />
762
 
763
 
764
  <div class="yasr-help-box-settings" id="yasr-blogPosting-additional-info" style="display:block">
765
 
766
+ <?php
767
+ _e( "If you need to use BlogPosting as item type, even for just one post or page, please fill these forms", "yet-another-stars-rating" );
768
+ ?>
769
 
770
  <br /> <br />
771
 
772
+ <input type='text' name='yasr_general_options[blogposting_organization_name]' id="yasr-general-options-blogposting-organization-name" class="yasr-blogPosting-additional-info-inputs" <?php
773
+ printf( 'value="%s"', $blogposting_organization_name );
774
+ ?> maxlength="180"/>
775
+ <?php
776
+ _e( 'Publisher name (e.g. Google)', 'yet-another-stars-rating' );
777
+ ?>
778
 
779
  <br /> <br />
780
 
781
+ <input type='text' name='yasr_general_options[blogposting_organization_logo]' id="yasr-general-options-blogposting-organization-logo" class="yasr-blogPosting-additional-info-inputs" <?php
782
+ printf( 'value="%s"', $blogposting_organization_logo );
783
+ ?> maxlength="300"/>
784
+ <?php
785
+ _e( 'Logo Url (if empty siteicon will be used instead)', 'yet-another-stars-rating' );
786
+ ?>
787
 
788
  </div>
789
 
790
 
791
  <br />
792
 
793
+ <small><?php
794
+ _e( 'You can always change it in the single post or page.', 'yet-another-stars-rating' );
795
+ ?></small>
796
  <br />
797
+ <small><?php
798
+ _e( 'This will affect only the post/page where you didn\'t change manually the itemtype yet.', 'yet-another-stars-rating' );
799
+ ?> </small>
800
 
801
  <p>&nbsp;</p>
802
 
807
 
808
  <hr>
809
 
810
+ <?php
811
+ }
 
 
 
812
 
813
+ //End function yasr_choose_snippet_callback
814
+ function yasr_choose_overall_rating_method_callback( $option )
815
+ {
816
+ ?>
817
 
818
+ <input type="radio" name="yasr_general_options[metabox_overall_rating]" value="stars" class="yasr_choose_overall_rating_method" <?php
819
+ if ( $option['metabox_overall_rating'] === 'stars' ) {
820
+ echo " checked=\"checked\" " ;
821
+ }
822
+ ?> >
823
+ <?php
824
+ _e( 'Stars', 'yet-another-stars-rating' );
825
+ ?>
826
  <br />
827
 
828
+ <input type="radio" name="yasr_general_options[metabox_overall_rating]" value="numbers" class="yasr_choose_overall_rating_method" <?php
829
+ if ( $option['metabox_overall_rating'] === 'numbers' ) {
830
+ echo " checked=\"checked\" " ;
831
+ }
832
+ ?> >
833
+ <?php
834
+ _e( 'Numbers', 'yet-another-stars-rating' );
835
+ ?>
836
  <br />
837
 
838
  <p>&nbsp;</p>
839
 
840
+ <?php
841
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
842
 
843
+ function yasr_general_options_sanitize( $option )
844
+ {
845
+ //Array to return
846
+ $output = array();
847
+ // Loop through each of the incoming options
848
+ foreach ( $option as $key => $value ) {
849
+ // Check to see if the current option has a value. If so, process it.
850
+
851
+ if ( isset( $option[$key] ) ) {
852
+ // Strip all HTML and PHP tags and properly handle quoted strings
853
+ $output[$key] = strip_tags( stripslashes( $option[$key] ) );
854
+ if ( $key == 'blogposting_organization_logo' ) {
855
+ //if is not a valid url get_site_icon_url instead
856
+ if ( filter_var( $value, FILTER_VALIDATE_URL ) === FALSE ) {
857
+ $output[$key] = get_site_icon_url();
858
+ }
859
+ }
860
+ }
861
+
862
+ // end if
863
+ }
864
+ // end foreach
865
+ //if in array doesn't exists [auto_insert_enabled] key, create it and set to 0
866
+
867
+ if ( !array_key_exists( 'auto_insert_enabled', $output ) ) {
868
+ $output['auto_insert_enabled'] = 0;
869
+ } else {
870
+ $output['auto_insert_enabled'] = 1;
871
+ }
872
+
873
+ //Same as above but for [show_overall_in_loop] key
874
+
875
+ if ( !array_key_exists( 'show_overall_in_loop', $output ) ) {
876
+ $output['show_overall_in_loop'] = 'disabled';
877
+ } else {
878
+ $output['show_overall_in_loop'] = 'enabled';
879
+ }
880
+
881
+ //Same as above but for [show_visitor_votes_in_loop] key
882
+
883
+ if ( !array_key_exists( 'show_visitor_votes_in_loop', $output ) ) {
884
+ $output['show_visitor_votes_in_loop'] = 'disabled';
885
+ } else {
886
+ $output['show_visitor_votes_in_loop'] = 'enabled';
887
+ }
888
+
889
+ //Same as above but for text_before_stars key
890
+
891
+ if ( !array_key_exists( 'text_before_stars', $output ) ) {
892
+ $output['text_before_stars'] = 0;
893
+ } else {
894
+ $output['text_before_stars'] = 1;
895
+ }
896
+
897
+ //Same as above but for visitors_stats key
898
+
899
+ if ( !array_key_exists( 'visitors_stats', $output ) ) {
900
+ $output['visitors_stats'] = 'no';
901
+ } else {
902
+ $output['visitors_stats'] = 'yes';
903
+ }
904
+
905
+ //Same as above but for enable_ip key
906
+
907
+ if ( !array_key_exists( 'enable_ip', $output ) ) {
908
+ $output['enable_ip'] = 'no';
909
+ } else {
910
+ $output['enable_ip'] = 'yes';
911
+ }
912
+
913
+ return $output;
914
+ }
915
 
916
  /************ End Yasr General Settings ************/
 
 
917
  //include multiset functions
918
+ include YASR_ABSOLUTE_PATH . '/lib/settings/yasr-settings-functions-multiset.php';
 
919
  //include style functions
920
+ include YASR_ABSOLUTE_PATH . '/lib/settings/yasr-settings-functions-style.php';
 
921
  //Misc
922
+ include YASR_ABSOLUTE_PATH . '/lib/settings/yasr-settings-functions-misc.php';
 
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.3.0
5
  Contributors: Dudo
6
  Tested up to: 5.0.2
7
  Requires PHP: 5.3
8
- Stable tag: 1.8.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!
@@ -116,6 +116,9 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
116
 
117
  The full changelog can be found in the plugin's directory. Recent entries:
118
 
 
 
 
119
  = 1.8.2 =
120
  * FIXED: widgets didn't load in front end
121
 
@@ -144,53 +147,6 @@ Everthing is now fresher and even more lightweight then before. If you customize
144
  = 1.7.1 =
145
  * FIXED: security fix
146
 
147
- = 1.7.0 =
148
- * FIXED: Yasr overall rating not showing up if custom text isn't set
149
-
150
- = 1.6.9 =
151
- * TWEAKED: Most of work have been done on making Yasr working without jquery. This is still in beta but now supports all shortcodes
152
- except "yasr_visitor_multiset" one
153
- * TWEAKED: yasr_visitor_votes_readonly is now just a call to 'yasr_visitor_votes readonly="yes" '
154
- * TWEAKED: Huge code cleanup
155
- * TWEAKED: Php version required is now 5.3 instead 5.4
156
-
157
- = 1.6.8 =
158
- * Fixed css for tooltip stats
159
-
160
- = 1.6.7 =
161
- * Css fix for gutenberg compatibility
162
-
163
- = 1.6.6 =
164
- * Minor changes
165
-
166
- = 1.6.5 =
167
- * NEW FEATURE: is it possible to use YASR without jquery (so it will work on ANP pages!!).
168
- This functionality is still in beta and for now and works only with yasr_overall_rating and yasr_visitor_votes shortcode.
169
- You can enable/disable this in every moment in the settings
170
-
171
- = 1.6.4 =
172
- * Updated freemius sdk to be gdpr compilant
173
-
174
- = 1.6.3 =
175
- * FIXED: Multiset transient are now deleted only under the "Multi Sets" tab
176
-
177
- = 1.6.2 =
178
- * Removed showing ip from widget in the user dashboard
179
- * Better cookie managment
180
-
181
- = 1.6.1 =
182
- * To accomplish GDPR european law, now the IP is not stored by default
183
-
184
- = 1.6.0 =
185
- * Integreted freemius sdk
186
-
187
- = 1.5.8 =
188
- * NEW FEATURE: Logs Page: is now possible to see log page and delete user ratings!
189
- * TWEAKED: Yasr settings page has now it's own top level page instead under the WordPress Settings section
190
-
191
- = 1.5.7 =
192
- * FIXED: star disappear after user rating in some circumstances
193
- * FIXED: javascript noticies
194
 
195
  = Additional Info =
196
  External Libraries: [Rater](https://github.com/fredolss/rater-js)
5
  Contributors: Dudo
6
  Tested up to: 5.0.2
7
  Requires PHP: 5.3
8
+ Stable tag: 1.8.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!
116
 
117
  The full changelog can be found in the plugin's directory. Recent entries:
118
 
119
+ = 1.8.3 =
120
+ * FIXED: multiset doesn't show up in the edit screen if only 1 is used
121
+
122
  = 1.8.2 =
123
  * FIXED: widgets didn't load in front end
124
 
147
  = 1.7.1 =
148
  * FIXED: security fix
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
  = Additional Info =
152
  External Libraries: [Rater](https://github.com/fredolss/rater-js)
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
- * Version: 1.8.2
8
  * Author: Dario Curvino
9
  * Author URI: https://yetanotherstarsrating.com/
10
  * Text Domain: yet-another-stars-rating
@@ -77,7 +77,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
77
  yasr_fs();
78
  // Signal that SDK was initiated.
79
  do_action( 'yasr_fs_loaded' );
80
- define( 'YASR_VERSION_NUM', '1.8.2' );
81
  //Plugin relative path
82
  define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
83
  //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: 1.8.3
8
  * Author: Dario Curvino
9
  * Author URI: https://yetanotherstarsrating.com/
10
  * Text Domain: yet-another-stars-rating
77
  yasr_fs();
78
  // Signal that SDK was initiated.
79
  do_action( 'yasr_fs_loaded' );
80
+ define( 'YASR_VERSION_NUM', '1.8.3' );
81
  //Plugin relative path
82
  define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
83
  //Plugin RELATIVE PATH without slashes (just the directory's name)