Yasr – Yet Another Stars Rating - Version 2.1.4

Version Description

  • FIXED: undefined variable when saving/updating post or page
  • TWEAKED: changed delete_post_meta with delete_metadata
  • TWEAKED: Updated support link in settings pages
Download this release

Release Info

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

Code changes from version 2.1.3 to 2.1.4

lib/admin/settings/yasr-settings-functions-misc.php CHANGED
@@ -140,15 +140,15 @@ function yasr_resources_box( $position = false )
140
  $text = '<div class="yasr-donate-title">Resources</div>';
141
  $text .= '<div class="yasr-donate-single-resource">
142
  <span class="dashicons dashicons-star-filled" style="color: #ccc"></span>
143
- <a target="blank" href="http://yetanotherstarsrating.com/">' . __( 'YASR official website', 'yet-another-stars-rating' ) . '</a>
144
  </div>';
145
  $text .= '<div class="yasr-donate-single-resource">
146
  <span class="dashicons dashicons-edit" style="color: #ccc"></span>
147
- <a target="blank" href="https://yetanotherstarsrating.com/yasr-basics-shortcode/">' . __( 'Documentation', 'yet-another-stars-rating' ) . '</a>
148
  </div>';
149
  $text .= '<div class="yasr-donate-single-resource">
150
  <span class="dashicons dashicons-book-alt" style="color: #ccc"></span>
151
- <a target="blank" href="https://yetanotherstarsrating.com/f-a-q/">' . __( 'F.A.Q.', 'yet-another-stars-rating' ) . '</a>
152
  </div>';
153
  $text .= '<div class="yasr-donate-single-resource">
154
  <span class="dashicons dashicons-video-alt3" style="color: #ccc"></span>
@@ -156,7 +156,7 @@ function yasr_resources_box( $position = false )
156
  </div>';
157
  $text .= '<div class="yasr-donate-single-resource">
158
  <span class="dashicons dashicons-smiley" style="color: #ccc"></span>
159
- <a target="blank" href="https://www.youtube.com/channel/UCU5jbO1PJsUUsCNbME9S-Zw">
160
  Yasr Pro
161
  </a>
162
  </div>';
140
  $text = '<div class="yasr-donate-title">Resources</div>';
141
  $text .= '<div class="yasr-donate-single-resource">
142
  <span class="dashicons dashicons-star-filled" style="color: #ccc"></span>
143
+ <a target="blank" href="https://yetanotherstarsrating.com/">' . __( 'YASR official website', 'yet-another-stars-rating' ) . '</a>
144
  </div>';
145
  $text .= '<div class="yasr-donate-single-resource">
146
  <span class="dashicons dashicons-edit" style="color: #ccc"></span>
147
+ <a target="blank" href="https://yetanotherstarsrating.com/docs/">' . __( 'Documentation', 'yet-another-stars-rating' ) . '</a>
148
  </div>';
149
  $text .= '<div class="yasr-donate-single-resource">
150
  <span class="dashicons dashicons-book-alt" style="color: #ccc"></span>
151
+ <a target="blank" href="https://yetanotherstarsrating.com/docs/faq/">' . __( 'F.A.Q.', 'yet-another-stars-rating' ) . '</a>
152
  </div>';
153
  $text .= '<div class="yasr-donate-single-resource">
154
  <span class="dashicons dashicons-video-alt3" style="color: #ccc"></span>
156
  </div>';
157
  $text .= '<div class="yasr-donate-single-resource">
158
  <span class="dashicons dashicons-smiley" style="color: #ccc"></span>
159
+ <a target="blank" href="https://yetanotherstarsrating.com/#yasr-pro">
160
  Yasr Pro
161
  </a>
162
  </div>';
lib/admin/yasr-update-functions.php CHANGED
@@ -121,7 +121,7 @@ function yasr_update_version() {
121
  user_id bigint(20) NOT NULL,
122
  date datetime NOT NULL,
123
  ip varchar(45) COLLATE 'utf8_unicode_ci' NOT NULL,
124
- PRIMARY KEY (id),
125
  UNIQUE KEY id (id)
126
  ) COLLATE 'utf8_unicode_ci'";
