Version Description
- Added possibility to show ratings of any post anywhere in your theme files.
=
Download this release
Release Info
Developer | bhittani |
Plugin | kk Star Ratings |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.2
- admin/options.php +5 -5
- js/kk-ratings.js +2 -1
- kk-ratings.php +20 -5
- readme.txt +7 -3
admin/options.php
CHANGED
@@ -50,12 +50,12 @@
|
|
50 |
<p>
|
51 |
<strong>NOTE</strong> : For manual, please use shortcode <span style="color:#06F;">[kkratings]</span>
|
52 |
<br />in any post or page you need the ratings.
|
|
|
|
|
|
|
|
|
|
|
53 |
</p>
|
54 |
-
<p>
|
55 |
-
For theme files use: <span style="color:#093;"><?php if(function_exists('kk_star_ratings')) : echo kk_star_ratings(post_id); endif; ?></span>
|
56 |
-
<br />
|
57 |
-
Where <strong>post_id</strong> is the id of the post.
|
58 |
-
</p>
|
59 |
</td>
|
60 |
</tr>
|
61 |
<tr>
|
50 |
<p>
|
51 |
<strong>NOTE</strong> : For manual, please use shortcode <span style="color:#06F;">[kkratings]</span>
|
52 |
<br />in any post or page you need the ratings.
|
53 |
+
<br /><br />
|
54 |
+
For use in theme files:
|
55 |
+
<br /> <span style="color:#F60;"><?php if(function_exists('kk_star_ratings')) : echo kk_star_ratings($pid); endif; ?></span>
|
56 |
+
<br />Where $pid is the post of the id
|
57 |
+
<br />
|
58 |
</p>
|
|
|
|
|
|
|
|
|
|
|
59 |
</td>
|
60 |
</tr>
|
61 |
<tr>
|
js/kk-ratings.js
CHANGED
@@ -81,7 +81,7 @@ jQuery(document).ready( function($){
|
|
81 |
}
|
82 |
$('.stars-turned-on', obj).fadeIn(1000);
|
83 |
});
|
84 |
-
|
85 |
var id = $("span:eq(0)",obj).html();
|
86 |
$(obj).addClass('open');
|
87 |
$.ajax({
|
@@ -89,6 +89,7 @@ jQuery(document).ready( function($){
|
|
89 |
url: settings.path+"ajax/kk-ratings-ajax.php",
|
90 |
data: '_ajax_nonce='+settings.nonce+'&root='+settings.root+"&op=get&id="+id,
|
91 |
success: function(msg){
|
|
|
92 |
msg = msg.replace(/^\s+|\s+$/g,"");
|
93 |
var response = msg.split('|||');
|
94 |
if(response[0]=='SUCCESS')
|
81 |
}
|
82 |
$('.stars-turned-on', obj).fadeIn(1000);
|
83 |
});
|
84 |
+
|
85 |
var id = $("span:eq(0)",obj).html();
|
86 |
$(obj).addClass('open');
|
87 |
$.ajax({
|
89 |
url: settings.path+"ajax/kk-ratings-ajax.php",
|
90 |
data: '_ajax_nonce='+settings.nonce+'&root='+settings.root+"&op=get&id="+id,
|
91 |
success: function(msg){
|
92 |
+
|
93 |
msg = msg.replace(/^\s+|\s+$/g,"");
|
94 |
var response = msg.split('|||');
|
95 |
if(response[0]=='SUCCESS')
|
kk-ratings.php
CHANGED
@@ -4,14 +4,14 @@
|
|
4 |
Plugin Name: kk Star Ratings
|
5 |
Plugin URI: http://wakeusup.com/2011/05/kk-star-ratings/
|
6 |
Description: A clean, animated and sweat ratings feature for your blog <strong>With kk Star Ratings, you can allow your blog posts to be rated by your blog visitors</strong>. There are some useful options you can set to customize this plugin. You can do all that after installing the plugin and then visiting the <a href="options-general.php?page=kk-ratings_options">Plugin Settings</a>.
|
7 |
-
Version: 1.
|
8 |
Author: Kamal Khan
|
9 |
Author URI: http://bhittani.com
|
10 |
License: GPLv2 or later
|
11 |
*/
|
12 |
|
13 |
// Make sure class does not already exist (Playing safe).
|
14 |
-
if(!class_exists('kk_Ratings') && !isset($kkratings)) :
|
15 |
|
16 |
// Declare and define the plugin class.
|
17 |
class kk_Ratings
|
@@ -105,6 +105,8 @@ if(!class_exists('kk_Ratings') && !isset($kkratings)) :
|
|
105 |
}
|
106 |
public function activate()
|
107 |
{
|
|
|
|
|
108 |
if(!count($this->options)) :
|
109 |
$this->options['enable'] = 1; // 1, 0
|
110 |
$this->options['clear'] = 0; // 1, 0
|
@@ -114,7 +116,7 @@ if(!class_exists('kk_Ratings') && !isset($kkratings)) :
|
|
114 |
$this->options['show_in_pages'] = 0; // 1, 0
|
115 |
$this->options['unique'] = 0; // 1, 0
|
116 |
$this->options['position'] = 'top-left'; // 'top-left', 'top-right', 'bottom-left', 'bottom-right'
|
117 |
-
$this->options['legend'] = '[
|
118 |
$this->options['init_msg'] = 'Be the first to rate it!'; // string
|
119 |
$this->update_options();
|
120 |
endif;
|
@@ -208,10 +210,10 @@ if(!class_exists('kk_Ratings') && !isset($kkratings)) :
|
|
208 |
add_filter('the_excerpt', array(&$this, 'filter_content'));
|
209 |
}
|
210 |
}
|
211 |
-
public function markup()
|
212 |
{
|
213 |
$markup = '<div class="kk-ratings open">
|
214 |
-
<span>'.get_the_ID().'</span>
|
215 |
<div class="stars-turned-on"> </div>
|
216 |
<!--.stars-turned-on-->
|
217 |
<div class="hover-panel">
|
@@ -269,6 +271,12 @@ if(!class_exists('kk_Ratings') && !isset($kkratings)) :
|
|
269 |
endif;
|
270 |
return $content;
|
271 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
}
|
273 |
|
274 |
// Instantiate the plugin
|
@@ -281,6 +289,13 @@ if(!class_exists('kk_Ratings') && !isset($kkratings)) :
|
|
281 |
add_action('init', array($kkratings, 'init'));
|
282 |
// add shortcode handler
|
283 |
add_shortcode('kkratings', array($kkratings, 'do_it_manually'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
endif;
|
285 |
|
286 |
?>
|
4 |
Plugin Name: kk Star Ratings
|
5 |
Plugin URI: http://wakeusup.com/2011/05/kk-star-ratings/
|
6 |
Description: A clean, animated and sweat ratings feature for your blog <strong>With kk Star Ratings, you can allow your blog posts to be rated by your blog visitors</strong>. There are some useful options you can set to customize this plugin. You can do all that after installing the plugin and then visiting the <a href="options-general.php?page=kk-ratings_options">Plugin Settings</a>.
|
7 |
+
Version: 1.2
|
8 |
Author: Kamal Khan
|
9 |
Author URI: http://bhittani.com
|
10 |
License: GPLv2 or later
|
11 |
*/
|
12 |
|
13 |
// Make sure class does not already exist (Playing safe).
|
14 |
+
if(!class_exists('kk_Ratings') && !isset($kkratings) && !function_exists('kk_star_ratings')) :
|
15 |
|
16 |
// Declare and define the plugin class.
|
17 |
class kk_Ratings
|
105 |
}
|
106 |
public function activate()
|
107 |
{
|
108 |
+
$this->options['legend'] = '[avg]([per]) [total] votes'; // [total]=total ratings, [rating]=average, [per]=percentage
|
109 |
+
$this->update_options();
|
110 |
if(!count($this->options)) :
|
111 |
$this->options['enable'] = 1; // 1, 0
|
112 |
$this->options['clear'] = 0; // 1, 0
|
116 |
$this->options['show_in_pages'] = 0; // 1, 0
|
117 |
$this->options['unique'] = 0; // 1, 0
|
118 |
$this->options['position'] = 'top-left'; // 'top-left', 'top-right', 'bottom-left', 'bottom-right'
|
119 |
+
$this->options['legend'] = '[avg]([per]) [total] votes'; // [total]=total ratings, [rating]=average, [per]=percentage
|
120 |
$this->options['init_msg'] = 'Be the first to rate it!'; // string
|
121 |
$this->update_options();
|
122 |
endif;
|
210 |
add_filter('the_excerpt', array(&$this, 'filter_content'));
|
211 |
}
|
212 |
}
|
213 |
+
public function markup($id=false)
|
214 |
{
|
215 |
$markup = '<div class="kk-ratings open">
|
216 |
+
<span>'.(!$id?get_the_ID():$id).'</span>
|
217 |
<div class="stars-turned-on"> </div>
|
218 |
<!--.stars-turned-on-->
|
219 |
<div class="hover-panel">
|
271 |
endif;
|
272 |
return $content;
|
273 |
}
|
274 |
+
public function kk_star_rating($pid=false)
|
275 |
+
{
|
276 |
+
if($this->options['enable'])
|
277 |
+
return $this->markup($pid);
|
278 |
+
return '';
|
279 |
+
}
|
280 |
}
|
281 |
|
282 |
// Instantiate the plugin
|
289 |
add_action('init', array($kkratings, 'init'));
|
290 |
// add shortcode handler
|
291 |
add_shortcode('kkratings', array($kkratings, 'do_it_manually'));
|
292 |
+
|
293 |
+
function kk_star_ratings($pid=false)
|
294 |
+
{
|
295 |
+
global $kkratings;
|
296 |
+
return $kkratings->kk_star_rating($pid);
|
297 |
+
}
|
298 |
+
|
299 |
endif;
|
300 |
|
301 |
?>
|
readme.txt
CHANGED
@@ -9,9 +9,9 @@ Tags: star ratings, votings, rate posts, ajax ratings
|
|
9 |
|
10 |
Requires at least: 3.0
|
11 |
|
12 |
-
Tested up to: 3.1
|
13 |
|
14 |
-
Stable tag: 1.
|
15 |
|
16 |
|
17 |
kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
|
@@ -79,9 +79,13 @@ First of all make sure you have selected where to display the ratings in the set
|
|
79 |
2. The Output
|
80 |
|
81 |
|
82 |
-
|
83 |
== Changelog ==
|
84 |
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
|
87 |
== Upgrade Notice ==
|
9 |
|
10 |
Requires at least: 3.0
|
11 |
|
12 |
+
Tested up to: 3.2.1
|
13 |
|
14 |
+
Stable tag: 1.2
|
15 |
|
16 |
|
17 |
kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
|
79 |
2. The Output
|
80 |
|
81 |
|
|
|
82 |
== Changelog ==
|
83 |
|
84 |
+
= 1.1 =
|
85 |
+
* Fixed the [avg] error, so now it will display average ratings properly.
|
86 |
+
|
87 |
+
= 1.2 =
|
88 |
+
* Added possibility to show ratings of any post anywhere in your theme files.
|
89 |
|
90 |
|
91 |
== Upgrade Notice ==
|