Yasr – Yet Another Stars Rating - Version 2.4.4

Version Description

  • TWEAKED: added yasr_auto_insert_exclude_cpt hook
  • TWEAKED: code cleanup
Download this release

Release Info

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

Code changes from version 2.4.3 to 2.4.4

admin/editor/YasrOnSavePost.php CHANGED
@@ -66,6 +66,10 @@ class YasrOnSavePost {
66
  return;
67
  }
68
 
 
 
 
 
69
  if (!wp_verify_nonce($nonce, 'yasr_nonce_overall_rating_action')) {
70
  return;
71
  }
66
  return;
67
  }
68
 
69
+ if($rating === '0' || $rating === 0) {
70
+ return;
71
+ }
72
+
73
  if (!wp_verify_nonce($nonce, 'yasr_nonce_overall_rating_action')) {
74
  return;
75
  }
includes/rest/classes/YasrPostMeta.php CHANGED
@@ -8,8 +8,8 @@ class YasrPostMeta {
8
  /**
9
  * Load in init
10
  */
11
- public function init() {
12
- add_action('init', array($this, 'registerPostMeta'));
13
  }
14
 
15
  /*
8
  /**
9
  * Load in init
10
  */
11
+ public function restApiInit() {
12
+ add_action('rest_api_init', array($this, 'registerPostMeta'));
13
  }
14
 
15
  /*
includes/rest/yasr-rest.php CHANGED
@@ -37,7 +37,7 @@ $yasr_custom_fields = new YasrCustomFields();
37
  //register new route
38
  $yasr_custom_endpoint = new YasrCustomEndpoint();
39
 
40
- $yasr_post_meta->init();
41
  $yasr_custom_fields->restApiInit();
42
  $yasr_custom_endpoint->restApiInit();
43
 
37
  //register new route
38
  $yasr_custom_endpoint = new YasrCustomEndpoint();
39
 
40
+ $yasr_post_meta->restApiInit();
41
  $yasr_custom_fields->restApiInit();
42
  $yasr_custom_endpoint->restApiInit();
43
 
public/classes/YasrPublicFilters.php CHANGED
@@ -43,6 +43,29 @@ class YasrPublicFilters {
43
  return $content;
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  $shortcode_align = YASR_AUTO_INSERT_ALIGN;
47
 
48
  //if it is not left, or right, default is center
43
  return $content;
44
  }
45
 
46
+ //create an empty array
47
+ $excluded_cpt = array();
48
+
49
+ //this hooks can be used to add cpt to exclude from the auto_insert
50
+ $excluded_cpt = apply_filters('yasr_auto_insert_exclude_cpt', $excluded_cpt);
51
+
52
+ //Excluded_cpt must be an array
53
+ if(is_array($excluded_cpt) && !empty($excluded_cpt)){
54
+
55
+ //sanitize
56
+ $excluded_cpt = filter_var_array($excluded_cpt,FILTER_SANITIZE_STRING);
57
+
58
+ $post_type = get_post_type();
59
+
60
+ //if one element in the array is found, return content
61
+ foreach($excluded_cpt as $cpt) {
62
+ if($cpt === $post_type) {
63
+ return $content;
64
+ }
65
+ }
66
+
67
+ }
68
+
69
  $shortcode_align = YASR_AUTO_INSERT_ALIGN;
70
 
71
  //if it is not left, or right, default is center
readme.txt CHANGED
@@ -2,10 +2,10 @@
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.9.0
5
- Contributors: Dudo
6
  Tested up to: 5.5
7
  Requires PHP: 5.3
8
- Stable tag: 2.4.3
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
@@ -168,6 +168,10 @@ If doesn't, you should work on your seo reputation.
168
 
169
  The full changelog can be found in the plugin's directory. Recent entries:
170
 
 
 
 
 
171
  = 2.4.3 =
172
  * NEW FEATURE: is now possible to show ratings next to the title
173
  * FIXED: guten blocks returns error if post_id parameter was set
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.9.0
5
+ Contributors: Dudo, freemius
6
  Tested up to: 5.5
7
  Requires PHP: 5.3
8
+ Stable tag: 2.4.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
168
 
169
  The full changelog can be found in the plugin's directory. Recent entries:
170
 
171
+ = 2.4.4 =
172
+ * TWEAKED: added yasr_auto_insert_exclude_cpt hook
173
+ * TWEAKED: code cleanup
174
+
175
  = 2.4.3 =
176
  * NEW FEATURE: is now possible to show ratings next to the title
177
  * FIXED: guten blocks returns error if post_id parameter was set
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: 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
7
- * Version: 2.4.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.4.3' );
80
  //Plugin absolute path
81
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
82
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: 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
7
+ * Version: 2.4.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.4.4' );
80
  //Plugin absolute path
81
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
82
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );