kk Star Ratings - Version 2.2.1

Version Description

  • Update: Restricted admin scripts to render in its own page scope.
Download this release

Release Info

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

Code changes from version 2.2 to 2.2.1

Files changed (2) hide show
  1. index.php +24 -9
  2. readme.txt +5 -2
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
8
  Author: Kamal Khan
9
  Author URI: http://bhittani.com
10
  License: GPLv2 or later
@@ -16,9 +16,12 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
16
 
17
  class BhittaniPlugin_kkStarRatings extends BhittaniPlugin
18
  {
 
 
19
  public function __construct($id, $nick, $ver)
20
  {
21
  parent::__construct($id, $nick, $ver);
 
22
  }
23
  /** function/method
24
  * Usage: hook js frontend
@@ -42,7 +45,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
42
  $this->enqueue_js('js', parent::file_uri('js.js'), $this->ver, array('jquery'), $Params, false, true);
43
  }
44
  /** function/method
45
- * Usage: hook js admin
46
  * Arg(0): null
47
  * Return: void
48
  */
@@ -55,6 +58,18 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
55
  $this->enqueue_js('js_admin', parent::file_uri('js_admin.js'), $this->ver, array('jquery', 'bhittaniplugin_admin_script'), $Params);
56
  }
57
  /** function/method
 
 
 
 
 
 
 
 
 
 
 
 
58
  * Usage: hook css
59
  * Arg(0): null
60
  * Return: void
@@ -202,7 +217,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
202
  public function menu()
203
  {
204
  // Create main menu tab
205
- add_menu_page(
206
  $this->nick.' - Settings',
207
  $this->nick,
208
  'manage_options',
@@ -211,7 +226,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
211
  parent::file_uri('icon.png')
212
  );
213
  // Create images menu tab
214
- add_submenu_page(
215
  $this->id.'_settings',
216
  $this->nick.' - Settings',
217
  'Settings',
@@ -220,7 +235,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
220
  array(&$this, 'options_general')
221
  );
222
  // Create images menu tab
223
- add_submenu_page(
224
  $this->id.'_settings',
225
  $this->nick.' - Stars',
226
  'Stars',
@@ -229,7 +244,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
229
  array(&$this, 'options_stars')
230
  );
231
  // Create tooltips menu tab
232
- add_submenu_page(
233
  $this->id.'_settings',
234
  $this->nick.' - Tooltips',
235
  'Tooltips',
@@ -238,7 +253,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
238
  array(&$this, 'options_tooltips')
239
  );
240
  // Create reset menu tab
241
- add_submenu_page(
242
  $this->id.'_settings',
243
  $this->nick.' - Reset',
244
  'Reset',
@@ -247,7 +262,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
247
  array(&$this, 'options_reset')
248
  );
249
  // Create info menu tab
250
- add_submenu_page(
251
  $this->id.'_settings',
252
  $this->nick.' - Help',
253
  'Help',
@@ -594,7 +609,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
594
  add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'js'));
595
  add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'css'));
596
  add_action('wp_head', array($kkStarRatings_obj, 'css_custom'));
597
- add_action('admin_enqueue_scripts', array($kkStarRatings_obj, 'js_admin'));
598
 
599
  // Menu
600
  add_action('admin_menu', array($kkStarRatings_obj, 'menu'));
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
16
 
17
  class BhittaniPlugin_kkStarRatings extends BhittaniPlugin
18
  {
19
+ private $_Menus;
20
+
21
  public function __construct($id, $nick, $ver)
22
  {
23
  parent::__construct($id, $nick, $ver);
24
+ $this->_Menus = array();
25
  }
26
  /** function/method
27
  * Usage: hook js frontend
45
  $this->enqueue_js('js', parent::file_uri('js.js'), $this->ver, array('jquery'), $Params, false, true);
46
  }
47
  /** function/method
48
+ * Usage: hook js admin - helper
49
  * Arg(0): null
50
  * Return: void
51
  */
58
  $this->enqueue_js('js_admin', parent::file_uri('js_admin.js'), $this->ver, array('jquery', 'bhittaniplugin_admin_script'), $Params);
59
  }
60
  /** function/method
61
+ * Usage: hook admin scripts
62
+ * Arg(0): null
63
+ * Return: void
64
+ */
65
+ public function admin_scripts()
66
+ {
67
+ foreach($this->_Menus as $menu)
68
+ {
69
+ add_action('admin_print_scripts-'.$menu, array(&$this, 'js_admin'));
70
+ }
71
+ }
72
+ /** function/method
73
  * Usage: hook css
74
  * Arg(0): null
75
  * Return: void
217
  public function menu()
218
  {
219
  // Create main menu tab
220
+ $this->_Menus[] = add_menu_page(
221
  $this->nick.' - Settings',
222
  $this->nick,
223
  'manage_options',
226
  parent::file_uri('icon.png')
227
  );
228
  // Create images menu tab
229
+ $this->_Menus[] = add_submenu_page(
230
  $this->id.'_settings',
231
  $this->nick.' - Settings',
232
  'Settings',
235
  array(&$this, 'options_general')
236
  );
237
  // Create images menu tab
238
+ $this->_Menus[] = add_submenu_page(
239
  $this->id.'_settings',
240
  $this->nick.' - Stars',
241
  'Stars',
244
  array(&$this, 'options_stars')
245
  );
246
  // Create tooltips menu tab
247
+ $this->_Menus[] = add_submenu_page(
248
  $this->id.'_settings',
249
  $this->nick.' - Tooltips',
250
  'Tooltips',
253
  array(&$this, 'options_tooltips')
254
  );
255
  // Create reset menu tab
256
+ $this->_Menus[] = add_submenu_page(
257
  $this->id.'_settings',
258
  $this->nick.' - Reset',
259
  'Reset',
262
  array(&$this, 'options_reset')
263
  );
264
  // Create info menu tab
265
+ $this->_Menus[] = add_submenu_page(
266
  $this->id.'_settings',
267
  $this->nick.' - Help',
268
  'Help',
609
  add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'js'));
610
  add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'css'));
611
  add_action('wp_head', array($kkStarRatings_obj, 'css_custom'));
612
+ add_action('admin_init', array($kkStarRatings_obj, 'admin_scripts'));
613
 
614
  // Menu
615
  add_action('admin_menu', array($kkStarRatings_obj, 'menu'));
readme.txt CHANGED
@@ -9,9 +9,9 @@ Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited
9
 
10
  Requires at least: 3.0
11
 
12
- Tested up to: 3.5
13
 
14
- Stable tag: 2.2
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 =
132
  * Fix: jquery ui causing problems in wordpress 3.5. It is removed because no longer required.
133
  * Update: Shortcode can contain optional 'id' argument to display ratings for a specific post intentionally. e.g. [kkstarratings id="192"]
9
 
10
  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
 
129
  == Changelog ==
130
 
131
+ = 2.2.1 =
132
+ * Update: Restricted admin scripts to render in its own page scope.
133
+
134
  = 2.2 =
135
  * Fix: jquery ui causing problems in wordpress 3.5. It is removed because no longer required.
136
  * Update: Shortcode can contain optional 'id' argument to display ratings for a specific post intentionally. e.g. [kkstarratings id="192"]