kk Star Ratings - Version 2.3

Version Description

  • Added: Ability to exclude specific category(s).
Download this release

Release Info

Developer bhittani
Plugin Icon 128x128 kk Star Ratings
Version 2.3
Comparing to
See all releases

Code changes from version 2.2.1 to 2.3

Files changed (3) hide show
  1. admin.php +6 -0
  2. index.php +20 -1
  3. readme.txt +4 -1
admin.php CHANGED
@@ -88,6 +88,12 @@
88
  )
89
  )
90
  ));
 
 
 
 
 
 
91
  BhittaniPlugin_AdminMarkup::checkbox(array(
92
  'title' => 'Google Rich Snippets',
93
  'description' => 'Do you want Google to index the ratings and hopefully show it in the search results',
88
  )
89
  )
90
  ));
91
+ BhittaniPlugin_AdminMarkup::input(array(
92
+ 'title' => 'Exclude following category(s)',
93
+ 'description' => 'Comma seperated ids of categories.<br />e.g. <em>5,47,2</em>',
94
+ 'field' => 'kksr_exclude_categories',
95
+ 'value' => get_option('kksr_exclude_categories')
96
+ ));
97
  BhittaniPlugin_AdminMarkup::checkbox(array(
98
  'title' => 'Google Rich Snippets',
99
  'description' => 'Do you want Google to index the ratings and hopefully show it in the search results',
index.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: kk Star Ratings
5
  Plugin URI: http://wakeusup.com/2011/05/kk-star-ratings/
6
  Description: Renewed from the ground up(as of v2.0), clean, animated and light weight ratings feature for your blog. With kk Star Ratings, you can <strong>allow your blog posts to be rated by your blog visitors</strong>. It also includes a <strong>widget</strong> which you can add to your sidebar to show the top rated post. Wait! There is more to it. Enjoy the extensive options you can set to customize this plugin.
7
- Version: 2.2.1
8
  Author: Kamal Khan
9
  Author URI: http://bhittani.com
10
  License: GPLv2 or later
@@ -427,9 +427,28 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
427
  echo json_encode($Response);
428
  die();
429
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  public function markup($id=false)
431
  {
432
  $id = !$id ? get_the_ID() : $id;
 
 
 
 
 
433
  $disabled = false;
434
  if(get_post_meta($id, '_kksr_ips', true))
435
  {
4
  Plugin Name: kk Star Ratings
5
  Plugin URI: http://wakeusup.com/2011/05/kk-star-ratings/
6
  Description: Renewed from the ground up(as of v2.0), clean, animated and light weight ratings feature for your blog. With kk Star Ratings, you can <strong>allow your blog posts to be rated by your blog visitors</strong>. It also includes a <strong>widget</strong> which you can add to your sidebar to show the top rated post. Wait! There is more to it. Enjoy the extensive options you can set to customize this plugin.
7
+ Version: 2.3
8
  Author: Kamal Khan
9
  Author URI: http://bhittani.com
10
  License: GPLv2 or later
427
  echo json_encode($Response);
428
  die();
429
  }
430
+ protected function trim_csv_cb($value)
431
+ {
432
+ if(trim($value)!="")
433
+ return true;
434
+ return false;
435
+ }
436
+ protected function exclude_cat($id)
437
+ {
438
+ $excl_categories = parent::get_options('kksr_exclude_categories');
439
+ $Cat_ids = $excl_categories ? array_filter(array_map('trim', explode(",", $excl_categories)), array(&$this, 'trim_csv_cb')) : array();
440
+ $Post_cat_ids = wp_get_post_categories($id);
441
+ $Intersection = array_intersect($Cat_ids, $Post_cat_ids);
442
+ return count($Intersection);
443
+ }
444
  public function markup($id=false)
445
  {
446
  $id = !$id ? get_the_ID() : $id;
447
+ if($this->exclude_cat($id))
448
+ {
449
+ return '';
450
+ }
451
+
452
  $disabled = false;
453
  if(get_post_meta($id, '_kksr_ips', true))
454
  {
readme.txt CHANGED
@@ -11,7 +11,7 @@ Requires at least: 3.0
11
 
12
  Tested up to: 3.5.1
13
 
14
- Stable tag: 2.2.1
15
 
16
 
17
  kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
@@ -128,6 +128,9 @@ Visit the help tab in the settings to find out what you can do.
128
 
129
  == Changelog ==
130
 
 
 
 
131
  = 2.2.1 =
132
  * Update: Restricted admin scripts to render in its own page scope.
133
 
11
 
12
  Tested up to: 3.5.1
13
 
14
+ Stable tag: 2.3
15
 
16
 
17
  kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
128
 
129
  == Changelog ==
130
 
131
+ = 2.3 =
132
+ * Added: Ability to exclude specific category(s).
133
+
134
  = 2.2.1 =
135
  * Update: Restricted admin scripts to render in its own page scope.
136