127
 
121
  user_id bigint(20) NOT NULL,
122
  date datetime NOT NULL,
123
  ip varchar(45) COLLATE 'utf8_unicode_ci' NOT NULL,
124
+ PRIMARY KEY (id),
125
  UNIQUE KEY id (id)
126
  ) COLLATE 'utf8_unicode_ci'";
127
 
lib/yasr-db-functions.php CHANGED
@@ -770,18 +770,18 @@ function admin_init_delete_data_on_post_callback() {
770
 
771
  }
772
 
773
- function yasr_erase_data_on_post_page_remove_callback($pid) {
774
-
775
  global $wpdb;
776
 
777
- delete_post_meta($pid, 'yasr_overall_rating');
778
- delete_post_meta($pid, 'yasr_review_type');
779
-
 
780
  //Delete multi value
781
  $wpdb->delete(
782
  YASR_LOG_MULTI_SET,
783
  array(
784
- 'post_id' => $pid
785
  ),
786
  array(
787
  '%d'
@@ -791,7 +791,7 @@ function yasr_erase_data_on_post_page_remove_callback($pid) {
791
  $wpdb->delete(
792
  YASR_LOG_TABLE,
793
  array(
794
- 'post_id' => $pid
795
  ),
796
  array(
797
  '%d'
@@ -888,8 +888,8 @@ function yasr_insert_review_type_callback($post_id) {
888
  }
889
 
890
  if (isset($_POST['yasr-review-type'])) {
891
- $reviewtype = $_POST['yasr-review-type'];
892
- $nonce = $_POST['yasr_nonce_review_type'];
893
  } else {
894
  return;
895
  }
@@ -902,20 +902,9 @@ function yasr_insert_review_type_callback($post_id) {
902
  return;
903
  }
904
 
 
905
 
906
- $post_id = (int) $post_id;
907
-
908
- if ($snippet_type != 'Product'
909
- && $snippet_type != 'Place'
910
- && $snippet_type != 'Recipe'
911
- && $snippet_type != 'Book'
912
- && $snippet_type != 'Movie'
913
- && $snippet_type != 'Other') {
914
- $review_type = update_post_meta($post_id, 'yasr_review_type', $reviewtype);
915
- }
916
- else {
917
- return;
918
- }
919
 
920
  }
921
 
@@ -1091,4 +1080,5 @@ function yasr_gutenberg_show_in_rest_overall_meta() {
1091
 
1092
  }
1093
 
 
1094
  ?>
770
 
771
  }
772
 
773
+ function yasr_erase_data_on_post_page_remove_callback($post_id) {
 
774
  global $wpdb;
775
 
776
+ delete_metadata('post', $post_id, 'yasr_overall_rating');
777
+ delete_metadata('post', $post_id, 'yasr_review_type');
778
+ delete_metadata('post', $post_id, 'yasr_multiset_author_votes');
779
+
780
  //Delete multi value
781
  $wpdb->delete(
782
  YASR_LOG_MULTI_SET,
783
  array(
784
+ 'post_id' => $post_id
785
  ),
786
  array(
787
  '%d'
791
  $wpdb->delete(
792
  YASR_LOG_TABLE,
793
  array(
794
+ 'post_id' => $post_id
795
  ),
796
  array(
797
  '%d'
888
  }
889
 
890
  if (isset($_POST['yasr-review-type'])) {
891
+ $snippet_type = $_POST['yasr-review-type'];
892
+ $nonce = $_POST['yasr_nonce_review_type'];
893
  } else {
894
  return;
895
  }
902
  return;
903
  }
904
 
905
+ $post_id = (int)$post_id;
906
 
907
+ update_post_meta($post_id, 'yasr_review_type', $snippet_type);
 
 
 
 
 
 
 
 
 
 
 
 
908
 
909
  }
910
 
1080
 
1081
  }
1082
 
1083
+
1084
  ?>
lib/yasr-functions.php CHANGED
@@ -620,7 +620,9 @@ function yasr_shortcode_button_media() {
620
 
621
  add_thickbox();
622
 
623
- echo '<a href="#TB_inline?width=530&height=600&inlineId=yasr-tinypopup-form" id="yasr-shortcode-creator" class="button thickbox"><span class="dashicons dashicons-star-half" style="vertical-align: midlle;"></span> Yasr Shortcode</a>';
 
 
624
 
625
  }
626
 
@@ -971,27 +973,26 @@ function yasr_check_valid_url($url) {
971
  */
972
 
973
  function yasr_return_average_multiset($show_average, $multiset_average, $multiset_string) {
974
-
975
  $average_txt = __("Average", "yet-another-stars-rating");
976
 
977
  //Show average row
978
- if ($show_average !== false && $show_average !=='no'|| $show_average===false && YASR_MULTI_SHOW_AVERAGE !== 'no') {
979
  $unique_id_identifier = $multiset_string . str_shuffle(uniqid());
980
 
981
  $html_average = "<tr>
982
- <td colspan='2' class='yasr-multiset-average'>
983
- <div class='yasr-multiset-average'>
984
- <span class='yasr-multiset-average-text'>$average_txt</span>
985
- <div class='yasr-rater-stars' id='$unique_id_identifier'
986
- data-rating='$multiset_average' data-rater-readonly='true'
987
- data-rater-starsize='24'></div>
988
- </div>
989
- </td>
990
- </tr>";
991
  }
992
 
993
  return $html_average;
994
-
995
  }
996
 
997
  ?>
620
 
621
  add_thickbox();
622
 
623
+ echo '<a href="#TB_inline?width=530&height=600&inlineId=yasr-tinypopup-form" id="yasr-shortcode-creator" class="button thickbox">
624
+ <span class="dashicons dashicons-star-half" style="vertical-align: middle;"></span> Yasr Shortcode
625
+ </a>';
626
 
627
  }
628
 
973
  */
974
 
975
  function yasr_return_average_multiset($show_average, $multiset_average, $multiset_string) {
976
+ $html_average = ''; //avoid undefined
977
  $average_txt = __("Average", "yet-another-stars-rating");
978
 
979
  //Show average row
980
+ if ($show_average !== null && $show_average !=='no'|| $show_average===null && YASR_MULTI_SHOW_AVERAGE !== 'no') {
981
  $unique_id_identifier = $multiset_string . str_shuffle(uniqid());
982
 
983
  $html_average = "<tr>
984
+ <td colspan='2' class='yasr-multiset-average'>
985
+ <div class='yasr-multiset-average'>
986
+ <span class='yasr-multiset-average-text'>$average_txt</span>
987
+ <div class='yasr-rater-stars' id='$unique_id_identifier'
988
+ data-rating='$multiset_average' data-rater-readonly='true'
989
+ data-rater-starsize='24'></div>
990
+ </div>
991
+ </td>
992
+ </tr>";
993
  }
994
 
995
  return $html_average;
 
996
  }
997
 
998
  ?>
lib/yasr-shortcode-functions.php CHANGED
@@ -387,9 +387,9 @@ function shortcode_multi_set_callback($atts) {
387
  // Attributes
388
  $atts = shortcode_atts(
389
  array(
390
- 'setid' => '0',
391
  'postid' => false,
392
- 'show_average' => false
393
  ),
394
  $atts,
395
  'yasr_multiset'
@@ -475,9 +475,9 @@ function yasr_visitor_multiset_callback($atts) {
475
  // Attributes
476
  $atts = shortcode_atts(
477
  array(
478
- 'setid' => '0',
479
  'postid' => false,
480
- 'show_average' => false
481
  ),
482
  $atts,
483
  'yasr_multiset'
387
  // Attributes
388
  $atts = shortcode_atts(
389
  array(
390
+ 'setid' => '1',
391
  'postid' => false,
392
+ 'show_average' => null
393
  ),
394
  $atts,
395
  'yasr_multiset'
475
  // Attributes
476
  $atts = shortcode_atts(
477
  array(
478
+ 'setid' => '1',
479
  'postid' => false,
480
+ 'show_average' => null
481
  ),
482
  $atts,
483
  'yasr_multiset'
readme.txt CHANGED
@@ -1,17 +1,17 @@
1
  === Yasr - Yet Another Stars Rating ===
2
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
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.4
7
  Requires PHP: 5.3
8
- Stable tag: 2.1.3
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
12
 
13
  == Description ==
14
- Improving the user experience (UX) with your website is a top priority for everyone who cares about their online activity,
15
  as it promotes familiarity and loyalty with your brand, and enhances visibility of your activity.
16
 
17
  Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your
@@ -49,7 +49,7 @@ In this video I'll show you the "Auto Insert" feature and manual placement of YA
49
  [youtube https://www.youtube.com/watch?v=M47xsJMQJ1E]
50
 
51
  = Related Link =
52
- * News and doc at [Yasr Official Site](https://yetanotherstarsrating.com/)
53
  * [Demo page for Overall Rating and Vistor Rating](https://yetanotherstarsrating.com/yasr-basics-shortcode/)
54
  * [Demo page for Multi Sets](https://yetanotherstarsrating.com/yasr-multi-sets/)
55
  * [Demo page for Rankings](https://yetanotherstarsrating.com/yasr-rankings/)
@@ -125,6 +125,12 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
125
 
126
  The full changelog can be found in the plugin's directory. Recent entries:
127
 
 
 
 
 
 
 
128
  = 2.1.3 =
129
  * FIXED: in some older (and rare) mysql or mariadb versions, the function JSON_OBJECT is not supported.
130
  This was causing the import of multiset data failing since version 2.0.9
@@ -193,5 +199,4 @@ External Libraries: [Rater](https://github.com/fredolss/rater-js)
193
  [tippy](https://atomiks.github.io/tippyjs/)
194
 
195
  Flat star icon made by[Freepik](http://www.freepik.com)
196
- from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
197
-
1
  === Yasr - Yet Another Stars Rating ===
2
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
3
+ Tags: rating, rate post, rate page, star rating, google rating, votes
4
  Requires at least: 4.3.0
5
  Contributors: Dudo
6
  Tested up to: 5.4
7
  Requires PHP: 5.3
8
+ Stable tag: 2.1.4
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
12
 
13
  == Description ==
14
+ Improving the user experience with your website is a top priority for everyone who cares about their online activity,
15
  as it promotes familiarity and loyalty with your brand, and enhances visibility of your activity.
16
 
17
  Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your
49
  [youtube https://www.youtube.com/watch?v=M47xsJMQJ1E]
50
 
51
  = Related Link =
52
+ * Documentation at [Yasr Official Site](https://yetanotherstarsrating.com/docs/)
53
  * [Demo page for Overall Rating and Vistor Rating](https://yetanotherstarsrating.com/yasr-basics-shortcode/)
54
  * [Demo page for Multi Sets](https://yetanotherstarsrating.com/yasr-multi-sets/)
55
  * [Demo page for Rankings](https://yetanotherstarsrating.com/yasr-rankings/)
125
 
126
  The full changelog can be found in the plugin's directory. Recent entries:
127
 
128
+ = 2.1.4 =
129
+ * FIXED: undefined variable when saving/updating post or page
130
+ * TWEAKED: changed delete_post_meta with delete_metadata
131
+ * TWEAKED: Updated support link in settings pages
132
+
133
+
134
  = 2.1.3 =
135
  * FIXED: in some older (and rare) mysql or mariadb versions, the function JSON_OBJECT is not supported.
136
  This was causing the import of multiset data failing since version 2.0.9
199
  [tippy](https://atomiks.github.io/tippyjs/)
200
 
201
  Flat star icon made by[Freepik](http://www.freepik.com)
202
+ from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
 
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.1.3
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', '2.1.3' );
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: 2.1.4
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', '2.1.4' );
80
  //Plugin relative path
81
  define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
  //Plugin RELATIVE PATH without slashes (just the directory's name)