Yasr – Yet Another Stars Rating - Version 1.9.8

Version Description

  • FIXED: overall rating didn't get saved if default editor isnt't Gutenberg or Classic Editor
Download this release

Release Info

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

Code changes from version 1.9.7 to 1.9.8

changelog.txt CHANGED
@@ -1,3 +1,50 @@
1
= 1.8.2 =
2
* FIXED: widgets didn't load in front end
3
1
+ = 1.9.0 =
2
+ * NEW FEATURE: yasr_visitor_votes is now a Gutenberg block
3
+ * FIXED: In Gutenberg, when using yasr_overall_rating block, if post is rated and size or post_id is changed, stars got full filled
4
+ * TWEAKED: In classic editor, now overall_rating get saved along with the post update/save
5
+ * FIXED: In classic editor, review type didn't get saved if post is updated just after the type was changed
6
+ * TWEAKED: updated rater library
7
+ * TWEAKED: added a div with class "yasr-overall-rating" in the front end shortcode to allow customization
8
+ * TWEAKED: dropped out support for extensions
9
+ * TWEAKED: minor changes
10
+ [//]: # fs_premium_only_begin
11
+ * TWEAKED: if enabled, use curl instead of file_get_contents
12
+ * FIXED: missing text in the image upload sections
13
+ [//]: # fs_premium_only_end
14
+
15
+ = 1.8.9 =
16
+ * FIXED: updated freemius sdk to version 2.2.4
17
+
18
+ = 1.8.8 =
19
+ * FIXED: bug when using more than a multi set in a single page (remember to delete browser cache)
20
+ * FIXED: undefined notice
21
+
22
+ = 1.8.7 =
23
+ * FIXED: Security fix
24
+ * FIXED: if yasr_visitor_votes is used twice in the same page, loader and results are now shown in the right place
25
+ * TWEAKED: updated freemius sdk to version 2.2.3git
26
+ * NEW FEATURE: Yasr now works with WP Fastest Cache – WordPress Cache plugin by Emre Vona
27
+ * NEW FEATURE: Yasr now works with Cache Enabler – WordPress Cache plugin by KeyCDN
28
+
29
+ = 1.8.6 =
30
+ * NEW FEATURE: Gutenberg support! yasr_overall_rating (only this shortcode for now) supports the new WordPress default editor.
31
+ * TWEAKED: updated to tippy 3.6.0
32
+
33
+ = 1.8.5 =
34
+ * Fixed: is now possible to insert more than once a shortcode in the same page
35
+ * Fixed: Full RTL support (remember to delete all your caches)
36
+
37
+ = 1.8.4 =
38
+ * Small changes on stars images to better look on dark backgrounds
39
+ * Partial rtl support
40
+
41
+ = 1.8.3 =
42
+ * FIXED: multiset doesn't show up in the edit screen if only 1 is used
43
+ [//]: # fs_premium_only_begin
44
+ * FIXED: Missing stars in Yasr Custom Rankings
45
+ * TWEAKED: oxygen icon
46
+ [//]: # fs_premium_only_end
47
+
48
= 1.8.2 =
49
* FIXED: widgets didn't load in front end
50
js/src/yasr-guten-panel.js CHANGED
@@ -126,9 +126,10 @@ function yasrSidebar (props) {
126
);
127
}
128
129
// Our custom sidebar
130
registerPlugin( 'yasr-sidebar', {
131
icon: 'star-half',
132
title: __( 'Yasr: Page Settings', 'yet-another-stars-rating' ),
133
render: yasrSidebar
134
- } );
126
);
127
}
128
129
+
130
// Our custom sidebar
131
registerPlugin( 'yasr-sidebar', {
132
icon: 'star-half',
133
title: __( 'Yasr: Page Settings', 'yet-another-stars-rating' ),
134
render: yasrSidebar
135
+ } );
lib/admin/editor/yasr-metabox-top-right.php CHANGED
@@ -28,8 +28,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
28
$overall_rating = "0";
29
}
30
31
- $ajax_nonce_overall = wp_nonce_field( "yasr_nonce_overall_rating_action", "yasr_nonce_overall_rating");
32
- $ajax_nonce_review_type = wp_nonce_field( "yasr_nonce_review_type_action", "yasr_nonce_review_type" );
33
34
?>
35
@@ -119,9 +120,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
119
</div>
120
121
<?php
122
-
123
do_action( 'yasr_add_content_bottom_topright_metabox', $post_id );
124
-
125
?>
126
127
</div>
28
$overall_rating = "0";
29
}
30
31
+ $yasr_nonce_overall = wp_nonce_field( "yasr_nonce_overall_rating_action", "yasr_nonce_overall_rating");
32
+ $yasr_nonce_auto_insert = wp_nonce_field( "yasr_nonce_auto_insert_action", "yasr_nonce_auto_insert" );
33
+ $yasr_nonce_review_type = wp_nonce_field( "yasr_nonce_review_type_action", "yasr_nonce_review_type" );
34
35
?>
36
120
</div>
121
122
<?php
123
do_action( 'yasr_add_content_bottom_topright_metabox', $post_id );
124
?>
125
126
</div>
lib/yasr-db-functions.php CHANGED
@@ -799,55 +799,56 @@ add_action('save_post', 'yasr_insert_overall_rating_callback');
799
800
function yasr_insert_overall_rating_callback($post_id) {
801
802
- if (yasr_is_classic_editor_plugin_active ()) {
803
804
- $update_result = null;
805
806
- if (isset($_POST['yasr_overall_rating']) && isset($_POST['yasr_nonce_overall_rating'])) {
807
- $rating = $_POST['yasr_overall_rating'];
808
- $nonce = $_POST['yasr_nonce_overall_rating'];
809
- } else {
810
- return;
811
- }
812
-
813
- if (!current_user_can('publish_posts')) {
814
- wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
815
- }
816
817
- if (!wp_verify_nonce($nonce, 'yasr_nonce_overall_rating_action')) {
818
- return;
819
- }
820
821
- $rating = (float) $rating;
822
823
- if ($rating > 5) {
824
- $rating = 5;
825
- }
826
827
- //Put an action to hook into
828
- do_action('yasr_action_on_overall_rating', $post_id, $rating);
829
830
- $update_result = update_post_meta($post_id, 'yasr_overall_rating', $rating);
831
832
- //if update_post_meta returns an integer means this is a new post
833
- //so we're going to insert the default YASR_ITEMTYPE
834
- if (is_int($update_result)) {
835
- add_post_meta($post_id, 'yasr_review_type', YASR_ITEMTYPE);
836
- }
837
838
- //this will not work on error or
839
- //if the value is the same in the db
840
- //comment out from version 1.9.6
841
- //Have to find a way to save transient with gutenberg without save_post or ajax action
842
- /*if ($update_result) {
843
844
- $transient_name = 'yasr_overall_rating_' . $post_id;
845
846
- set_transient($transient_name, $rating, WEEK_IN_SECONDS);
847
848
- }*/
849
850
- }
851
852
}
853
@@ -856,42 +857,43 @@ add_action('save_post', 'yasr_insert_review_type_callback');
856
857
function yasr_insert_review_type_callback($post_id) {
858
859
- if (yasr_is_classic_editor_plugin_active ()) {
860
-
861
- if (isset($_POST['yasr-review-type']) && isset($_POST['yasr_nonce_review_type'])) {
862
- $reviewtype = $_POST['yasr-review-type'];
863
- $nonce = $_POST['yasr_nonce_review_type'];
864
- } else {
865
- return;
866
- }
867
-
868
- if (!current_user_can('publish_posts')) {
869
- wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
870
- }
871
872
- if (!wp_verify_nonce($nonce, 'yasr_nonce_review_type_action')) {
873
- return;
874
- }
875
876
877
- $post_id = (int) $post_id;
878
879
- if ($reviewtype === "1") {
880
- $reviewtype = 'Product';
881
- } elseif ($reviewtype === "2") {
882
- $reviewtype = 'Place';
883
- } elseif ($reviewtype === "3") {
884
- $reviewtype = "Recipe";
885
- } elseif ($reviewtype === "4") {
886
- $reviewtype = 'Other';
887
- } else {
888
- return;
889
- }
890
891
- $review_type = update_post_meta($post_id, 'yasr_review_type', $reviewtype);
892
893
}
894
895
}
896
897
@@ -903,14 +905,21 @@ if (YASR_AUTO_INSERT_ENABLED == 1) {
903
904
function yasr_exclude_auto_insert_callback($post_id) {
905
906
- if (yasr_is_classic_editor_plugin_active ()) {
907
908
- if (isset($_POST['yasr_auto_insert_disabled'])) {
909
- update_post_meta($post_id, 'yasr_auto_insert_disabled', 'yes');
910
- } else {
911
- delete_post_meta($post_id, 'yasr_auto_insert_disabled');
912
- }
913
914
}
915
916
}
799
800
function yasr_insert_overall_rating_callback($post_id) {
801
802
+ //this mean there we're not in the classic editor
803
+ if (!isset($_POST['yasr_nonce_overall_rating'])) {
804
+ return;
805
+ }
806
807
+ $update_result = null;
808
809
+ if (isset($_POST['yasr_overall_rating'])) {
810
+ $rating = $_POST['yasr_overall_rating'];
811
+ $nonce = $_POST['yasr_nonce_overall_rating'];
812
+ } else {
813
+ return;
814
+ }
815
816
+ if (!current_user_can('publish_posts')) {
817
+ wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
818
+ }
819
820
+ if (!wp_verify_nonce($nonce, 'yasr_nonce_overall_rating_action')) {
821
+ return;
822
+ }
823
824
+ $rating = (float) $rating;
825
826
+ if ($rating > 5) {
827
+ $rating = 5;
828
+ }
829
830
+ //Put an action to hook into
831
+ do_action('yasr_action_on_overall_rating', $post_id, $rating);
832
833
+ $update_result = update_post_meta($post_id, 'yasr_overall_rating', $rating);
834
835
+ //if update_post_meta returns an integer means this is a new post
836
+ //so we're going to insert the default YASR_ITEMTYPE
837
+ if (is_int($update_result)) {
838
+ add_post_meta($post_id, 'yasr_review_type', YASR_ITEMTYPE);
839
+ }
840
841
+ //this will not work on error or
842
+ //if the value is the same in the db
843
+ //comment out from version 1.9.6
844
+ //Have to find a way to save transient with gutenberg without save_post or ajax action
845
+ /*if ($update_result) {
846
847
+ $transient_name = 'yasr_overall_rating_' . $post_id;
848
849
+ set_transient($transient_name, $rating, WEEK_IN_SECONDS);
850
851
+ }*/
852
853
}
854
857
858
function yasr_insert_review_type_callback($post_id) {
859
860
+ //this mean there we're not in the classic editor
861
+ if(!isset($_POST['yasr_nonce_review_type'])) {
862
+ return;
863
+ }
864
865
+ if (isset($_POST['yasr-review-type'])) {
866
+ $reviewtype = $_POST['yasr-review-type'];
867
+ $nonce = $_POST['yasr_nonce_review_type'];
868
+ } else {
869
+ return;
870
+ }
871
872
+ if (!current_user_can('publish_posts')) {
873
+ wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
874
+ }
875
876
+ if (!wp_verify_nonce($nonce, 'yasr_nonce_review_type_action')) {
877
+ return;
878
+ }
879
880
881
+ $post_id = (int) $post_id;
882
883
+ if ($reviewtype === "1") {
884
+ $reviewtype = 'Product';
885
+ } elseif ($reviewtype === "2") {
886
+ $reviewtype = 'Place';
887
+ } elseif ($reviewtype === "3") {
888
+ $reviewtype = "Recipe";
889
+ } elseif ($reviewtype === "4") {
890
+ $reviewtype = 'Other';
891
+ } else {
892
+ return;
893
}
894
895
+ $review_type = update_post_meta($post_id, 'yasr_review_type', $reviewtype);
896
+
897
}
898
899
905
906
function yasr_exclude_auto_insert_callback($post_id) {
907
908
+ //this mean there we're not in the classic editor
909
+ if (!isset($_POST['yasr_nonce_auto_insert'])) {
910
+ return;
911
+ } else {
912
+ $nonce = $_POST['yasr_nonce_auto_insert'];
913
+ }
914
915
+ if (!wp_verify_nonce($nonce, 'yasr_nonce_auto_insert_action')) {
916
+ return;
917
+ }
918
919
+ if (isset($_POST['yasr_auto_insert_disabled'])) {
920
+ update_post_meta($post_id, 'yasr_auto_insert_disabled', 'yes');
921
+ } else {
922
+ delete_post_meta($post_id, 'yasr_auto_insert_disabled');
923
}
924
925
}
lib/yasr-functions.php CHANGED
@@ -966,29 +966,4 @@ function yasr_check_valid_url($url) {
966
967
}
968
969
- /**
970
- * Check if Classic Editor plugin is active.
971
- *
972
- * @return bool
973
- */
974
- function yasr_is_classic_editor_plugin_active() {
975
-
976
- global $wp_version;
977
-
978
- //Return alway true if version is < 5
979
- if ($wp_version < 5) {
980
- return true;
981
- } else {
982
- if (!function_exists('is_plugin_active')) {
983
- include_once ABSPATH . 'wp-admin/includes/plugin.php';
984
- }
985
-
986
- if (is_plugin_active('classic-editor/classic-editor.php')) {
987
- return true;
988
- }
989
-
990
- return false;
991
- }
992
- }
993
-
994
?>
966
967
}
968
969
?>
readme.txt CHANGED
@@ -3,9 +3,9 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
3
Tags: ratings, rating, postrating, google rating, 5 star, review, reviews, star rating, vote, votes, blocks
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
- Tested up to: 5.2.1
7
Requires PHP: 5.3
8
- Stable tag: 1.9.7
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!
@@ -50,6 +50,7 @@ In this video I'll show you the "Auto Insert" feature and manual placement of YA
50
* [Demo page for Rankings](https://yetanotherstarsrating.com/yasr-rankings/)
51
52
= Press =
53
* [WPMUDEV](http://premium.wpmudev.org/blog/free-wordpress-ratings-testimonials-subscriber-count-plugins/)
54
* [BRIANLI.COM](http://brianli.com/yet-another-stars-rating-wordpress-plugin-review/)
55
* [WPEXPLORER](http://www.wpexplorer.com/google-rich-snippets-wordpress/)
@@ -127,6 +128,9 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
127
128
The full changelog can be found in the plugin's directory. Recent entries:
129
130
= 1.9.7 =
131
* FIXED: Impossibile to create a new post if used classic editor
132
@@ -151,46 +155,6 @@ The full changelog can be found in the plugin's directory. Recent entries:
151
= 1.9.1 =
152
* FIXED: In some (rare) case, overall rating get empty with Gutenberg
153
154
- = 1.9.0 =
155
- * NEW FEATURE: yasr_visitor_votes is now a Gutenberg block
156
- * FIXED: In Gutenberg, when using yasr_overall_rating block, if post is rated and size or post_id is changed, stars got full filled
157
- * TWEAKED: In classic editor, now overall_rating get saved along with the post update/save
158
- * FIXED: In classic editor, review type didn't get saved if post is updated just after the type was changed
159
- * TWEAKED: updated rater library
160
- * TWEAKED: added a div with class "yasr-overall-rating" in the front end shortcode to allow customization
161
- * TWEAKED: dropped out support for extensions
162
- * TWEAKED: minor changes
163
-
164
-
165
- = 1.8.9 =
166
- * FIXED: updated freemius sdk to version 2.2.4
167
-
168
- = 1.8.8 =
169
- * FIXED: bug when using more than a multi set in a single page (remember to delete browser cache)
170
- * FIXED: undefined notice
171
-
172
- = 1.8.7 =
173
- * FIXED: Security fix
174
- * FIXED: if yasr_visitor_votes is used twice in the same page, loader and results are now shown in the right place
175
- * TWEAKED: updated freemius sdk to version 2.2.3git
176
- * NEW FEATURE: Yasr now works with WP Fastest Cache – WordPress Cache plugin by Emre Vona
177
- * NEW FEATURE: Yasr now works with Cache Enabler – WordPress Cache plugin by KeyCDN
178
-
179
- = 1.8.6 =
180
- * NEW FEATURE: Gutenberg support! yasr_overall_rating (only this shortcode for now) supports the new WordPress default editor.
181
- * TWEAKED: updated to tippy 3.6.0
182
-
183
- = 1.8.5 =
184
- * Fixed: is now possible to insert more than once a shortcode in the same page
185
- * Fixed: Full RTL support (remeber to delete all your caches)
186
-
187
- = 1.8.4 =
188
- * Small changes on stars images to better look on dark backgrounds
189
- * Partial rtl support
190
-
191
- = 1.8.3 =
192
- * FIXED: multiset doesn't show up in the edit screen if only 1 is used
193
-
194
195
= Additional Info =
196
External Libraries: [Rater](https://github.com/fredolss/rater-js)
3
Tags: ratings, rating, postrating, google rating, 5 star, review, reviews, star rating, vote, votes, blocks
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
+ Tested up to: 5.2.2
7
Requires PHP: 5.3
8
+ Stable tag: 1.9.8
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!
50
* [Demo page for Rankings](https://yetanotherstarsrating.com/yasr-rankings/)
51
52
= Press =
53
+ * [TIDYREPO](https://tidyrepo.com/yasr-yet-another-stars-rating/)
54
* [WPMUDEV](http://premium.wpmudev.org/blog/free-wordpress-ratings-testimonials-subscriber-count-plugins/)
55
* [BRIANLI.COM](http://brianli.com/yet-another-stars-rating-wordpress-plugin-review/)
56
* [WPEXPLORER](http://www.wpexplorer.com/google-rich-snippets-wordpress/)
128
129
The full changelog can be found in the plugin's directory. Recent entries:
130
131
+ = 1.9.8 =
132
+ * FIXED: overall rating didn't get saved if default editor isnt't Gutenberg or Classic Editor
133
+
134
= 1.9.7 =
135
* FIXED: Impossibile to create a new post if used classic editor
136
155
= 1.9.1 =
156
* FIXED: In some (rare) case, overall rating get empty with Gutenberg
157
158
159
= Additional Info =
160
External Libraries: [Rater](https://github.com/fredolss/rater-js)
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
* Plugin Name: Yet Another Stars Rating
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
- * Version: 1.9.7
8
* Author: Dario Curvino
9
* Author URI: https://dariocurvino.it/
10
* Text Domain: yet-another-stars-rating
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
76
yasr_fs();
77
// Signal that SDK was initiated.
78
do_action( 'yasr_fs_loaded' );
79
- define( 'YASR_VERSION_NUM', '1.9.7' );
80
//Plugin relative path
81
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
//Plugin RELATIVE PATH without slashes (just the directory's name)
4
* Plugin Name: Yet Another Stars Rating
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
+ * Version: 1.9.8
8
* Author: Dario Curvino
9
* Author URI: https://dariocurvino.it/
10
* Text Domain: yet-another-stars-rating
76
yasr_fs();
77
// Signal that SDK was initiated.
78
do_action( 'yasr_fs_loaded' );
79
+ define( 'YASR_VERSION_NUM', '1.9.8' );
80
//Plugin relative path
81
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
//Plugin RELATIVE PATH without slashes (just the directory's name)