Yasr – Yet Another Stars Rating - Version 1.2.5

Version Description

  • NEW FEATURE: in settings -> Multi Set tab is now possible to choose if show or hide by default the average for multi set
  • FIXED: logo image for rich snippet
  • TWEAKED: changed globals names
  • FIXED: minor changes
Download this release

Release Info

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

Code changes from version 1.2.4 to 1.2.5

img/yasr-multi-set-insert-rate-small.jpg CHANGED
Binary file
img/yasr-multi-set-insert-rate.jpg CHANGED
Binary file
img/yasr-multi-set.png CHANGED
Binary file
lib/yasr-db-functions.php CHANGED
@@ -122,7 +122,13 @@ function yasr_install() {
122
$style_options = array();
123
$style_options['scheme_color_multiset'] = 'light';
124
125
- update_option("yasr_style_options", $style_options);
126
127
128
}
122
$style_options = array();
123
$style_options['scheme_color_multiset'] = 'light';
124
125
+ add_option("yasr_style_options", $style_options);
126
+
127
+ //multi set options
128
+ $multi_set_options = array();
129
+ $multi_set_options['show_average'] = 'yes';
130
+
131
+ add_options("yasr_multiset_options", $multi_set_options);
132
133
134
}
lib/yasr-functions.php CHANGED
@@ -346,11 +346,14 @@ add_filter('the_content', 'yasr_add_schema');
346
347
$date_modified = get_the_modified_date('c');
348
349
if (defined('YASR_BLOGPOSTING_ORGANIZATION_LOGO')) {
350
351
- $post_image_url = YASR_BLOGPOSTING_ORGANIZATION_LOGO;
352
353
- $post_image_size = @getimagesize($post_image_url); //the @ should be useless, just to be safe
354
355
$logo_image_size = @getimagesize(YASR_BLOGPOSTING_ORGANIZATION_LOGO); //the @ should be useless, just to be safe
356
@@ -358,8 +361,6 @@ add_filter('the_content', 'yasr_add_schema');
358
359
else {
360
361
- $post_image_url = '';
362
-
363
$post_image_size[0] = 0;
364
$post_image_size[1] = 0;
365
@@ -427,7 +428,7 @@ add_filter('the_content', 'yasr_add_schema');
427
"name" => YASR_BLOGPOSTING_ORGANIZATION_NAME,
428
"logo" => array(
429
"@type" => "ImageObject",
430
- "url" => $post_image_url,
431
"width" => $logo_image_size[0],
432
"height" => $logo_image_size[1]
433
)
@@ -792,6 +793,8 @@ function yasr_unique_multidim_array($array, $key) {
792
793
}
794
795
return $temp_array;
796
797
}
346
347
$date_modified = get_the_modified_date('c');
348
349
+ $post_image_url = ''; //avoid undefined
350
+ $logo_image_url = ''; //avoid undefined
351
+
352
if (defined('YASR_BLOGPOSTING_ORGANIZATION_LOGO')) {
353
354
+ $logo_image_url = YASR_BLOGPOSTING_ORGANIZATION_LOGO;
355
356
+ $post_image_size = @getimagesize(YASR_BLOGPOSTING_ORGANIZATION_LOGO); //the @ should be useless, just to be safe
357
358
$logo_image_size = @getimagesize(YASR_BLOGPOSTING_ORGANIZATION_LOGO); //the @ should be useless, just to be safe
359
361
362
else {
363
364
$post_image_size[0] = 0;
365
$post_image_size[1] = 0;
366
428
"name" => YASR_BLOGPOSTING_ORGANIZATION_NAME,
429
"logo" => array(
430
"@type" => "ImageObject",
431
+ "url" => $logo_image_url,
432
"width" => $logo_image_size[0],
433
"height" => $logo_image_size[1]
434
)
793
794
}
795
796
+ sort($temp_array);
797
+
798
return $temp_array;
799
800
}
lib/yasr-settings-functions.php CHANGED
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
22
23
/************ Add yasr general options ***********/
24
25
- add_action( 'admin_init', 'yasr_general_options_init' ); //This is for general options
26
27
function yasr_general_options_init() {
28
@@ -546,7 +546,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
546
547
if ($key=='blogposting_organization_logo') {
548
549
- //check if is a valid url
550
if (filter_var($value, FILTER_VALIDATE_URL) === FALSE) {
551
$output[$key] = get_site_icon_url();
552
}
@@ -581,7 +581,21 @@ add_action( 'admin_init', 'yasr_multiset_options_init' ); //This is for general
581
582
$option_multiset = get_option( 'yasr_multiset_options' );
583
584
add_settings_section( 'yasr_multiset_options_section_id', '', 'yasr_multiset_section_callback', 'yasr_multiset_tab' );
585
586
global $wpdb;
587
@@ -604,7 +618,25 @@ add_action( 'admin_init', 'yasr_multiset_options_init' ); //This is for general
604
605
}
606
607
608
609
610
/****** Create a form for settings page to create new multi set ******/
22
23
/************ Add yasr general options ***********/
24
25
+ add_action( 'admin_init', 'yasr_general_options_init' ); //This is for general options
26
27
function yasr_general_options_init() {
28
546
547
if ($key=='blogposting_organization_logo') {
548
549
+ //if is not a valid url get_site_icon_url instead
550
if (filter_var($value, FILTER_VALIDATE_URL) === FALSE) {
551
$output[$key] = get_site_icon_url();
552
}
581
582
$option_multiset = get_option( 'yasr_multiset_options' );
583
584
+ if ($option_multiset === FALSE) {
585
+
586
+ $option_multiset = array();
587
+
588
+ }
589
+
590
+ if (!isset($option_multiset['show_average'])) {
591
+
592
+ $option_multiset['show_average'] = 'yes';
593
+
594
+ }
595
+
596
add_settings_section( 'yasr_multiset_options_section_id', '', 'yasr_multiset_section_callback', 'yasr_multiset_tab' );
597
+ add_settings_field( 'yasr_multiset_hide_average_id', __('Show average?', 'yet-another-stars-rating'), 'yasr_multiset_hide_average_callback', 'yasr_multiset_tab', 'yasr_multiset_options_section_id', $option_multiset );
598
+
599
600
global $wpdb;
601
618
619
}
620
621
+ function yasr_multiset_hide_average_callback ($option_multiset) {
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
+
637
+ _e("If you select no, the \"Average\" row will not be displayed. You can override this in the single multi set by using the parameter \"show_average\"", "yasr");
638
+
639
+ }
640
641
642
/****** Create a form for settings page to create new multi set ******/
lib/yasr-shortcode-functions.php CHANGED
@@ -61,21 +61,22 @@ add_shortcode ('yasr_overall_rating', 'shortcode_overall_rating_callback');
61
62
}
63
64
- //IF show overall rating in loop is disabled use is_singular && is_main query
65
- if ( YASR_SHOW_OVERALL_IN_LOOP === 'disabled' ) {
66
67
- if( is_singular() && is_main_query() ) {
68
69
- return $shortcode_html;
70
71
- }
72
73
- } // End if YASR_SHOW_OVERALL_IN_LOOP === 'disabled') {
74
75
- //If overall rating in loop is enabled don't use is_singular && is main_query
76
- elseif ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
77
78
- return $shortcode_html;
79
80
}
81
@@ -293,21 +294,22 @@ add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
293
);
294
295
296
- //IF show visitor votes in loop is disabled use is_singular && is_main query
297
- if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'disabled' ) {
298
299
- if( is_singular() && is_main_query() ) {
300
301
- return $shortcode_html;
302
303
- }
304
305
- } // End if YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'disabled') {
306
307
- //If overall rating in loop is enabled don't use is_singular && is main_query
308
- elseif ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
309
310
- return $shortcode_html;
311
312
}
313
@@ -463,7 +465,7 @@ add_shortcode ('yasr_multiset', 'shortcode_multi_set_callback');
463
464
}
465
466
- if ($show_average !== 'no') {
467
468
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
469
$multiset_average = round($multiset_average, 1);
@@ -606,7 +608,7 @@ function yasr_visitor_multiset_callback ( $atts ) {
606
607
} //End foreach
608
609
- if ($show_average !== 'no') {
610
611
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
612
$multiset_average = round($multiset_average, 1);
@@ -681,7 +683,7 @@ function yasr_visitor_multiset_callback ( $atts ) {
681
} //end foreach ($set_name as $set_content)
682
683
684
- if ($show_average !== 'no') {
685
686
$shortcode_html .= "<tr>
687
<td colspan=\"2\" class=\"yasr-multiset-average\">
61
62
}
63
64
65
+ //If overall rating in loop is enabled don't use is_singular && is main_query
66
+ if ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
67
68
+ return $shortcode_html;
69
70
+ }
71
72
+ //default
73
+ else {
74
75
+ if( is_singular() && is_main_query() ) {
76
77
+ return $shortcode_html;
78
+
79
+ }
80
81
}
82
294
);
295
296
297
298
+ //If overall rating in loop is enabled don't use is_singular && is main_query
299
+ if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
300
301
+ return $shortcode_html;
302
303
+ }
304
305
+ //default value
306
+ else {
307
308
+ if( is_singular() && is_main_query() ) {
309
310
+ return $shortcode_html;
311
+
312
+ }
313
314
}
315
465
466
}
467
468
+ if ($show_average !== FALSE && $show_average !=='no'|| $show_average===FALSE && YASR_MULTI_SHOW_AVERAGE !== 'no') {
469
470
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
471
$multiset_average = round($multiset_average, 1);
608
609
} //End foreach
610
611
+ if ($show_average !== FALSE && $show_average !=='no'|| $show_average===FALSE && YASR_MULTI_SHOW_AVERAGE !== 'no') {
612
613
$multiset_average = $multiset_vote_sum / $multiset_rows_number;
614
$multiset_average = round($multiset_average, 1);
683
} //end foreach ($set_name as $set_content)
684
685
686
+ if ($show_average !== FALSE && $show_average !=='no' || $show_average===FALSE && YASR_MULTI_SHOW_AVERAGE !== 'no') {
687
688
$shortcode_html .= "<tr>
689
<td colspan=\"2\" class=\"yasr-multiset-average\">
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.4.2
7
- Stable tag: 1.2.4
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
@@ -111,6 +111,12 @@ Of course not: you can easily add it on the visual editor just by clicking the "
111
112
== Changelog ==
113
114
= 1.2.4 =
115
* FIXED: Settings lost on update
116
* FIXED: error if logo image are not set
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.5
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
111
112
== Changelog ==
113
114
+ = 1.2.5 =
115
+ * NEW FEATURE: in settings -> Multi Set tab is now possible to choose if show or hide by default the average for multi set
116
+ * FIXED: logo image for rich snippet
117
+ * TWEAKED: changed globals names
118
+ * FIXED: minor changes
119
+
120
= 1.2.4 =
121
* FIXED: Settings lost on update
122
* FIXED: error if logo image are not set
yasr-metabox-top-right.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
3
/*
4
@@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
44
45
}
46
47
- }
48
49
else {
50
$int = 0;
@@ -61,9 +61,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
61
<div id="yasr-overall-container">
62
63
64
- <?php
65
66
- if (YASR_METABOX_OVERALL_RATING == 'stars') {
67
68
?>
69
@@ -72,7 +72,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
72
<div id="yasr-vote-overall-stars">
73
74
<span id="yasr-rateit-vote-overall-text">
75
- <?php _e("Rate this article / item", 'yet-another-stars-rating'); ?>
76
</span>
77
78
<div class="rateit bigstars" id="yasr_rateit_overall" data-rateit-starwidth="32" data-rateit-starheight="32" data-rateit-value="<?php echo $overall_rating ?>" data-rateit-step="0.1" data-rateit-resetable="true" data-rateit-readonly="false">
@@ -97,7 +97,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
97
98
} //End if (YASR_METABOX_OVERALL_RATING == 'stars') {
99
100
- if (YASR_METABOX_OVERALL_RATING == 'numbers') {
101
102
?>
103
@@ -106,7 +106,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
106
<div id="yasr-vote-with-numbers" >
107
108
<span id="yasr-rateit-vote-overall-text">
109
- <?php _e("Rate this article / item", 'yet-another-stars-rating'); ?>
110
</span>
111
112
<div id="yasr-vote-with-numbers-select-container">
@@ -164,7 +164,7 @@ 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
@@ -189,8 +189,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
189
<p>
190
191
<div>
192
-
193
- <?php
194
195
//Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
196
if( YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
@@ -205,7 +205,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
205
206
</div>
207
208
- <?php
209
210
do_action( 'yasr_add_content_bottom_topright_metabox', $post_id );
211
1
+ <?php
2
3
/*
4
44
45
}
46
47
+ }
48
49
else {
50
$int = 0;
61
<div id="yasr-overall-container">
62
63
64
+ <?php
65
66
+ if (YASR_METABOX_OVERALL_RATING != 'numbers') {
67
68
?>
69
72
<div id="yasr-vote-overall-stars">
73
74
<span id="yasr-rateit-vote-overall-text">
75
+ <?php _e("Rate this article / item", 'yet-another-stars-rating'); ?>
76
</span>
77
78
<div class="rateit bigstars" id="yasr_rateit_overall" data-rateit-starwidth="32" data-rateit-starheight="32" data-rateit-value="<?php echo $overall_rating ?>" data-rateit-step="0.1" data-rateit-resetable="true" data-rateit-readonly="false">
97
98
} //End if (YASR_METABOX_OVERALL_RATING == 'stars') {
99
100
+ else {
101
102
?>
103
106
<div id="yasr-vote-with-numbers" >
107
108
<span id="yasr-rateit-vote-overall-text">
109
+ <?php _e("Rate this article / item", 'yet-another-stars-rating'); ?>
110
</span>
111
112
<div id="yasr-vote-with-numbers-select-container">
164
165
</div> <!--End numbers container-->
166
167
+ <?php
168
169
} //End if YASR_METABOX_OVERALL_RATING == 'numbers'
170
189
<p>
190
191
<div>
192
+
193
+ <?php
194
195
//Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
196
if( YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
205
206
</div>
207
208
+ <?php
209
210
do_action( 'yasr_add_content_bottom_topright_metabox', $post_id );
211
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.4
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
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.4');
36
37
//Plugin relative path
38
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
@@ -57,19 +57,19 @@ define ("YASR_IMG_DIR", plugins_url() .'/'. YASR_RELATIVE_PATH . '/img/');
57
/****** Getting options ******/
58
59
//Get general options
60
- $stored_options = get_option( 'yasr_general_options' );
61
62
- global $stored_options;
63
64
- define ("YASR_AUTO_INSERT_ENABLED", $stored_options['auto_insert_enabled']);
65
66
if ( YASR_AUTO_INSERT_ENABLED == 1 ) {
67
68
- define ("YASR_AUTO_INSERT_WHAT", $stored_options['auto_insert_what']);
69
- define ("YASR_AUTO_INSERT_WHERE", $stored_options['auto_insert_where']);
70
- define ("YASR_AUTO_INSERT_SIZE", $stored_options['auto_insert_size']);
71
- define ("YASR_AUTO_INSERT_EXCLUDE_PAGES", $stored_options['auto_insert_exclude_pages']);
72
- define ("YASR_AUTO_INSERT_CUSTOM_POST_ONLY", $stored_options['auto_insert_custom_post_only']);
73
74
}
75
@@ -84,51 +84,48 @@ else {
84
85
}
86
87
- define ("YASR_SHOW_OVERALL_IN_LOOP", $stored_options['show_overall_in_loop']);
88
- define ("YASR_SHOW_VISITOR_VOTES_IN_LOOP", $stored_options['show_visitor_votes_in_loop']);
89
- define ("YASR_TEXT_BEFORE_STARS", $stored_options['text_before_stars']);
90
91
if ( YASR_TEXT_BEFORE_STARS == 1 ) {
92
93
- define ("YASR_TEXT_BEFORE_OVERALL", $stored_options['text_before_overall']);
94
- define ("YASR_TEXT_BEFORE_VISITOR_RATING", $stored_options['text_before_visitor_rating']);
95
- define ("YASR_TEXT_AFTER_VISITOR_RATING", $stored_options['text_after_visitor_rating']);
96
- define ("YASR_CUSTOM_TEXT_USER_VOTED", $stored_options['custom_text_user_voted']);
97
98
}
99
100
- define ("YASR_VISITORS_STATS", $stored_options['visitors_stats']);
101
- define ("YASR_ALLOWED_USER", $stored_options['allowed_user']);
102
- define ("YASR_SNIPPET", $stored_options['snippet']);
103
- define ("YASR_ITEMTYPE", $stored_options['snippet_itemtype']);
104
105
- if (isset($stored_options['blogposting_organization_name'])) {
106
107
- if (filter_var($stored_options['blogposting_organization_name'], FILTER_VALIDATE_URL) === FALSE) {
108
109
- define ("YASR_BLOGPOSTING_ORGANIZATION_NAME", $stored_options['blogposting_organization_name']);
110
-
111
- }
112
113
- else {
114
115
- define ("YASR_BLOGPOSTING_ORGANIZATION_NAME", '');
116
-
117
- }
118
119
}
120
121
- if (isset($stored_options['blogposting_organization_logo'])) {
122
123
- if (filter_var($stored_options['blogposting_organization_logo'], FILTER_VALIDATE_URL) === FALSE) {
124
125
- define ("YASR_BLOGPOSTING_ORGANIZATION_LOGO", $stored_options['blogposting_organization_logo']);
126
127
}
128
129
}
130
131
- define ("YASR_METABOX_OVERALL_RATING", $stored_options['metabox_overall_rating']);
132
133
134
// this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed
@@ -176,6 +173,26 @@ else {
176
177
}
178
179
180
/****** End Getting options ******/
181
@@ -211,9 +228,9 @@ define ("YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif");
211
212
/****** backward compatibility functions ******/
213
214
- $version_installed = get_option('yasr-version');
215
216
- global $version_installed;
217
218
219
//Run this only on plugin activation (doesn't work on update)
@@ -221,10 +238,10 @@ register_activation_hook( __FILE__, 'yasr_on_activation' );
221
222
function yasr_on_activation () {
223
224
- global $version_installed;
225
226
//If this is a fresh new installation
227
- if (!$version_installed ) {
228
229
yasr_install();
230
@@ -240,23 +257,23 @@ function yasr_update_version() {
240
241
global $wpdb;
242
243
- global $version_installed;
244
245
- global $stored_options;
246
247
//Remove end Sept 2016
248
- if ($version_installed && $version_installed < '1.2.2') {
249
250
- $stored_options['blogposting_organization_name'] = get_bloginfo('name');
251
- $stored_options['blogposting_organization_logo'] = get_site_icon_url();
252
253
- update_option("yasr_general_options", $stored_options);
254
255
}
256
257
258
//Remove july 2016
259
- if ($version_installed && $version_installed < '1.0.5') {
260
261
$multiset_options = get_option('yasr_multiset_options');
262
@@ -277,7 +294,7 @@ function yasr_update_version() {
277
}
278
279
//remove end may 2016
280
- if ($version_installed && $version_installed < '1.0.2') {
281
282
$wpdb->query("ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name VARCHAR( 40 )
283
CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;");
@@ -285,28 +302,28 @@ function yasr_update_version() {
285
}
286
287
//Remove end April 2016
288
- if ($version_installed && $version_installed < '0.9.9') {
289
290
- $stored_options['snippet_format'] = 'microdata';
291
292
- update_option("yasr_general_options", $stored_options);
293
294
}
295
296
297
//Remove end March 2016
298
- if ($version_installed && $version_installed < '0.9.7') {
299
300
- $stored_options['snippet_itemtype'] = 'Product';
301
302
- update_option("yasr_general_options", $stored_options);
303
304
}
305
306
/****** End backward compatibility functions ******/
307
308
309
- if ($version_installed != YASR_VERSION_NUM) {
310
311
update_option('yasr-version', YASR_VERSION_NUM);
312
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.5
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
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.5');
36
37
//Plugin relative path
38
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
57
/****** Getting options ******/
58
59
//Get general options
60
+ $yasr_stored_options = get_option( 'yasr_general_options' );
61
62
+ global $yasr_stored_options;
63
64
+ define ("YASR_AUTO_INSERT_ENABLED", $yasr_stored_options['auto_insert_enabled']);
65
66
if ( YASR_AUTO_INSERT_ENABLED == 1 ) {
67
68
+ define ("YASR_AUTO_INSERT_WHAT", $yasr_stored_options['auto_insert_what']);
69
+ define ("YASR_AUTO_INSERT_WHERE", $yasr_stored_options['auto_insert_where']);
70
+ define ("YASR_AUTO_INSERT_SIZE", $yasr_stored_options['auto_insert_size']);
71
+ define ("YASR_AUTO_INSERT_EXCLUDE_PAGES", $yasr_stored_options['auto_insert_exclude_pages']);
72
+ define ("YASR_AUTO_INSERT_CUSTOM_POST_ONLY", $yasr_stored_options['auto_insert_custom_post_only']);
73
74
}
75
84
85
}
86
87
+ define ("YASR_SHOW_OVERALL_IN_LOOP", $yasr_stored_options['show_overall_in_loop']);
88
+ define ("YASR_SHOW_VISITOR_VOTES_IN_LOOP", $yasr_stored_options['show_visitor_votes_in_loop']);
89
+ define ("YASR_TEXT_BEFORE_STARS", $yasr_stored_options['text_before_stars']);
90
91
if ( YASR_TEXT_BEFORE_STARS == 1 ) {
92
93
+ define ("YASR_TEXT_BEFORE_OVERALL", $yasr_stored_options['text_before_overall']);
94
+ define ("YASR_TEXT_BEFORE_VISITOR_RATING", $yasr_stored_options['text_before_visitor_rating']);
95
+ define ("YASR_TEXT_AFTER_VISITOR_RATING", $yasr_stored_options['text_after_visitor_rating']);
96
+ define ("YASR_CUSTOM_TEXT_USER_VOTED", $yasr_stored_options['custom_text_user_voted']);
97
98
}
99
100
+ define ("YASR_VISITORS_STATS", $yasr_stored_options['visitors_stats']);
101
+ define ("YASR_ALLOWED_USER", $yasr_stored_options['allowed_user']);
102
+ define ("YASR_SNIPPET", $yasr_stored_options['snippet']);
103
+ define ("YASR_ITEMTYPE", $yasr_stored_options['snippet_itemtype']);
104
105
+ if (isset($yasr_stored_options['blogposting_organization_name'])) {
106
107
+ define ("YASR_BLOGPOSTING_ORGANIZATION_NAME", $yasr_stored_options['blogposting_organization_name']);
108
109
+ }
110
111
+ else {
112
113
+ define ("YASR_BLOGPOSTING_ORGANIZATION_NAME", '');
114
115
}
116
117
118
+ if (isset($yasr_stored_options['blogposting_organization_logo'])) {
119
+
120
+ if (filter_var($yasr_stored_options['blogposting_organization_logo'], FILTER_VALIDATE_URL) !== FALSE) {
121
122
+ define ("YASR_BLOGPOSTING_ORGANIZATION_LOGO", $yasr_stored_options['blogposting_organization_logo']);
123
124
}
125
126
}
127
128
+ define ("YASR_METABOX_OVERALL_RATING", $yasr_stored_options['metabox_overall_rating']);
129
130
131
// this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed
173
174
}
175
176
+ //Multi set options
177
+ $multi_set_options = get_option ('yasr_multiset_options');
178
+
179
+
180
+ if($multi_set_options) {
181
+
182
+ if(isset($multi_set_options['show_average'])) {
183
+
184
+ define ("YASR_MULTI_SHOW_AVERAGE", $multi_set_options['show_average']);
185
+
186
+ }
187
+
188
+ else {
189
+
190
+ define ("YASR_MULTI_SHOW_AVERAGE", 'yes');
191
+
192
+ }
193
+
194
+ }
195
+
196
197
/****** End Getting options ******/
198
228
229
/****** backward compatibility functions ******/
230
231
+ $yasr_version_installed = get_option('yasr-version');
232
233
+ global $yasr_version_installed;
234
235
236
//Run this only on plugin activation (doesn't work on update)
238
239
function yasr_on_activation () {
240
241
+ global $yasr_version_installed;
242
243
//If this is a fresh new installation
244
+ if (!$yasr_version_installed ) {
245
246
yasr_install();
247
257
258
global $wpdb;
259
260
+ global $yasr_version_installed;
261
262
+ global $yasr_stored_options;
263
264
//Remove end Sept 2016
265
+ if ($yasr_version_installed && $yasr_version_installed < '1.2.2') {
266
267
+ $yasr_stored_options['blogposting_organization_name'] = get_bloginfo('name');
268
+ $yasr_stored_options['blogposting_organization_logo'] = get_site_icon_url();
269
270
+ update_option("yasr_general_options", $yasr_stored_options);
271
272
}
273
274
275
//Remove july 2016
276
+ if ($yasr_version_installed && $yasr_version_installed < '1.0.5') {
277
278
$multiset_options = get_option('yasr_multiset_options');
279
294
}
295
296
//remove end may 2016
297
+ if ($yasr_version_installed && $yasr_version_installed < '1.0.2') {
298
299
$wpdb->query("ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name VARCHAR( 40 )
300
CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;");
302
}
303
304
//Remove end April 2016
305
+ if ($yasr_version_installed && $yasr_version_installed < '0.9.9') {
306
307
+ $yasr_stored_options['snippet_format'] = 'microdata';
308
309
+ update_option("yasr_general_options", $yasr_stored_options);
310
311
}
312
313
314
//Remove end March 2016
315
+ if ($yasr_version_installed && $yasr_version_installed < '0.9.7') {
316
317
+ $yasr_stored_options['snippet_itemtype'] = 'Product';
318
319
+ update_option("yasr_general_options", $yasr_stored_options);
320
321
}
322
323
/****** End backward compatibility functions ******/
324
325
326
+ if ($yasr_version_installed != YASR_VERSION_NUM) {
327
328
update_option('yasr-version', YASR_VERSION_NUM);
329