Version Description
- NEW FEATURE: is now possible align to left, center or right if auto insert is used
- TWEAKED: check tidy version before use it: this will fix some enconding issue if an old version in server is installed
- TWEAKED: esc_html used instead of htmlspecialchars in the settings page
- TWEAKED: added a new filter yasr_filter_existing_schema: useful if there is the need to add new rich snippets
- TWEAKED: minor changes on schema function (thanks to Olivier)
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- css/yasr.css +6 -2
- img/yasr_settings_stats_disabled.png +0 -0
- img/yasr_settings_stats_enabled.png +0 -0
- lib/admin/settings/yasr-settings-functions-style.php +62 -56
- lib/admin/settings/yasr-settings-functions.php +73 -26
- lib/yasr-db-functions.php +1 -0
- lib/yasr-functions.php +34 -40
- readme.txt +17 -1
- yasr-settings-page.php +2 -8
- yet-another-stars-rating.php +14 -3
css/yasr.css
CHANGED
@@ -50,8 +50,12 @@
|
|
50 |
}
|
51 |
/****** NON ADMIN RULES ******/
|
52 |
|
53 |
-
.
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
#yasr-custom-text-before-overall {
|
50 |
}
|
51 |
/****** NON ADMIN RULES ******/
|
52 |
|
53 |
+
.yasr-auto-insert-overall {
|
54 |
+
margin-top: 10px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.yasr-auto-insert-visitor {
|
58 |
+
margin-top: 10px;
|
59 |
}
|
60 |
|
61 |
#yasr-custom-text-before-overall {
|
img/yasr_settings_stats_disabled.png
ADDED
Binary file
|
img/yasr_settings_stats_enabled.png
ADDED
Binary file
|
lib/admin/settings/yasr-settings-functions-style.php
CHANGED
@@ -18,89 +18,95 @@ 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 (
|
|
|
|
|
22 |
|
23 |
-
add_action(
|
24 |
|
25 |
function yasr_style_options_init() {
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
add_settings_section( 'yasr_style_options_section_id', __('Style Options', 'yet-another-stars-rating'), 'yasr_style_section_callback', 'yasr_style_tab' );
|
47 |
-
do_action('yasr_style_options_add_settings_field', $style_options);
|
48 |
-
add_settings_field( 'yasr_color_scheme_multiset', __('Which color scheme do you want to use?', 'yet-another-stars-rating') , 'yasr_color_scheme_multiset_callback', 'yasr_style_tab', 'yasr_style_options_section_id', $style_options);
|
49 |
-
add_settings_field( 'yasr_style_options_textarea', __('Custom CSS Styles', 'yet-another-stars-rating'), 'yasr_style_options_textarea_callback', 'yasr_style_tab', 'yasr_style_options_section_id', $style_options );
|
50 |
|
|
|
|
|
|
|
|
|
51 |
|
52 |
|
53 |
}
|
54 |
|
55 |
-
function yasr_style_section_callback
|
56 |
|
57 |
}
|
58 |
|
59 |
|
60 |
-
|
61 |
function yasr_color_scheme_multiset_callback($style_options) {
|
62 |
|
63 |
-
|
64 |
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
|
76 |
-
|
77 |
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
94 |
}
|
95 |
|
96 |
-
function yasr_style_options_textarea_callback
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
|
103 |
-
|
104 |
<textarea rows=\"17\" cols=\"40\" name=\"yasr_style_options[textarea]\" id=\"yasr_style_options_textarea\">$style_options[textarea]</textarea>
|
105 |
");
|
106 |
|
@@ -108,18 +114,18 @@ function yasr_style_options_textarea_callback ($style_options) {
|
|
108 |
}
|
109 |
|
110 |
//sanitize
|
111 |
-
function yasr_style_options_sanitize
|
112 |
|
113 |
-
|
114 |
|
115 |
-
|
116 |
-
|
117 |
|
118 |
-
//Always use
|
119 |
-
$output[$key] =
|
120 |
-
|
121 |
|
122 |
-
|
123 |
|
124 |
}
|
125 |
|
18 |
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
*/
|
20 |
|
21 |
+
if (!defined('ABSPATH')) {
|
22 |
+
exit('You\'re not allowed to see this page');
|
23 |
+
} // Exit if accessed directly
|
24 |
|
25 |
+
add_action('admin_init', 'yasr_style_options_init'); //This is for auto insert options
|
26 |
|
27 |
function yasr_style_options_init() {
|
28 |
|
29 |
+
register_setting(
|
30 |
+
'yasr_style_options_group', // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
|
31 |
+
'yasr_style_options', //The name of an option to sanitize and save.
|
32 |
+
'yasr_style_options_sanitize'
|
33 |
+
);
|
34 |
|
35 |
+
global $style_options;
|
36 |
|
37 |
+
if (!$style_options || !isset($style_options['scheme_color_multiset']) || !isset($style_options['textarea'])) {
|
38 |
|
39 |
+
$style_options = array();
|
40 |
+
$style_options['scheme_color_multiset'] = 'light';
|
41 |
+
$style_options['textarea'] = null;
|
42 |
|
43 |
+
}
|
44 |
|
45 |
+
//filter $style_options
|
46 |
+
$style_options = apply_filters('yasr_filter_style_options', $style_options);
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
add_settings_section('yasr_style_options_section_id', __('Style Options', 'yet-another-stars-rating'), 'yasr_style_section_callback', 'yasr_style_tab');
|
49 |
+
do_action('yasr_style_options_add_settings_field', $style_options);
|
50 |
+
add_settings_field('yasr_color_scheme_multiset', __('Which color scheme do you want to use?', 'yet-another-stars-rating'), 'yasr_color_scheme_multiset_callback', 'yasr_style_tab', 'yasr_style_options_section_id', $style_options);
|
51 |
+
add_settings_field('yasr_style_options_textarea', __('Custom CSS Styles', 'yet-another-stars-rating'), 'yasr_style_options_textarea_callback', 'yasr_style_tab', 'yasr_style_options_section_id', $style_options);
|
52 |
|
53 |
|
54 |
}
|
55 |
|
56 |
+
function yasr_style_section_callback() {
|
57 |
|
58 |
}
|
59 |
|
60 |
|
|
|
61 |
function yasr_color_scheme_multiset_callback($style_options) {
|
62 |
|
63 |
+
?>
|
64 |
|
65 |
+
<input type='radio' name='yasr_style_options[scheme_color_multiset]' value='light'
|
66 |
+
class='yasr-general-options-scheme-color' <?php if ($style_options['scheme_color_multiset'] === 'light') {
|
67 |
+
echo " checked=\"checked\" ";
|
68 |
+
} ?> />
|
69 |
+
<?php _e('Light', 'yet-another-stars-rating') ?>
|
70 |
|
71 |
+
|
72 |
|
73 |
+
<input type='radio' name='yasr_style_options[scheme_color_multiset]' value='dark'
|
74 |
+
class='yasr-general-options-scheme-color' <?php if ($style_options['scheme_color_multiset'] === 'dark') {
|
75 |
+
echo " checked=\"checked\" ";
|
76 |
+
} ?> />
|
77 |
+
<?php _e('Dark', 'yet-another-stars-rating') ?>
|
78 |
+
<br/>
|
79 |
|
80 |
+
<br/>
|
81 |
|
82 |
+
<a href="#" id="yasr-color-scheme-preview-link"><?php _e("Preview", 'yet-another-stars-rating') ?></a>
|
83 |
|
84 |
+
<div id="yasr-color-scheme-preview" style="display:none">
|
85 |
+
<?php
|
86 |
|
87 |
+
_e("Light theme", 'yet-another-stars-rating');
|
88 |
+
echo "<br /><br /><img src=" . YASR_IMG_DIR . "yasr-multi-set.png>";
|
89 |
|
90 |
+
echo "<br /> <br />";
|
91 |
|
92 |
+
_e("Dark theme", 'yet-another-stars-rating');
|
93 |
+
echo "<br /><br /><img src=" . YASR_IMG_DIR . "dark-multi-set.png>";
|
94 |
+
?>
|
95 |
+
</div>
|
96 |
|
97 |
+
<p>
|
98 |
|
99 |
+
<?php
|
100 |
}
|
101 |
|
102 |
+
function yasr_style_options_textarea_callback($style_options) {
|
103 |
|
104 |
+
_e("Please use text area below to write your own CSS styles to override the default ones.", 'yet-another-stars-rating');
|
105 |
+
echo "<br /><strong>";
|
106 |
+
_e("Leave it blank if you don't know what you're doing.", 'yet-another-stars-rating');
|
107 |
+
echo "</strong><p>";
|
108 |
|
109 |
+
echo("
|
110 |
<textarea rows=\"17\" cols=\"40\" name=\"yasr_style_options[textarea]\" id=\"yasr_style_options_textarea\">$style_options[textarea]</textarea>
|
111 |
");
|
112 |
|
114 |
}
|
115 |
|
116 |
//sanitize
|
117 |
+
function yasr_style_options_sanitize($style_options) {
|
118 |
|
119 |
+
$style_options = apply_filters('yasr_sanitize_style_options', $style_options);
|
120 |
|
121 |
+
foreach ($style_options as $key => $value) {
|
122 |
+
$output[$key] = strip_tags(stripslashes($style_options[$key]));
|
123 |
|
124 |
+
//Always use esc_html
|
125 |
+
$output[$key] = esc_html($output[$key]);
|
126 |
+
}
|
127 |
|
128 |
+
return $output;
|
129 |
|
130 |
}
|
131 |
|
lib/admin/settings/yasr-settings-functions.php
CHANGED
@@ -40,6 +40,7 @@ function yasr_general_options_init() {
|
|
40 |
if ($option && $option['auto_insert_enabled'] == 0) {
|
41 |
$option['auto_insert_what'] = 'visitor_rating';
|
42 |
$option['auto_insert_where'] = 'bottom';
|
|
|
43 |
$option['auto_insert_exclude_pages'] = 'yes';
|
44 |
$option['auto_insert_size'] = 'large';
|
45 |
$option['auto_insert_custom_post_only'] = 'no';
|
@@ -157,6 +158,45 @@ function yasr_auto_insert_callback($option) {
|
|
157 |
|
158 |
<p> </p>
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
<div>
|
161 |
<strong><?php _e('Size', 'yet-another-stars-rating'); ?></strong>
|
162 |
|
@@ -192,7 +232,6 @@ function yasr_auto_insert_callback($option) {
|
|
192 |
</div>
|
193 |
|
194 |
<p> </p>
|
195 |
-
|
196 |
<strong><?php _e('Exclude Pages?', 'yet-another-stars-rating'); ?></strong>
|
197 |
|
198 |
<div class="yasr-indented-answer">
|
@@ -258,7 +297,7 @@ function yasr_auto_insert_callback($option) {
|
|
258 |
?>
|
259 |
|
260 |
<?php
|
261 |
-
submit_button(
|
262 |
?>
|
263 |
|
264 |
</div>
|
@@ -271,11 +310,11 @@ function yasr_auto_insert_callback($option) {
|
|
271 |
|
272 |
function yasr_custom_text_callback($option) {
|
273 |
|
274 |
-
$text_before_overall =
|
275 |
-
$text_before_visitor_rating =
|
276 |
-
$text_after_visitor_rating =
|
277 |
-
$custom_text_user_votes =
|
278 |
-
$custom_text_must_sign_in =
|
279 |
|
280 |
?>
|
281 |
|
@@ -351,7 +390,7 @@ function yasr_custom_text_callback($option) {
|
|
351 |
echo '<br /><br/>';
|
352 |
|
353 |
_e('You can use these html tags:', 'yet-another-stars-rating');
|
354 |
-
echo ' <strong>' .
|
355 |
|
356 |
?>
|
357 |
|
@@ -360,7 +399,7 @@ function yasr_custom_text_callback($option) {
|
|
360 |
<p> </p>
|
361 |
|
362 |
<?php
|
363 |
-
submit_button(
|
364 |
echo '<hr />';
|
365 |
|
366 |
}
|
@@ -386,7 +425,6 @@ function yasr_show_overall_in_loop_callback($option) {
|
|
386 |
|
387 |
<p> </p>
|
388 |
|
389 |
-
|
390 |
<?php
|
391 |
|
392 |
}
|
@@ -412,6 +450,10 @@ function yasr_show_visitor_votes_in_loop_callback($option) {
|
|
412 |
|
413 |
<p> </p>
|
414 |
|
|
|
|
|
|
|
|
|
415 |
<br/>
|
416 |
|
417 |
<hr>
|
@@ -521,22 +563,24 @@ function yasr_enable_ip_callback($option) {
|
|
521 |
<br/>
|
522 |
|
523 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
|
525 |
-
|
526 |
-
__('Please note that to comply with the %s EU law, you %s MUST %s warn your users that you\'re storing their ip. %s
|
527 |
-
If in doubt, leave no.',
|
528 |
-
'yet-another-stars-rating'
|
529 |
-
),
|
530 |
-
'<a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>',
|
531 |
-
'<strong>', '</strong>', '<br />'
|
532 |
-
);
|
533 |
|
534 |
-
|
535 |
|
|
|
|
|
536 |
?>
|
537 |
|
538 |
-
<br/>
|
539 |
-
|
540 |
<hr>
|
541 |
|
542 |
<?php
|
@@ -678,7 +722,12 @@ function yasr_general_options_sanitize($option) {
|
|
678 |
$tidy_installed = false;
|
679 |
|
680 |
if (extension_loaded('tidy')) {
|
681 |
-
$
|
|
|
|
|
|
|
|
|
|
|
682 |
}
|
683 |
|
684 |
// Loop through each of the incoming options
|
@@ -711,8 +760,8 @@ function yasr_general_options_sanitize($option) {
|
|
711 |
$output[$key] = strip_tags(stripslashes($option[$key]), $allowed_tags);
|
712 |
}
|
713 |
|
714 |
-
//Always use
|
715 |
-
$output[$key] =
|
716 |
|
717 |
if ($key == 'blogposting_organization_logo') {
|
718 |
//if is not a valid url get_site_icon_url instead
|
@@ -734,7 +783,6 @@ function yasr_general_options_sanitize($option) {
|
|
734 |
$output['auto_insert_enabled'] = 1;
|
735 |
}
|
736 |
|
737 |
-
|
738 |
//Same as above but for [show_overall_in_loop] key
|
739 |
if (!array_key_exists('show_overall_in_loop', $output)) {
|
740 |
$output['show_overall_in_loop'] = 'disabled';
|
@@ -744,7 +792,6 @@ function yasr_general_options_sanitize($option) {
|
|
744 |
$output['show_overall_in_loop'] = 'enabled';
|
745 |
}
|
746 |
|
747 |
-
|
748 |
//Same as above but for [show_visitor_votes_in_loop] key
|
749 |
if (!array_key_exists('show_visitor_votes_in_loop', $output)) {
|
750 |
$output['show_visitor_votes_in_loop'] = 'disabled';
|
40 |
if ($option && $option['auto_insert_enabled'] == 0) {
|
41 |
$option['auto_insert_what'] = 'visitor_rating';
|
42 |
$option['auto_insert_where'] = 'bottom';
|
43 |
+
$option['auto_insert_align'] = 'center';
|
44 |
$option['auto_insert_exclude_pages'] = 'yes';
|
45 |
$option['auto_insert_size'] = 'large';
|
46 |
$option['auto_insert_custom_post_only'] = 'no';
|
158 |
|
159 |
<p> </p>
|
160 |
|
161 |
+
<div>
|
162 |
+
<strong><?php _e('Align', 'yet-another-stars-rating'); ?></strong>
|
163 |
+
|
164 |
+
<div class="yasr-indented-answer">
|
165 |
+
|
166 |
+
<div class="yasr-option-align">
|
167 |
+
<input type="radio" name="yasr_general_options[auto_insert_align]" value="left"
|
168 |
+
class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_align'] === 'left') {
|
169 |
+
echo " checked=\"checked\" ";
|
170 |
+
} ?> >
|
171 |
+
<span class="yasr-text-options-size">
|
172 |
+
<?php _e('Left', 'yet-another-stars-rating') ?>
|
173 |
+
</span>
|
174 |
+
</div>
|
175 |
+
|
176 |
+
<div class="yasr-option-align">
|
177 |
+
<input type="radio" name="yasr_general_options[auto_insert_align]" value="center"
|
178 |
+
class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_align'] === 'center') {
|
179 |
+
echo " checked=\"checked\" ";
|
180 |
+
} ?> >
|
181 |
+
<span class="yasr-text-options-size">
|
182 |
+
<?php _e('Center', 'yet-another-stars-rating') ?>
|
183 |
+
</span>
|
184 |
+
</div>
|
185 |
+
|
186 |
+
<div class="yasr-option-align">
|
187 |
+
<input type="radio" name="yasr_general_options[auto_insert_align]" value="right"
|
188 |
+
class="yasr-auto-insert-options-class" <?php if ($option['auto_insert_align'] === 'right') {
|
189 |
+
echo " checked=\"checked\" ";
|
190 |
+
} ?> >
|
191 |
+
<span class="yasr-text-options-size">
|
192 |
+
<?php _e('Right', 'yet-another-stars-rating') ?>
|
193 |
+
</span>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<p> </p>
|
199 |
+
|
200 |
<div>
|
201 |
<strong><?php _e('Size', 'yet-another-stars-rating'); ?></strong>
|
202 |
|
232 |
</div>
|
233 |
|
234 |
<p> </p>
|
|
|
235 |
<strong><?php _e('Exclude Pages?', 'yet-another-stars-rating'); ?></strong>
|
236 |
|
237 |
<div class="yasr-indented-answer">
|
297 |
?>
|
298 |
|
299 |
<?php
|
300 |
+
submit_button(SAVE_All_SETTINGS_TEXT);
|
301 |
?>
|
302 |
|
303 |
</div>
|
310 |
|
311 |
function yasr_custom_text_callback($option) {
|
312 |
|
313 |
+
$text_before_overall = $option['text_before_overall'];
|
314 |
+
$text_before_visitor_rating = $option['text_before_visitor_rating'];
|
315 |
+
$text_after_visitor_rating = $option['text_after_visitor_rating'];
|
316 |
+
$custom_text_user_votes = $option['custom_text_user_voted'];
|
317 |
+
$custom_text_must_sign_in = $option['custom_text_must_sign_in'];
|
318 |
|
319 |
?>
|
320 |
|
390 |
echo '<br /><br/>';
|
391 |
|
392 |
_e('You can use these html tags:', 'yet-another-stars-rating');
|
393 |
+
echo ' <strong>' . esc_html('<strong>, <p>') . '.</strong>';
|
394 |
|
395 |
?>
|
396 |
|
399 |
<p> </p>
|
400 |
|
401 |
<?php
|
402 |
+
submit_button(SAVE_All_SETTINGS_TEXT);
|
403 |
echo '<hr />';
|
404 |
|
405 |
}
|
425 |
|
426 |
<p> </p>
|
427 |
|
|
|
428 |
<?php
|
429 |
|
430 |
}
|
450 |
|
451 |
<p> </p>
|
452 |
|
453 |
+
<?php
|
454 |
+
submit_button(SAVE_All_SETTINGS_TEXT);
|
455 |
+
?>
|
456 |
+
|
457 |
<br/>
|
458 |
|
459 |
<hr>
|
563 |
<br/>
|
564 |
|
565 |
<?php
|
566 |
+
$string = sprintf(
|
567 |
+
__('Please note that to comply with the %s EU law, you %s MUST %s warn your users that you\'re storing their ip. %s
|
568 |
+
If in doubt, leave no.',
|
569 |
+
'yet-another-stars-rating'
|
570 |
+
),
|
571 |
+
'<a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>',
|
572 |
+
'<strong>', '</strong>', '<br />'
|
573 |
+
);
|
574 |
+
echo $string;
|
575 |
|
576 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
|
578 |
+
<br/><p> </p>
|
579 |
|
580 |
+
<?php
|
581 |
+
submit_button(SAVE_All_SETTINGS_TEXT);
|
582 |
?>
|
583 |
|
|
|
|
|
584 |
<hr>
|
585 |
|
586 |
<?php
|
722 |
$tidy_installed = false;
|
723 |
|
724 |
if (extension_loaded('tidy')) {
|
725 |
+
$tidy_release_date = strtotime(tidy_get_release());
|
726 |
+
$tidy_working_release_date = strtotime('2017/11/25');
|
727 |
+
|
728 |
+
if ($tidy_release_date >= $tidy_working_release_date) {
|
729 |
+
$tidy_installed = true;
|
730 |
+
}
|
731 |
}
|
732 |
|
733 |
// Loop through each of the incoming options
|
760 |
$output[$key] = strip_tags(stripslashes($option[$key]), $allowed_tags);
|
761 |
}
|
762 |
|
763 |
+
//Always use esc_html
|
764 |
+
$output[$key] = esc_html($output[$key]);
|
765 |
|
766 |
if ($key == 'blogposting_organization_logo') {
|
767 |
//if is not a valid url get_site_icon_url instead
|
783 |
$output['auto_insert_enabled'] = 1;
|
784 |
}
|
785 |
|
|
|
786 |
//Same as above but for [show_overall_in_loop] key
|
787 |
if (!array_key_exists('show_overall_in_loop', $output)) {
|
788 |
$output['show_overall_in_loop'] = 'disabled';
|
792 |
$output['show_overall_in_loop'] = 'enabled';
|
793 |
}
|
794 |
|
|
|
795 |
//Same as above but for [show_visitor_votes_in_loop] key
|
796 |
if (!array_key_exists('show_visitor_votes_in_loop', $output)) {
|
797 |
$output['show_visitor_votes_in_loop'] = 'disabled';
|
lib/yasr-db-functions.php
CHANGED
@@ -48,6 +48,7 @@ function yasr_on_activation_install($network_wide) {
|
|
48 |
$option['auto_insert_what'] = 'visitor_rating';
|
49 |
$option['auto_insert_where'] = 'bottom';
|
50 |
$option['auto_insert_size'] = 'large';
|
|
|
51 |
$option['auto_insert_exclude_pages'] = 'yes';
|
52 |
$option['auto_insert_custom_post_only'] = 'no';
|
53 |
$option['show_overall_in_loop'] = 'disabled';
|
48 |
$option['auto_insert_what'] = 'visitor_rating';
|
49 |
$option['auto_insert_where'] = 'bottom';
|
50 |
$option['auto_insert_size'] = 'large';
|
51 |
+
$option['auto_insert_align'] = 'center';
|
52 |
$option['auto_insert_exclude_pages'] = 'yes';
|
53 |
$option['auto_insert_custom_post_only'] = 'no';
|
54 |
$option['show_overall_in_loop'] = 'disabled';
|
lib/yasr-functions.php
CHANGED
@@ -227,7 +227,7 @@ function yasr_add_pages() {
|
|
227 |
'yasr_stats_page_callback'
|
228 |
);
|
229 |
|
230 |
-
if (yasr_fs()->is_free_plan()) {
|
231 |
global $submenu;
|
232 |
$permalink = '#';
|
233 |
$contact_us_string = sprintf(
|
@@ -281,9 +281,20 @@ if (YASR_AUTO_INSERT_ENABLED == 1) {
|
|
281 |
return $content;
|
282 |
}
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
$auto_insert_shortcode = null; //To avoid undefined variable notice outside the loop (if (is_singular) )
|
285 |
-
$overall_rating_code = '[yasr_overall_rating size="' . YASR_AUTO_INSERT_SIZE . '"]';
|
286 |
-
$visitor_votes_code = '[yasr_visitor_votes size="' . YASR_AUTO_INSERT_SIZE . '"]';
|
287 |
|
288 |
if (YASR_AUTO_INSERT_WHAT === 'overall_rating') {
|
289 |
switch (YASR_AUTO_INSERT_WHERE) {
|
@@ -359,7 +370,7 @@ function yasr_add_schema($content) {
|
|
359 |
|
360 |
//Add buddypress compatibility
|
361 |
if (function_exists('bp_is_active')) {
|
362 |
-
//If this is a page, return $content
|
363 |
//If I try to return $content after if (YASR_SNIPPET == 'overall_rating')
|
364 |
//or (YASR_SNIPPET == 'visitor_rating') $content will have only wp content, losing the buddypress one
|
365 |
if (is_page()) {
|
@@ -367,7 +378,7 @@ function yasr_add_schema($content) {
|
|
367 |
}
|
368 |
}
|
369 |
|
370 |
-
if (!is_singular() && is_main_query() || is_404()) {
|
371 |
return $content;
|
372 |
}
|
373 |
|
@@ -386,7 +397,6 @@ function yasr_add_schema($content) {
|
|
386 |
|
387 |
$rich_snippet["@context"] = "http://schema.org/";
|
388 |
|
389 |
-
|
390 |
$author = get_the_author();
|
391 |
$review_name = wp_strip_all_tags(get_the_title());
|
392 |
|
@@ -403,9 +413,7 @@ function yasr_add_schema($content) {
|
|
403 |
$logo_image_url_absolute = $_SERVER['DOCUMENT_ROOT'] . parse_url(YASR_BLOGPOSTING_ORGANIZATION_LOGO, PHP_URL_PATH);
|
404 |
|
405 |
$post_image_size = @getimagesize($logo_image_url_absolute); //the @ should be useless, just to be safe
|
406 |
-
|
407 |
$logo_image_size = @getimagesize($logo_image_url_absolute); //the @ should be useless, just to be safe
|
408 |
-
|
409 |
} else {
|
410 |
$post_image_size[0] = 0;
|
411 |
$post_image_size[1] = 0;
|
@@ -421,55 +429,44 @@ function yasr_add_schema($content) {
|
|
421 |
$post_image_size = @getimagesize($post_image_url_absolute); //the @ should be useless, just to be safe
|
422 |
}
|
423 |
|
|
|
|
|
|
|
|
|
424 |
|
425 |
if ($review_choosen === "Product") {
|
426 |
-
|
427 |
$rich_snippet["@type"] = "Product";
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
$rich_snippet["@type"] = "Recipe";
|
432 |
-
|
433 |
$rich_snippet["image"] = array(
|
434 |
"@type" => "ImageObject",
|
435 |
"url" => $post_image_url,
|
436 |
"width" => $post_image_size[0],
|
437 |
"height" => $post_image_size[1]
|
438 |
);
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
$rich_snippet["@type"] = "LocalBusiness";
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
$rich_snippet["@type"] = "BlogPosting";
|
447 |
-
|
448 |
$rich_snippet["datePublished"] = $date;
|
449 |
-
|
450 |
$rich_snippet["headline"] = $review_name;
|
451 |
-
|
452 |
$rich_snippet["mainEntityOfPage"] = array(
|
453 |
"@type" => "WebPage",
|
454 |
"@id" => get_permalink()
|
455 |
);
|
456 |
|
457 |
-
|
458 |
-
$rich_snippet["author"] = array(
|
459 |
-
"@type" => "Person",
|
460 |
-
"name" => "$author"
|
461 |
-
);
|
462 |
-
|
463 |
$rich_snippet["publisher"] = array(
|
464 |
"@type" => "Organization",
|
465 |
-
"name" => wp_strip_all_tags(YASR_BLOGPOSTING_ORGANIZATION_NAME), //already
|
466 |
"logo" => array(
|
467 |
"@type" => "ImageObject",
|
468 |
"url" => $logo_image_url,
|
469 |
"width" => $logo_image_size[0],
|
470 |
"height" => $logo_image_size[1]
|
471 |
)
|
472 |
-
|
473 |
);
|
474 |
|
475 |
$rich_snippet["dateModified"] = $date_modified;
|
@@ -511,9 +508,7 @@ function yasr_add_schema($content) {
|
|
511 |
} //END id if $overall_rating != '-1'
|
512 |
|
513 |
else {
|
514 |
-
|
515 |
return $content;
|
516 |
-
|
517 |
}
|
518 |
|
519 |
} //end if ($choosen_snippet['snippet'] == 'overall_rating')
|
@@ -523,27 +518,21 @@ function yasr_add_schema($content) {
|
|
523 |
$visitor_votes = yasr_get_visitor_votes(false, false);
|
524 |
|
525 |
if ($visitor_votes) {
|
526 |
-
|
527 |
foreach ($visitor_votes as $rating) {
|
528 |
$visitor_rating['votes_number'] = $rating->number_of_votes;
|
529 |
$visitor_rating['sum'] = $rating->sum_votes;
|
530 |
}
|
531 |
-
|
532 |
} else {
|
533 |
-
|
534 |
return $content;
|
535 |
-
|
536 |
}
|
537 |
|
538 |
if ($visitor_rating['sum'] != 0 && $visitor_rating['votes_number'] != 0) {
|
539 |
|
540 |
$average_rating = $visitor_rating['sum'] / $visitor_rating['votes_number'];
|
541 |
-
|
542 |
$average_rating = round($average_rating, 1);
|
543 |
|
544 |
//name
|
545 |
$rich_snippet["name"] = $review_name;
|
546 |
-
|
547 |
$rich_snippet["aggregateRating"] = array(
|
548 |
"@type" => "AggregateRating",
|
549 |
"ratingValue" => "$average_rating",
|
@@ -551,13 +540,18 @@ function yasr_add_schema($content) {
|
|
551 |
);
|
552 |
|
553 |
} else {
|
554 |
-
|
555 |
return $content;
|
556 |
-
|
557 |
}
|
558 |
|
559 |
}
|
560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
if (is_singular() && is_main_query() && !is_404()) {
|
562 |
return $content . $script_type . json_encode($rich_snippet) . $end_script_type;
|
563 |
} else {
|
227 |
'yasr_stats_page_callback'
|
228 |
);
|
229 |
|
230 |
+
if (yasr_fs()->is_free_plan() && !yasr_fs()->is_trial()) {
|
231 |
global $submenu;
|
232 |
$permalink = '#';
|
233 |
$contact_us_string = sprintf(
|
281 |
return $content;
|
282 |
}
|
283 |
|
284 |
+
$shortcode_align = YASR_AUTO_INSERT_ALIGN;
|
285 |
+
|
286 |
+
//if it is not left, or right, default is center
|
287 |
+
if ($shortcode_align !== 'left' && $shortcode_align !== 'right') {
|
288 |
+
$shortcode_align = 'center';
|
289 |
+
}
|
290 |
+
|
291 |
+
$container_div_overall='<div style="text-align:'.$shortcode_align.'" class="yasr-auto-insert-overall">';
|
292 |
+
$container_div_visitor='<div style="text-align:'.$shortcode_align.'" class="yasr-auto-insert-visitor">';
|
293 |
+
$closing_div = '</div>';
|
294 |
+
|
295 |
$auto_insert_shortcode = null; //To avoid undefined variable notice outside the loop (if (is_singular) )
|
296 |
+
$overall_rating_code = $container_div_overall. '[yasr_overall_rating size="' . YASR_AUTO_INSERT_SIZE . '"]' . $closing_div;
|
297 |
+
$visitor_votes_code = $container_div_visitor. '[yasr_visitor_votes size="' . YASR_AUTO_INSERT_SIZE . '"]' . $closing_div;
|
298 |
|
299 |
if (YASR_AUTO_INSERT_WHAT === 'overall_rating') {
|
300 |
switch (YASR_AUTO_INSERT_WHERE) {
|
370 |
|
371 |
//Add buddypress compatibility
|
372 |
if (function_exists('bp_is_active')) {
|
373 |
+
//If this is a page, return $content without adding schema.
|
374 |
//If I try to return $content after if (YASR_SNIPPET == 'overall_rating')
|
375 |
//or (YASR_SNIPPET == 'visitor_rating') $content will have only wp content, losing the buddypress one
|
376 |
if (is_page()) {
|
378 |
}
|
379 |
}
|
380 |
|
381 |
+
if (!is_singular() && is_main_query() || is_404() || did_action('get_footer')) {
|
382 |
return $content;
|
383 |
}
|
384 |
|
397 |
|
398 |
$rich_snippet["@context"] = "http://schema.org/";
|
399 |
|
|
|
400 |
$author = get_the_author();
|
401 |
$review_name = wp_strip_all_tags(get_the_title());
|
402 |
|
413 |
$logo_image_url_absolute = $_SERVER['DOCUMENT_ROOT'] . parse_url(YASR_BLOGPOSTING_ORGANIZATION_LOGO, PHP_URL_PATH);
|
414 |
|
415 |
$post_image_size = @getimagesize($logo_image_url_absolute); //the @ should be useless, just to be safe
|
|
|
416 |
$logo_image_size = @getimagesize($logo_image_url_absolute); //the @ should be useless, just to be safe
|
|
|
417 |
} else {
|
418 |
$post_image_size[0] = 0;
|
419 |
$post_image_size[1] = 0;
|
429 |
$post_image_size = @getimagesize($post_image_url_absolute); //the @ should be useless, just to be safe
|
430 |
}
|
431 |
|
432 |
+
$rich_snippet["author"] = array(
|
433 |
+
"@type" => "Person",
|
434 |
+
"name" => "$author"
|
435 |
+
);
|
436 |
|
437 |
if ($review_choosen === "Product") {
|
|
|
438 |
$rich_snippet["@type"] = "Product";
|
439 |
+
}
|
440 |
+
elseif ($review_choosen === "Recipe") {
|
|
|
441 |
$rich_snippet["@type"] = "Recipe";
|
|
|
442 |
$rich_snippet["image"] = array(
|
443 |
"@type" => "ImageObject",
|
444 |
"url" => $post_image_url,
|
445 |
"width" => $post_image_size[0],
|
446 |
"height" => $post_image_size[1]
|
447 |
);
|
448 |
+
}
|
449 |
+
elseif ($review_choosen == "Place") {
|
|
|
450 |
$rich_snippet["@type"] = "LocalBusiness";
|
451 |
+
}
|
452 |
+
elseif ($review_choosen == "Other") {
|
|
|
453 |
$rich_snippet["@type"] = "BlogPosting";
|
|
|
454 |
$rich_snippet["datePublished"] = $date;
|
|
|
455 |
$rich_snippet["headline"] = $review_name;
|
|
|
456 |
$rich_snippet["mainEntityOfPage"] = array(
|
457 |
"@type" => "WebPage",
|
458 |
"@id" => get_permalink()
|
459 |
);
|
460 |
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
$rich_snippet["publisher"] = array(
|
462 |
"@type" => "Organization",
|
463 |
+
"name" => wp_strip_all_tags(YASR_BLOGPOSTING_ORGANIZATION_NAME), //already sanitized in the settings, just to be safe
|
464 |
"logo" => array(
|
465 |
"@type" => "ImageObject",
|
466 |
"url" => $logo_image_url,
|
467 |
"width" => $logo_image_size[0],
|
468 |
"height" => $logo_image_size[1]
|
469 |
)
|
|
|
470 |
);
|
471 |
|
472 |
$rich_snippet["dateModified"] = $date_modified;
|
508 |
} //END id if $overall_rating != '-1'
|
509 |
|
510 |
else {
|
|
|
511 |
return $content;
|
|
|
512 |
}
|
513 |
|
514 |
} //end if ($choosen_snippet['snippet'] == 'overall_rating')
|
518 |
$visitor_votes = yasr_get_visitor_votes(false, false);
|
519 |
|
520 |
if ($visitor_votes) {
|
|
|
521 |
foreach ($visitor_votes as $rating) {
|
522 |
$visitor_rating['votes_number'] = $rating->number_of_votes;
|
523 |
$visitor_rating['sum'] = $rating->sum_votes;
|
524 |
}
|
|
|
525 |
} else {
|
|
|
526 |
return $content;
|
|
|
527 |
}
|
528 |
|
529 |
if ($visitor_rating['sum'] != 0 && $visitor_rating['votes_number'] != 0) {
|
530 |
|
531 |
$average_rating = $visitor_rating['sum'] / $visitor_rating['votes_number'];
|
|
|
532 |
$average_rating = round($average_rating, 1);
|
533 |
|
534 |
//name
|
535 |
$rich_snippet["name"] = $review_name;
|
|
|
536 |
$rich_snippet["aggregateRating"] = array(
|
537 |
"@type" => "AggregateRating",
|
538 |
"ratingValue" => "$average_rating",
|
540 |
);
|
541 |
|
542 |
} else {
|
|
|
543 |
return $content;
|
|
|
544 |
}
|
545 |
|
546 |
}
|
547 |
|
548 |
+
//if doesn't exists a filter for yasr_filter_existing_schema, false is assigned to $more_rich_snippet
|
549 |
+
$more_rich_snippet = apply_filters('yasr_filter_existing_schema', $review_choosen);
|
550 |
+
|
551 |
+
if ($more_rich_snippet !== false) {
|
552 |
+
$rich_snippet = array_merge($rich_snippet, $more_rich_snippet);
|
553 |
+
}
|
554 |
+
|
555 |
if (is_singular() && is_main_query() && !is_404()) {
|
556 |
return $content . $script_type . json_encode($rich_snippet) . $end_script_type;
|
557 |
} else {
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.3.0
|
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.2.2
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.0.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
@@ -133,6 +133,14 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
|
|
133 |
|
134 |
The full changelog can be found in the plugin's directory. Recent entries:
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
= 2.0.3 =
|
137 |
* TWEAKED: some changes in settings page
|
138 |
* TWEAKED: new default values for new installations.
|
@@ -172,3 +180,11 @@ The full changelog can be found in the plugin's directory. Recent entries:
|
|
172 |
* TWEAKED: settings redesigned
|
173 |
* TWEAKED: code cleanup
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.2.2
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.0.4
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
133 |
|
134 |
The full changelog can be found in the plugin's directory. Recent entries:
|
135 |
|
136 |
+
= 2.0.4 =
|
137 |
+
* NEW FEATURE: is now possible align to left, center or right if auto insert is used
|
138 |
+
* TWEAKED: check tidy version before use it: this will fix some enconding issue if an old version in server is installed
|
139 |
+
* TWEAKED: esc_html used instead of htmlspecialchars in the settings page
|
140 |
+
* TWEAKED: added a new filter yasr_filter_existing_schema: useful if there is the need to add new rich snippets
|
141 |
+
* TWEAKED: minor changes on schema function (thanks to Olivier)
|
142 |
+
|
143 |
+
|
144 |
= 2.0.3 =
|
145 |
* TWEAKED: some changes in settings page
|
146 |
* TWEAKED: new default values for new installations.
|
180 |
* TWEAKED: settings redesigned
|
181 |
* TWEAKED: code cleanup
|
182 |
|
183 |
+
|
184 |
+
= Additional Info =
|
185 |
+
External Libraries: [Rater](https://github.com/fredolss/rater-js)
|
186 |
+
[tippy](https://atomiks.github.io/tippyjs/)
|
187 |
+
|
188 |
+
Flat star icon made by[Freepik](http://www.freepik.com)
|
189 |
+
from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
|
190 |
+
|
yasr-settings-page.php
CHANGED
@@ -53,7 +53,7 @@ $n_multi_set = null; //Evoid undefined variable when printed outside multiset ta
|
|
53 |
<?php
|
54 |
settings_fields('yasr_general_options_group');
|
55 |
do_settings_sections('yasr_general_settings_tab');
|
56 |
-
submit_button(
|
57 |
?>
|
58 |
</form>
|
59 |
</div>
|
@@ -71,18 +71,13 @@ $n_multi_set = null; //Evoid undefined variable when printed outside multiset ta
|
|
71 |
|
72 |
|
73 |
if ($active_tab === 'manage_multi') {
|
74 |
-
|
75 |
include (YASR_ABSOLUTE_PATH . '/lib/admin/settings/yasr-settings-functions-multiset-page.php');
|
76 |
-
|
77 |
yasr_right_settings_panel();
|
78 |
-
|
79 |
} //End if ($active_tab=='manage_multi')
|
80 |
|
81 |
|
82 |
if ($active_tab === 'style_options') {
|
83 |
-
|
84 |
?>
|
85 |
-
|
86 |
<?php do_action('yasr_add_content_top_style_options_tab', $active_tab); ?>
|
87 |
|
88 |
<div class="yasr-settingsdiv">
|
@@ -90,7 +85,7 @@ $n_multi_set = null; //Evoid undefined variable when printed outside multiset ta
|
|
90 |
<?php
|
91 |
settings_fields('yasr_style_options_group');
|
92 |
do_settings_sections('yasr_style_tab');
|
93 |
-
submit_button(
|
94 |
?>
|
95 |
</form>
|
96 |
</div>
|
@@ -128,7 +123,6 @@ $n_multi_set = null; //Evoid undefined variable when printed outside multiset ta
|
|
128 |
|
129 |
} //End tab migration
|
130 |
|
131 |
-
|
132 |
do_action('yasr_settings_check_active_tab', $active_tab);
|
133 |
|
134 |
yasr_right_settings_panel('bottom');
|
53 |
<?php
|
54 |
settings_fields('yasr_general_options_group');
|
55 |
do_settings_sections('yasr_general_settings_tab');
|
56 |
+
submit_button(SAVE_All_SETTINGS_TEXT);
|
57 |
?>
|
58 |
</form>
|
59 |
</div>
|
71 |
|
72 |
|
73 |
if ($active_tab === 'manage_multi') {
|
|
|
74 |
include (YASR_ABSOLUTE_PATH . '/lib/admin/settings/yasr-settings-functions-multiset-page.php');
|
|
|
75 |
yasr_right_settings_panel();
|
|
|
76 |
} //End if ($active_tab=='manage_multi')
|
77 |
|
78 |
|
79 |
if ($active_tab === 'style_options') {
|
|
|
80 |
?>
|
|
|
81 |
<?php do_action('yasr_add_content_top_style_options_tab', $active_tab); ?>
|
82 |
|
83 |
<div class="yasr-settingsdiv">
|
85 |
<?php
|
86 |
settings_fields('yasr_style_options_group');
|
87 |
do_settings_sections('yasr_style_tab');
|
88 |
+
submit_button(SAVE_All_SETTINGS_TEXT);
|
89 |
?>
|
90 |
</form>
|
91 |
</div>
|
123 |
|
124 |
} //End tab migration
|
125 |
|
|
|
126 |
do_action('yasr_settings_check_active_tab', $active_tab);
|
127 |
|
128 |
yasr_right_settings_panel('bottom');
|
yet-another-stars-rating.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
|
7 |
-
* Version: 2.0.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -56,7 +56,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
56 |
'has_paid_plans' => true,
|
57 |
'trial' => array(
|
58 |
'days' => 14,
|
59 |
-
'is_require_payment' =>
|
60 |
),
|
61 |
'menu' => array(
|
62 |
'slug' => 'yasr_settings_page',
|
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
-
define( 'YASR_VERSION_NUM', '2.0.
|
80 |
//Plugin relative path
|
81 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
82 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
@@ -99,12 +99,14 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
99 |
if ( YASR_AUTO_INSERT_ENABLED == 1 ) {
|
100 |
define( "YASR_AUTO_INSERT_WHAT", $yasr_stored_options['auto_insert_what'] );
|
101 |
define( "YASR_AUTO_INSERT_WHERE", $yasr_stored_options['auto_insert_where'] );
|
|
|
102 |
define( "YASR_AUTO_INSERT_SIZE", $yasr_stored_options['auto_insert_size'] );
|
103 |
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", $yasr_stored_options['auto_insert_exclude_pages'] );
|
104 |
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", $yasr_stored_options['auto_insert_custom_post_only'] );
|
105 |
} else {
|
106 |
define( "YASR_AUTO_INSERT_WHAT", null );
|
107 |
define( "YASR_AUTO_INSERT_WHERE", null );
|
|
|
108 |
define( "YASR_AUTO_INSERT_SIZE", null );
|
109 |
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", null );
|
110 |
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", null );
|
@@ -205,6 +207,9 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
205 |
define( "YASR_MULTI_SET_VALUES_TABLE", $wpdb->prefix . 'yasr_multi_values' );
|
206 |
define( "YASR_LOG_TABLE", $wpdb->prefix . 'yasr_log' );
|
207 |
define( "YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif" );
|
|
|
|
|
|
|
208 |
$yasr_version_installed = get_option( 'yasr-version' );
|
209 |
global $yasr_version_installed ;
|
210 |
$yasr_plugin_imported = get_option( 'yasr_plugin_imported' );
|
@@ -239,6 +244,12 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
239 |
global $wpdb ;
|
240 |
global $yasr_version_installed ;
|
241 |
global $yasr_stored_options ;
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
if ( $yasr_version_installed && $yasr_version_installed < '1.7.3' ) {
|
243 |
$wpdb->query( "ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name varchar(40) \n COLLATE 'utf8_unicode_ci' NOT NULL \n AFTER parent_set_id;\n " );
|
244 |
}
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
|
7 |
+
* Version: 2.0.4
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
56 |
'has_paid_plans' => true,
|
57 |
'trial' => array(
|
58 |
'days' => 14,
|
59 |
+
'is_require_payment' => true,
|
60 |
),
|
61 |
'menu' => array(
|
62 |
'slug' => 'yasr_settings_page',
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
+
define( 'YASR_VERSION_NUM', '2.0.4' );
|
80 |
//Plugin relative path
|
81 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
82 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
99 |
if ( YASR_AUTO_INSERT_ENABLED == 1 ) {
|
100 |
define( "YASR_AUTO_INSERT_WHAT", $yasr_stored_options['auto_insert_what'] );
|
101 |
define( "YASR_AUTO_INSERT_WHERE", $yasr_stored_options['auto_insert_where'] );
|
102 |
+
define( "YASR_AUTO_INSERT_ALIGN", $yasr_stored_options['auto_insert_align'] );
|
103 |
define( "YASR_AUTO_INSERT_SIZE", $yasr_stored_options['auto_insert_size'] );
|
104 |
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", $yasr_stored_options['auto_insert_exclude_pages'] );
|
105 |
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", $yasr_stored_options['auto_insert_custom_post_only'] );
|
106 |
} else {
|
107 |
define( "YASR_AUTO_INSERT_WHAT", null );
|
108 |
define( "YASR_AUTO_INSERT_WHERE", null );
|
109 |
+
define( "YASR_AUTO_INSERT_ALIGN", null );
|
110 |
define( "YASR_AUTO_INSERT_SIZE", null );
|
111 |
define( "YASR_AUTO_INSERT_EXCLUDE_PAGES", null );
|
112 |
define( "YASR_AUTO_INSERT_CUSTOM_POST_ONLY", null );
|
207 |
define( "YASR_MULTI_SET_VALUES_TABLE", $wpdb->prefix . 'yasr_multi_values' );
|
208 |
define( "YASR_LOG_TABLE", $wpdb->prefix . 'yasr_log' );
|
209 |
define( "YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif" );
|
210 |
+
//Text for button in settings pages
|
211 |
+
$save_settings_text = __( 'Save All Settings', 'yet-another-stars-rating' );
|
212 |
+
define( "SAVE_All_SETTINGS_TEXT", $save_settings_text );
|
213 |
$yasr_version_installed = get_option( 'yasr-version' );
|
214 |
global $yasr_version_installed ;
|
215 |
$yasr_plugin_imported = get_option( 'yasr_plugin_imported' );
|
244 |
global $wpdb ;
|
245 |
global $yasr_version_installed ;
|
246 |
global $yasr_stored_options ;
|
247 |
+
|
248 |
+
if ( $yasr_version_installed && $yasr_version_installed < '2.0.4' ) {
|
249 |
+
$yasr_stored_options['auto_insert_align'] = 'left';
|
250 |
+
update_option( 'yasr_general_options', $yasr_stored_options );
|
251 |
+
}
|
252 |
+
|
253 |
if ( $yasr_version_installed && $yasr_version_installed < '1.7.3' ) {
|
254 |
$wpdb->query( "ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name varchar(40) \n COLLATE 'utf8_unicode_ci' NOT NULL \n AFTER parent_set_id;\n " );
|
255 |
}
|