Yasr – Yet Another Stars Rating - Version 1.2.9

Version Description

  • NEW FEATURE: If auto insert is enabled, it's now possible to exclude the single post or page
  • TWEAKED: Restyling for settings panel
Download this release

Release Info

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

Code changes from version 1.2.8 to 1.2.9

css/yasr-admin.css CHANGED
@@ -93,9 +93,6 @@
93
background-color: #F7F7F7;
94
}
95
96
- /*
97
- IMAGES BY: Oxygen Team
98
- */
99
100
/* Creating set 24px image . */
101
@@ -146,13 +143,14 @@ div.bigstars .rateit-selected
146
height: 32px;
147
}
148
149
- /****** End rateit rules ******/
150
151
- /********** ADMIN RULES **********/
152
153
- /*** MEtabox overall rating ***/
154
155
- #yasr-overall-container {
156
text-align: center;
157
}
158
@@ -169,6 +167,11 @@ div.bigstars .rateit-selected
169
line-height: 0.5em;
170
}
171
172
/*** End metabox overall rating ***/
173
174
#multi_rating_table
@@ -180,6 +183,8 @@ div.bigstars .rateit-selected
180
display: block;
181
}
182
183
/*** Top menu navigation ***/
184
.yasr-no-underline {
185
border-bottom: none !important;
@@ -192,6 +197,87 @@ div.bigstars .rateit-selected
192
/*** End top navigation ***/
193
194
195
@media (min-width: 1177px) {
196
197
.yasr-settingsdiv {
@@ -268,7 +354,6 @@ div.bigstars .rateit-selected
268
}
269
270
.yasr-img-option-size {
271
- height: 30px;
272
vertical-align: middle;
273
}
274
@@ -448,12 +533,14 @@ div.bigstars .rateit-selected
448
449
/*** End rules for multi set admin page ***/
450
451
452
.yasr_choose_stars {
453
display: inline-block;
454
text-align: center;
455
padding-left: 15px;
456
}
457
458
459
@@ -552,7 +639,9 @@ div.bigstars .rateit-selected
552
text-align: center;
553
}
554
555
- /**** Extensions tab ****/
556
557
.yasr-extensionsdiv {
558
@@ -614,3 +703,6 @@ div.bigstars .rateit-selected
614
display: block;
615
616
}
93
background-color: #F7F7F7;
94
}
95
96
97
/* Creating set 24px image . */
98
143
height: 32px;
144
}
145
146
+ /*************** End rateit rules ***************/
147
148
149
+ /********** Edit post / page rules **********/
150
151
+ /*** Metabox top right ***/
152
+
153
+ #yasr-matabox-top-right {
154
text-align: center;
155
}
156
167
line-height: 0.5em;
168
}
169
170
+ #yasr-switcher-disable-auto-insert {
171
+ margin: 0 auto;
172
+ text-align: left;
173
+ }
174
+
175
/*** End metabox overall rating ***/
176
177
#multi_rating_table
183
display: block;
184
}
185
186
+ /**************** Settings page *******************/
187
+
188
/*** Top menu navigation ***/
189
.yasr-no-underline {
190
border-bottom: none !important;
197
/*** End top navigation ***/
198
199
200
+
201
+ /*** On / Off Switch ***/
202
+
203
+ .yasr-onoffswitch-big {
204
+ position: relative; width: 85px;
205
+ -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
206
+ }
207
+ .yasr-onoffswitch-checkbox {
208
+ display: none !important;
209
+ }
210
+ .yasr-onoffswitch-label {
211
+ display: block; overflow: hidden; cursor: pointer;
212
+ border: 2px solid #FFFFFF; border-radius: 35px;
213
+ }
214
+ .yasr-onoffswitch-inner {
215
+ display: block; width: 200%; margin-left: -100%;
216
+ transition: margin 0.3s ease-in 0s;
217
+ }
218
+ .yasr-onoffswitch-inner:before, .yasr-onoffswitch-inner:after {
219
+ display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
220
+ font-size: 18px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
221
+ box-sizing: border-box;
222
+ }
223
+ .yasr-onoffswitch-inner:before {
224
+ content: "YES";
225
+ padding-left: 9px;
226
+ background-color: #EEEEEE; color: #34A7C1;
227
+ }
228
+ .yasr-onoffswitch-inner:after {
229
+ content: "NO";
230
+ padding-right: 15px;
231
+ background-color: #EEEEEE; color: #999999;
232
+ text-align: right;
233
+ }
234
+ .yasr-onoffswitch-switch {
235
+ display: block; width: 30px; margin: 0px;
236
+ background: #A1A1A1;
237
+ position: absolute; top: 0; bottom: 0;
238
+ right: 51px;
239
+ border: 2px solid #FFFFFF; border-radius: 35px;
240
+ transition: all 0.3s ease-in 0s;
241
+ }
242
+
243
+ .yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-inner {
244
+ margin-left: 0;
245
+ }
246
+ .yasr-onoffswitch-checkbox:checked + .yasr-onoffswitch-label .yasr-onoffswitch-switch {
247
+ right: 0px;
248
+ background-color: #34A7C1;
249
+ }
250
+
251
+ /* Alternative with ON/OFF INSTEAD YES/NO text */
252
+ .yasr-onoffswitch-onoff-inner:before {
253
+ content: "ON";
254
+ padding-left: 15px;
255
+ background-color: #EEEEEE; color: #34A7C1;
256
+ }
257
+ .yasr-onoffswitch-onoff-inner:after {
258
+ content: "OFF";
259
+ padding-right: 9px;
260
+ background-color: #EEEEEE; color: #999999;
261
+ text-align: right;
262
+ }
263
+
264
+ /* Alternative with no text */
265
+ .yasr-onoffswitch-notext-inner:before {
266
+ content: "";
267
+ padding-left: 9px;
268
+ background-color: #EEEEEE; color: #34A7C1;
269
+ }
270
+ .yasr-onoffswitch-notext-inner:after {
271
+ content: "";
272
+ padding-right: 15px;
273
+ background-color: #EEEEEE; color: #999999;
274
+ text-align: right;
275
+ }
276
+
277
+
278
+ /*** End on of switch ***/
279
+
280
+
281
@media (min-width: 1177px) {
282
283
.yasr-settingsdiv {
354
}
355
356
.yasr-img-option-size {
357
vertical-align: middle;
358
}
359
533
534
/*** End rules for multi set admin page ***/
535
536
+ /**** Yasr Aspect & Styles tab ***/
537
538
.yasr_choose_stars {
539
display: inline-block;
540
text-align: center;
541
padding-left: 15px;
542
}
543
+ /**** End Yasr Aspect & Styles tab ***/
544
545
546
639
text-align: center;
640
}
641
642
+
643
+
644
+ /************ Extensions tab **************/
645
646
.yasr-extensionsdiv {
647
703
display: block;
704
705
}
706
+
707
+
708
+ /****** End Extension tab ************/
img/yasr-stars-large.png CHANGED
Binary file
img/yasr-stars-medium.png CHANGED
Binary file
img/yasr-stars-small.png CHANGED
Binary file
js/yasr-admin.js CHANGED
@@ -318,7 +318,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
318
319
/****** Yasr Settings Page ******/
320
321
- function YasrSettingsPage (activeTab, nMultiSet, autoInsertEnabled) {
322
323
//-------------------General Settings Code---------------------
324
@@ -328,16 +328,42 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
328
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
329
}
330
331
- //First Div
332
- jQuery('#yasr_auto_insert_radio_on').on('click', function(){
333
- jQuery('.yasr-auto-insert-options-class').prop('disabled', false);
334
- });
335
336
- jQuery('#yasr_auto_insert_radio_off').on('click', function(){
337
- jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
338
- });
339
340
- if (jQuery('#yasr_text_before_star_off').is(':checked')) {
341
jQuery('.yasr-general-options-text-before').prop('disabled', true);
342
}
343
@@ -349,11 +375,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
349
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
350
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
351
352
- });
353
-
354
- jQuery('#yasr_text_before_star_off').on('click', function(){
355
- jQuery('.yasr-general-options-text-before').prop('disabled', true);
356
- });
357
358
jQuery('#yasr-doc-custom-text-link').on('click', function() {
359
jQuery('#yasr-doc-custom-text-div').toggle('slow');
318
319
/****** Yasr Settings Page ******/
320
321
+ function YasrSettingsPage (activeTab, nMultiSet, autoInsertEnabled, textBeforeStars) {
322
323
//-------------------General Settings Code---------------------
324
328
jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
329
}
330
331
+ //First Div, for auto insert
332
+ jQuery('#yasr_auto_insert_switch').change(function() {
333
+ if (jQuery(this).is(':checked')) {
334
+ jQuery('.yasr-auto-insert-options-class').prop('disabled', false);
335
+ }
336
+ else {
337
+ jQuery('.yasr-auto-insert-options-class').prop('disabled', true);
338
+ }
339
+ });
340
341
+ //for text before stars
342
+ if(textBeforeStars == 0) {
343
+ jQuery('.yasr-general-options-text-before').prop('disabled', true);
344
+ }
345
+
346
+ jQuery('#yasr-general-options-text-before-stars-switch').change(function() {
347
+ if (jQuery(this).is(':checked')) {
348
+
349
+ jQuery('.yasr-general-options-text-before').prop('disabled', false);
350
+ jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');
351
+ jQuery('#yasr-general-options-custom-text-before-visitor').val('Our Reader Score');
352
+ jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
353
+ jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
354
+
355
+ }
356
+
357
+ else {
358
+
359
+ jQuery('.yasr-general-options-text-before').prop('disabled', true);
360
361
+ }
362
+
363
+ });
364
+
365
+
366
+ /*if (jQuery('#yasr_text_before_star_off').is(':checked')) {
367
jQuery('.yasr-general-options-text-before').prop('disabled', true);
368
}
369
375
jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');
376
jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');
377
378
+ });*/
379
380
jQuery('#yasr-doc-custom-text-link').on('click', function() {
381
jQuery('#yasr-doc-custom-text-div').toggle('slow');
lib/yasr-db-functions.php CHANGED
@@ -766,4 +766,33 @@ add_action ('admin_init', 'admin_init_delete_data_on_post_callback');
766
}
767
768
769
?>
766
}
767
768
769
+
770
+
771
+ /******* Add post_meta on save_post if this post is excluded for auto insert *******/
772
+
773
+ if (YASR_AUTO_INSERT_ENABLED == 1 ) {
774
+
775
+ add_action( 'save_post', 'yasr_exclude_auto_insert_callback' );
776
+
777
+ function yasr_exclude_auto_insert_callback() {
778
+
779
+ $post_id = get_the_ID();
780
+
781
+ if(isset($_POST['yasr_auto_insert_disabled'])) {
782
+
783
+ update_post_meta($post_id, 'yasr_auto_insert_disabled', 'yes');
784
+
785
+ }
786
+
787
+ else {
788
+
789
+ delete_post_meta($post_id, 'yasr_auto_insert_disabled');
790
+
791
+ }
792
+
793
+
794
+ }
795
+
796
+ }
797
+
798
?>
lib/yasr-functions.php CHANGED
@@ -299,6 +299,17 @@ function yasr_css_stars_set() {
299
300
function yasr_auto_insert_shortcode_callback($content) {
301
302
$auto_insert_shortcode=NULL; //To avoid undefined variable notice outside the loop (if (is_singular) )
303
304
$overall_rating_code = '[yasr_overall_rating size="' . YASR_AUTO_INSERT_SIZE . '"]';
299
300
function yasr_auto_insert_shortcode_callback($content) {
301
302
+ $post_id = get_the_ID();
303
+
304
+ //check if for this post or page auto insert is off
305
+ $post_excluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', TRUE);
306
+
307
+ if($post_excluded === 'yes') {
308
+
309
+ return $content;
310
+
311
+ }
312
+
313
$auto_insert_shortcode=NULL; //To avoid undefined variable notice outside the loop (if (is_singular) )
314
315
$overall_rating_code = '[yasr_overall_rating size="' . YASR_AUTO_INSERT_SIZE . '"]';
lib/yasr-settings-functions.php CHANGED
@@ -86,34 +86,18 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
86
87
?>
88
89
-
90
<strong><?php _e('Use Auto Insert?', 'yet-another-stars-rating'); ?></strong>
91
- <br />
92
93
- <div class="yasr-indented-answer">
94
95
- <input type='radio' name='yasr_general_options[auto_insert_enabled]' value='1' id='yasr_auto_insert_radio_on' <?php if ($option['auto_insert_enabled']==1) echo " checked='checked' "; ?> />
96
- <?php _e('Yes', 'yet-another-stars-rating') ?>
97
- &nbsp;&nbsp;&nbsp;
98
-
99
-
100
- <input type='radio' name='yasr_general_options[auto_insert_enabled]' value='0' id='yasr_auto_insert_radio_off'
101
- <?php
102
- if ($option['auto_insert_enabled']==0) {
103
- echo " checked='checked' />";
104
- }
105
-
106
- else {
107
- echo "/>";
108
- }
109
-
110
- _e('No', 'yet-another-stars-rating');
111
-
112
- ?>
113
-
114
- <p>&nbsp;</p>
115
116
- </div>
117
118
<strong><?php _e('What?', 'yet-another-stars-rating'); ?></strong>
119
@@ -229,10 +213,12 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
229
230
?>
231
232
- <hr />
233
-
234
235
<?php
236
} //End yasr_auto_insert_callback
237
238
@@ -240,15 +226,16 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
240
241
?>
242
243
- <input type='radio' name='yasr_general_options[show_overall_in_loop]' value='enabled' class='yasr-general-option-show-overall-in-loop' <?php if ($option['show_overall_in_loop']==='enabled') echo " checked=\"checked\" "; ?> />
244
- <?php _e('Yes', 'yet-another-stars-rating')?>
245
-
246
- &nbsp;&nbsp;&nbsp;
247
248
- <input type='radio' name='yasr_general_options[show_overall_in_loop]' value='disabled' class='yasr-general-option-show-overall-in-loop' <?php if ($option['show_overall_in_loop']==='disabled') echo " checked=\"checked\" "; ?> />
249
- <?php _e('No', 'yet-another-stars-rating')?>
250
- <br />
251
- <br />
252
253
<?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')?>
254
@@ -266,15 +253,16 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
266
267
?>
268
269
- <input type='radio' name='yasr_general_options[show_visitor_votes_in_loop]' value='enabled' class='yasr-general-option-show-visitor-votes-in-loop' <?php if ($option['show_visitor_votes_in_loop']==='enabled') echo " checked=\"checked\" "; ?> />
270
- <?php _e('Yes', 'yet-another-stars-rating')?>
271
-
272
- &nbsp;&nbsp;&nbsp;
273
274
- <input type='radio' name='yasr_general_options[show_visitor_votes_in_loop]' value='disabled' class='yasr-general-option-show-visitor-votes-in-loop' <?php if ($option['show_visitor_votes_in_loop']==='disabled') echo " checked=\"checked\" "; ?> />
275
- <?php _e('No', 'yet-another-stars-rating')?>
276
- <br />
277
- <br />
278
279
<?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')?>
280
@@ -300,13 +288,13 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
300
301
?>
302
303
- <input type='radio' name='yasr_general_options[text_before_stars]' value='1' id='yasr_text_before_star_on' <?php if ($option['text_before_stars']==1) echo " checked='checked' "; ?> />
304
- <?php _e('Yes', 'yet-another-stars-rating') ?>
305
- &nbsp;&nbsp;&nbsp;
306
-
307
- <input type='radio' name='yasr_general_options[text_before_stars]' value='0' id='yasr_text_before_star_off' <?php if ($option['text_before_stars']==0) echo " checked='checked' "; ?> />
308
-
309
- <?php _e('No', 'yet-another-stars-rating'); ?>
310
311
<br /> <br />
312
@@ -346,22 +334,33 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
346
347
<p>&nbsp;</p>
348
349
- <hr>
350
-
351
<?php
352
}
353
354
function yasr_visitors_stats_callback($option) {
355
356
?>
357
358
<input type='radio' name='yasr_general_options[visitors_stats]' value='yes' class='yasr-general-options-scheme-color' <?php if ($option['visitors_stats']==='yes') echo " checked=\"checked\" "; ?> />
359
<?php _e('Yes', 'yet-another-stars-rating')?>
360
361
&nbsp;&nbsp;&nbsp;
362
363
<input type='radio' name='yasr_general_options[visitors_stats]' value='no' class='yasr-general-options-scheme-color' <?php if ($option['visitors_stats']==='no') echo " checked=\"checked\" "; ?> />
364
- <?php _e('No', 'yet-another-stars-rating')?>
365
<br />
366
367
<br />
@@ -535,7 +534,8 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
535
//Array to return
536
$output = array();
537
538
- // Loop through each of the incoming options
539
foreach( $option as $key => $value ) {
540
541
// Check to see if the current option has a value. If so, process it.
@@ -557,8 +557,73 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
557
558
} // end foreach
559
560
- // Return the array processing any additional functions filtered by this action
561
- //do not return $output but do apply_filter first,
562
563
return $output;
564
@@ -576,7 +641,8 @@ add_action( 'admin_init', 'yasr_multiset_options_init' ); //This is for general
576
function yasr_multiset_options_init() {
577
register_setting(
578
'yasr_multiset_options_group', // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
579
- 'yasr_multiset_options' //The name of an option to sanitize and save.
580
);
581
582
$option_multiset = get_option( 'yasr_multiset_options' );
@@ -622,15 +688,17 @@ add_action( 'admin_init', 'yasr_multiset_options_init' ); //This is for general
622
623
?>
624
625
- <input type="radio" name="yasr_multiset_options[show_average]" value="yes" class="yasr_choose_overall_rating_method" <?php if ($option_multiset['show_average']==='yes') echo " checked=\"checked\" "; ?> >
626
- <?php _e('Yes', 'yet-another-stars-rating') ?>
627
- <br />
628
629
- <input type="radio" name="yasr_multiset_options[show_average]" value="no" class="yasr_choose_overall_rating_method" <?php if ($option_multiset['show_average']==='no') echo " checked=\"checked\" "; ?> >
630
- <?php _e('No', 'yet-another-stars-rating')?>
631
<br />
632
633
- <br>
634
635
<?php
636
@@ -639,6 +707,25 @@ add_action( 'admin_init', 'yasr_multiset_options_init' ); //This is for general
639
}
640
641
642
/****** Create a form for settings page to create new multi set ******/
643
function yasr_display_multi_set_form() {
644
86
87
?>
88
89
<strong><?php _e('Use Auto Insert?', 'yet-another-stars-rating'); ?></strong>
90
91
92
+ <div class="yasr-onoffswitch-big">
93
+ <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' "; ?> >
94
+ <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
95
+ <span class="yasr-onoffswitch-inner"></span>
96
+ <span class="yasr-onoffswitch-switch"></span>
97
+ </label>
98
+ </div>
99
100
+ <p>&nbsp;</p>
101
102
<strong><?php _e('What?', 'yet-another-stars-rating'); ?></strong>
103
213
214
?>
215
216
217
<?php
218
+
219
+ submit_button( __('Save Settings') );
220
+
221
+
222
} //End yasr_auto_insert_callback
223
224
226
227
?>
228
229
+ <div class="yasr-onoffswitch-big">
230
+ <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' "; ?> >
231
+ <label class="yasr-onoffswitch-label" for="yasr-show-overall-in-loop-switch">
232
+ <span class="yasr-onoffswitch-inner"></span>
233
+ <span class="yasr-onoffswitch-switch"></span>
234
+ </label>
235
+ </div>
236
237
+ <br />
238
+ <br />
239
240
<?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')?>
241
253
254
?>
255
256
+ <div class="yasr-onoffswitch-big">
257
+ <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' "; ?> >
258
+ <label class="yasr-onoffswitch-label" for="yasr-show-visitor-votes-in-loop-switch">
259
+ <span class="yasr-onoffswitch-inner"></span>
260
+ <span class="yasr-onoffswitch-switch"></span>
261
+ </label>
262
+ </div>
263
264
+ <br />
265
+ <br />
266
267
<?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')?>
268
288
289
?>
290
291
+ <div class="yasr-onoffswitch-big">
292
+ <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' "; ?> >
293
+ <label class="yasr-onoffswitch-label" for="yasr-general-options-text-before-stars-switch">
294
+ <span class="yasr-onoffswitch-inner"></span>
295
+ <span class="yasr-onoffswitch-switch"></span>
296
+ </label>
297
+ </div>
298
299
<br /> <br />
300
334
335
<p>&nbsp;</p>
336
337
<?php
338
+
339
+ submit_button( __('Save Settings') );
340
+
341
}
342
343
function yasr_visitors_stats_callback($option) {
344
345
?>
346
347
+ <div class="yasr-onoffswitch-big">
348
+ <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' "; ?> >
349
+ <label class="yasr-onoffswitch-label" for="yasr-general-options-visitors-stats-switch">
350
+ <span class="yasr-onoffswitch-inner"></span>
351
+ <span class="yasr-onoffswitch-switch"></span>
352
+ </label>
353
+ </div>
354
+
355
+ <?php /*
356
+
357
<input type='radio' name='yasr_general_options[visitors_stats]' value='yes' class='yasr-general-options-scheme-color' <?php if ($option['visitors_stats']==='yes') echo " checked=\"checked\" "; ?> />
358
<?php _e('Yes', 'yet-another-stars-rating')?>
359
360
&nbsp;&nbsp;&nbsp;
361
362
<input type='radio' name='yasr_general_options[visitors_stats]' value='no' class='yasr-general-options-scheme-color' <?php if ($option['visitors_stats']==='no') echo " checked=\"checked\" "; ?> />
363
+ <?php _e('No', 'yet-another-stars-rating')?> */ ?>
364
<br />
365
366
<br />
534
//Array to return
535
$output = array();
536
537
+
538
+ // Loop through each of the incoming options
539
foreach( $option as $key => $value ) {
540
541
// Check to see if the current option has a value. If so, process it.
557
558
} // end foreach
559
560
+ //if in array doesn't exists [auto_insert_enabled] key, create it and set to 0
561
+ if(!array_key_exists('auto_insert_enabled', $output)) {
562
+
563
+ $output['auto_insert_enabled'] = 0;
564
+
565
+ }
566
+ //if exists value must be 1
567
+ else {
568
+
569
+ $output['auto_insert_enabled'] = 1;
570
+
571
+ }
572
+
573
+
574
+ //Same as above but for [show_overall_in_loop] key
575
+ if(!array_key_exists('show_overall_in_loop', $output)) {
576
+
577
+ $output['show_overall_in_loop'] = 'disabled';
578
+
579
+ }
580
+ //if exists must be string 'enabled'
581
+ else {
582
+
583
+ $output['show_overall_in_loop'] = 'enabled';
584
+
585
+ }
586
+
587
+
588
+ //Same as above but for [show_visitor_votes_in_loop] key
589
+ if(!array_key_exists('show_visitor_votes_in_loop', $output)) {
590
+
591
+ $output['show_visitor_votes_in_loop'] = 'disabled';
592
+
593
+ }
594
+ //if exists must be string 'enabled'
595
+ else {
596
+
597
+ $output['show_visitor_votes_in_loop'] = 'enabled';
598
+
599
+ }
600
+
601
+ //Same as above but for text_before_stars key
602
+ if(!array_key_exists('text_before_stars', $output)) {
603
+
604
+ $output['text_before_stars'] = 0;
605
+
606
+ }
607
+ //if exists must be 1
608
+ else {
609
+
610
+ $output['text_before_stars'] = 1;
611
+
612
+ }
613
+
614
+
615
+ //Same as above but for visitors_stats key
616
+ if(!array_key_exists('visitors_stats', $output)) {
617
+
618
+ $output['visitors_stats'] = 'no';
619
+
620
+ }
621
+ //if exists must be string 'yes'
622
+ else {
623
+
624
+ $output['visitors_stats'] = 'yes';
625
+
626
+ }
627
628
return $output;
629
641
function yasr_multiset_options_init() {
642
register_setting(
643
'yasr_multiset_options_group', // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
644
+ 'yasr_multiset_options', //The name of an option to sanitize and save.
645
+ 'yasr_sanitize_multiset_options'
646
);
647
648
$option_multiset = get_option( 'yasr_multiset_options' );
688
689
?>
690
691
+ <div class="yasr-onoffswitch-big">
692
+ <input type="checkbox" name="yasr_multiset_options[show_average]" class="yasr-onoffswitch-checkbox" id="yasr-multiset-options-show-average-switch" <?php if ($option_multiset['show_average']==='yes') echo " checked='checked' "; ?> >
693
+ <label class="yasr-onoffswitch-label" for="yasr-multiset-options-show-average-switch">
694
+ <span class="yasr-onoffswitch-inner"></span>
695
+ <span class="yasr-onoffswitch-switch"></span>
696
+ </label>
697
+ </div>
698
699
<br />
700
701
+ <br />
702
703
<?php
704
707
}
708
709
710
+ function yasr_sanitize_multiset_options ($option_multiset) {
711
+
712
+ if (!array_key_exists('show_average', $option_multiset)) {
713
+
714
+ $option_multiset['show_average'] = 'no';
715
+
716
+ }
717
+
718
+ else {
719
+
720
+ $option_multiset['show_average'] = 'yes';
721
+
722
+ }
723
+
724
+ return $option_multiset;
725
+
726
+ }
727
+
728
+
729
/****** Create a form for settings page to create new multi set ******/
730
function yasr_display_multi_set_form() {
731
readme.txt CHANGED
@@ -3,8 +3,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
3
Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post rating, posts, rate, rating, rating platform, rating system, ratings, review, reviews, rich snippets, seo, star, star rating, stars, vote, Votes, voting, voting contest, schema, serp
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
- Tested up to: 4.5
7
- Stable tag: 1.2.8
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
@@ -113,6 +113,10 @@ Of course not: you can easily add it on the visual editor just by clicking the "
113
114
The full changelog can be found in the plugin's directory. Recent entries:
115
116
= 1.2.8 =
117
* FIXED: Fatal error on first install
118
* TWEAKED: Flat stars set is the new default theme
3
Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post rating, posts, rate, rating, rating platform, rating system, ratings, review, reviews, rich snippets, seo, star, star rating, stars, vote, Votes, voting, voting contest, schema, serp
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
+ Tested up to: 4.5.1
7
+ Stable tag: 1.2.9
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
113
114
The full changelog can be found in the plugin's directory. Recent entries:
115
116
+ = 1.2.9 =
117
+ * NEW FEATURE: If auto insert is enabled, it's now possible to exclude the single post or page
118
+ * TWEAKED: Restyling for settings panel
119
+
120
= 1.2.8 =
121
* FIXED: Fatal error on first install
122
* TWEAKED: Flat stars set is the new default theme
yasr-metabox-top-right.php CHANGED
@@ -58,8 +58,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
58
?>
59
60
61
- <div id="yasr-overall-container">
62
-
63
64
<?php
65
@@ -93,7 +92,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
93
94
</div> <!--End stars container-->
95
96
- <?php
97
98
} //End if (YASR_METABOX_OVERALL_RATING == 'stars') {
99
@@ -164,16 +163,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
164
165
</div> <!--End numbers container-->
166
167
- <?php
168
169
} //End if YASR_METABOX_OVERALL_RATING == 'numbers'
170
171
?>
172
173
-
174
<hr>
175
176
- <div class="yasr-choose-reviews-types"><?php _e("This review is about a..."); ?>
177
<br />
178
179
<?php yasr_select_itemtype(); ?>
58
?>
59
60
61
+ <div id="yasr-matabox-top-right">
62
63
<?php
64
92
93
</div> <!--End stars container-->
94
95
+ <?php
96
97
} //End if (YASR_METABOX_OVERALL_RATING == 'stars') {
98
163
164
</div> <!--End numbers container-->
165
166
+ <?php
167
168
} //End if YASR_METABOX_OVERALL_RATING == 'numbers'
169
170
?>
171
172
<hr>
173
174
+ <?php
175
+
176
+ if (YASR_AUTO_INSERT_ENABLED == 1) {
177
+
178
+ $is_this_post_exluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', TRUE);
179
+
180
+ ?>
181
+
182
+ <div id="yasr-toprightmetabox-disable-auto-insert">
183
+
184
+ <?php _e('Disable auto insert for this post or page?', 'yet-another-stars-rating'); ?>
185
+
186
+ <br />
187
+
188
+ <div class="yasr-onoffswitch-big" id="yasr-switcher-disable-auto-insert">
189
+ <input type="checkbox" name="yasr_auto_insert_disabled" class="yasr-onoffswitch-checkbox" value="yes" id="yasr-auto-insert-disabled-switch" <?php if ($is_this_post_exluded === 'yes') echo " checked='checked' "; ?> >
190
+ <label class="yasr-onoffswitch-label" for="yasr-auto-insert-disabled-switch">
191
+ <span class="yasr-onoffswitch-inner"></span>
192
+ <span class="yasr-onoffswitch-switch"></span>
193
+ </label>
194
+ </div>
195
+
196
+
197
+ </div>
198
+
199
+ <hr>
200
+
201
+ <?php
202
+
203
+ } //End if auto insert enabled
204
+
205
+ ?>
206
+
207
+ <div class="yasr-choose-reviews-types"><?php _e("This review is about a...", "yet-another-stars-rating"); ?>
208
<br />
209
210
<?php yasr_select_itemtype(); ?>
yasr-settings-page.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
3
/*
4
@@ -47,25 +47,25 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
47
echo "<div class=\"error\"> <p> <strong>";
48
49
foreach ($error_new_multi_set as $error) {
50
- _e($error, 'yet-another-stars-rating');
51
echo "<br />";
52
}
53
54
- echo "</strong></p></div>";
55
}
56
57
if ($error_edit_multi_set) {
58
echo "<div class=\"error\"> <p> <strong>";
59
60
foreach ($error_edit_multi_set as $error) {
61
- _e($error, 'yet-another-stars-rating');
62
echo "<br />";
63
}
64
65
- echo "</strong></p></div>";
66
}
67
68
-
69
if (isset($_GET['tab'])) {
70
$active_tab = $_GET[ 'tab' ];
71
}
@@ -89,7 +89,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
89
90
91
92
- <?php
93
94
if ($active_tab == 'general_settings') {
95
@@ -100,12 +100,12 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
100
<?php
101
settings_fields( 'yasr_general_options_group' );
102
do_settings_sections('yasr_general_settings_tab' );
103
- submit_button( __('Save') );
104
?>
105
</form>
106
</div>
107
108
- <?php
109
110
yasr_fb_box ();
111
yasr_ask_rating ();
@@ -115,7 +115,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
115
<div class="yasr-space-settings-div">
116
</div>
117
118
- <?php
119
120
$gd_star_rating_found = yasr_search_gd_star_rating();
121
@@ -141,7 +141,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
141
</span>
142
<br />
143
144
- <div id="result-import">
145
</div>
146
</div>
147
</div>
@@ -159,7 +159,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
159
<div class="yasr-settingsdiv">
160
<h3><?php _e("Manage GD Star Data", 'yet-another-stars-rating'); ?></h3>
161
<?php _e("Gd Star Rating has been already imported.", 'yet-another-stars-rating'); ?> <br />
162
- <?php _e("If you wish you can import it again, but", 'yet-another-stars-rating'); ?><strong> <?php _e("you will lose all data you've collect since the import!", 'yet-another-stars-rating'); ?> </strong>
163
<br />
164
<button href="#" class="button-delete" id="import-gdstar"><?php _e('Ok, Import Again'); ?></button>
165
@@ -172,10 +172,10 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
172
173
<span id="yasr-loader-importer" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "loader.gif" ?>">
174
</span>
175
-
176
<br />
177
178
- <div id="result-import">
179
</div>
180
181
</div>
@@ -201,7 +201,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
201
?>
202
203
<div class="yasr-settingsdiv">
204
-
205
<h3> <?php _e("Manage Multi Set", 'yet-another-stars-rating'); ?></h3>
206
207
<p>
@@ -269,9 +269,9 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
269
270
</div>
271
272
- <?php
273
- yasr_fb_box ();
274
- yasr_ask_rating ();
275
?>
276
277
<div class="yasr-space-settings-div">
@@ -297,9 +297,9 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
297
298
</div>
299
300
- <?php
301
- yasr_fb_box ();
302
- yasr_ask_rating ();
303
?>
304
305
<div class="yasr-space-settings-div">
@@ -341,7 +341,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
341
<div class="yasr-space-settings-div">
342
</div>
343
344
- <?php
345
346
if (function_exists('yasr_ur_license_page')) {
347
@@ -349,7 +349,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
349
350
}
351
352
- else {
353
354
?>
355
@@ -357,7 +357,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
357
358
<?php
359
360
- }
361
362
363
?>
@@ -379,7 +379,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
379
<div class="yasr-space-settings-div">
380
</div>
381
382
- <?php
383
384
if (function_exists('yasr_st_license_page')) {
385
@@ -387,7 +387,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
387
388
}
389
390
- else {
391
392
?>
393
@@ -395,7 +395,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
395
396
<?php
397
398
- }
399
400
401
?>
@@ -417,7 +417,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
417
<div class="yasr-space-settings-div">
418
</div>
419
420
- <?php
421
422
if (function_exists('yasr_cr_license_page')) {
423
@@ -425,7 +425,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
425
426
}
427
428
- else {
429
430
?>
431
@@ -433,7 +433,7 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
433
434
<?php
435
436
- }
437
438
?>
439
@@ -450,11 +450,11 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
450
451
yasr_fb_box("bottom");
452
yasr_ask_rating ("bottom");
453
-
454
?>
455
456
<!--End div wrap-->
457
- </div>
458
459
460
<script type="text/javascript">
@@ -467,12 +467,14 @@ $n_multi_set = NULL; //Evoid undefined variable when printed outside multiset ta
467
468
var autoInsertEnabled = <?php echo (json_encode(YASR_AUTO_INSERT_ENABLED)); ?>;
469
470
var nonceHideAskRating = <?php echo (json_encode("$ajax_nonce_hide_ask_rating")); ?>
471
472
- YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled);
473
474
YasrAsk5Stars(nonceHideAskRating);
475
476
}); //End jquery document ready
477
-
478
</script>
1
+ <?php
2
3
/*
4
47
echo "<div class=\"error\"> <p> <strong>";
48
49
foreach ($error_new_multi_set as $error) {
50
+ _e($error, 'yet-another-stars-rating');
51
echo "<br />";
52
}
53
54
+ echo "</strong></p></div>";
55
}
56
57
if ($error_edit_multi_set) {
58
echo "<div class=\"error\"> <p> <strong>";
59
60
foreach ($error_edit_multi_set as $error) {
61
+ _e($error, 'yet-another-stars-rating');
62
echo "<br />";
63
}
64
65
+ echo "</strong></p></div>";
66
}
67
68
+
69
if (isset($_GET['tab'])) {
70
$active_tab = $_GET[ 'tab' ];
71
}
89
90
91
92
+ <?php
93
94
if ($active_tab == 'general_settings') {
95
100
<?php
101
settings_fields( 'yasr_general_options_group' );
102
do_settings_sections('yasr_general_settings_tab' );
103
+ submit_button( __('Save Settings') );
104
?>
105
</form>
106
</div>
107
108
+ <?php
109
110
yasr_fb_box ();
111
yasr_ask_rating ();
115
<div class="yasr-space-settings-div">
116
</div>
117
118
+ <?php
119
120
$gd_star_rating_found = yasr_search_gd_star_rating();
121
141
</span>
142
<br />
143
144
+ <div id="result-import">
145
</div>
146
</div>
147
</div>
159
<div class="yasr-settingsdiv">
160
<h3><?php _e("Manage GD Star Data", 'yet-another-stars-rating'); ?></h3>
161
<?php _e("Gd Star Rating has been already imported.", 'yet-another-stars-rating'); ?> <br />
162
+ <?php _e("If you wish you can import it again, but", 'yet-another-stars-rating'); ?><strong> <?php _e("you will lose all data you've collect since the import!", 'yet-another-stars-rating'); ?> </strong>
163
<br />
164
<button href="#" class="button-delete" id="import-gdstar"><?php _e('Ok, Import Again'); ?></button>
165
172
173
<span id="yasr-loader-importer" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "loader.gif" ?>">
174
</span>
175
+
176
<br />
177
178
+ <div id="result-import">
179
</div>
180
181
</div>
201
?>
202
203
<div class="yasr-settingsdiv">
204
+
205
<h3> <?php _e("Manage Multi Set", 'yet-another-stars-rating'); ?></h3>
206
207
<p>
269
270
</div>
271
272
+ <?php
273
+ yasr_fb_box ();
274
+ yasr_ask_rating ();
275
?>
276
277
<div class="yasr-space-settings-div">
297
298
</div>
299
300
+ <?php
301
+ yasr_fb_box ();
302
+ yasr_ask_rating ();
303
?>
304
305
<div class="yasr-space-settings-div">
341
<div class="yasr-space-settings-div">
342
</div>
343
344
+ <?php
345
346
if (function_exists('yasr_ur_license_page')) {
347
349
350
}
351
352
+ else {
353
354
?>
355
357
358
<?php
359
360
+ }
361
362
363
?>
379
<div class="yasr-space-settings-div">
380
</div>
381
382
+ <?php
383
384
if (function_exists('yasr_st_license_page')) {
385
387
388
}
389
390
+ else {
391
392
?>
393
395
396
<?php
397
398
+ }
399
400
401
?>
417
<div class="yasr-space-settings-div">
418
</div>
419
420
+ <?php
421
422
if (function_exists('yasr_cr_license_page')) {
423
425
426
}
427
428
+ else {
429
430
?>
431
433
434
<?php
435
436
+ }
437
438
?>
439
450
451
yasr_fb_box("bottom");
452
yasr_ask_rating ("bottom");
453
+
454
?>
455
456
<!--End div wrap-->
457
+ </div>
458
459
460
<script type="text/javascript">
467
468
var autoInsertEnabled = <?php echo (json_encode(YASR_AUTO_INSERT_ENABLED)); ?>;
469
470
+ var textBeforeStars = <?php echo (json_encode(YASR_TEXT_BEFORE_STARS)); ?>;
471
+
472
var nonceHideAskRating = <?php echo (json_encode("$ajax_nonce_hide_ask_rating")); ?>
473
474
+ YasrSettingsPage(activeTab, nMultiSet, autoInsertEnabled, textBeforeStars);
475
476
YasrAsk5Stars(nonceHideAskRating);
477
478
}); //End jquery document ready
479
+
480
</script>
yet-another-stars-rating.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: Yet Another Stars Rating
4
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
6
- * Version: 1.2.8
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
@@ -31,8 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
31
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
-
35
- define('YASR_VERSION_NUM', '1.2.8');
36
37
//Plugin relative path
38
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
@@ -278,6 +277,7 @@ function yasr_update_version() {
278
279
global $yasr_stored_options;
280
281
//Remove end Sept 2016
282
if ($yasr_version_installed && $yasr_version_installed < '1.2.2') {
283
3
* Plugin Name: Yet Another Stars Rating
4
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
6
+ * Version: 1.2.9
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
31
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
+ define('YASR_VERSION_NUM', '1.2.9');
35
36
//Plugin relative path
37
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
277
278
global $yasr_stored_options;
279
280
+
281
//Remove end Sept 2016
282
if ($yasr_version_installed && $yasr_version_installed < '1.2.2') {
283