Version Description
- Fixed the [avg] error, so now it will display average ratings properly.
=
Download this release
Release Info
Developer | bhittani |
Plugin | kk Star Ratings |
Version | 1.1 |
Comparing to | |
See all releases |
Version 1.1
- admin/options.php +139 -0
- ajax/kk-ratings-ajax.php +60 -0
- css/kk-ratings.css +80 -0
- images/off.png +0 -0
- images/on.png +0 -0
- images/over.png +0 -0
- js/kk-ratings.js +224 -0
- kk-ratings.php +288 -0
- readme.txt +88 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
admin/options.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// LAYOUT FOR THE SETTINGS/OPTIONS PAGE
|
3 |
+
?>
|
4 |
+
<div class="wrap">
|
5 |
+
<?php
|
6 |
+
/* ************************
|
7 |
+
SETTINGS - starts
|
8 |
+
************************** */
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php screen_icon(); ?>
|
12 |
+
<form action="options.php" method="post" id=<?php echo $this->plugin_id; ?>"_options_form" name=<?php echo $this->plugin_id; ?>"_options_form">
|
13 |
+
<?php settings_fields($this->plugin_id.'_options'); ?>
|
14 |
+
<h2>kk Star Ratings » Settings</h2>
|
15 |
+
<table class="widefat" style="width:600px;">
|
16 |
+
<thead>
|
17 |
+
<tr>
|
18 |
+
<th>#</th>
|
19 |
+
<th>Label</th>
|
20 |
+
<th>Value</th>
|
21 |
+
</tr>
|
22 |
+
</thead>
|
23 |
+
<tfoot>
|
24 |
+
<tr>
|
25 |
+
<th>#</th>
|
26 |
+
<th>Label</th>
|
27 |
+
<th>Value</th>
|
28 |
+
</tr>
|
29 |
+
</tfoot>
|
30 |
+
<tbody>
|
31 |
+
<tr>
|
32 |
+
<td>1</td>
|
33 |
+
<td><label for="<?php echo $this->plugin_id; ?>[enable]">Enable</label></td>
|
34 |
+
<td><input type="checkbox" name="<?php echo $this->plugin_id; ?>[enable]" value="1" <?php echo $this->options['enable'] ? "checked='checked'" : ""; ?> /></td>
|
35 |
+
</tr>
|
36 |
+
<tr>
|
37 |
+
<td>2</td>
|
38 |
+
<td>Where do you need the ratings</td>
|
39 |
+
<td>
|
40 |
+
<input type="checkbox" name="<?php echo $this->plugin_id; ?>[show_in_home]" value="1" <?php echo $this->options['show_in_home'] ? "checked='checked'" : ""; ?> /> Home
|
41 |
+
(Some themes may not be appropriate for this option)
|
42 |
+
<br />
|
43 |
+
<input type="checkbox" name="<?php echo $this->plugin_id; ?>[show_in_archives]" value="1" <?php echo $this->options['show_in_archives'] ? "checked='checked'" : ""; ?> /> Archives
|
44 |
+
(Some themes may not be appropriate for this option)
|
45 |
+
<br />
|
46 |
+
<input type="checkbox" name="<?php echo $this->plugin_id; ?>[show_in_posts]" value="1" <?php echo $this->options['show_in_posts'] ? "checked='checked'" : ""; ?> /> Posts
|
47 |
+
<br />
|
48 |
+
<input type="checkbox" name="<?php echo $this->plugin_id; ?>[show_in_pages]" value="1" <?php echo $this->options['show_in_pages'] ? "checked='checked'" : ""; ?> /> Pages
|
49 |
+
<br />
|
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 |
+
|
54 |
+
</p>
|
55 |
+
</td>
|
56 |
+
</tr>
|
57 |
+
<tr>
|
58 |
+
<td>3</td>
|
59 |
+
<td><label for="<?php echo $this->plugin_id; ?>[unique]">Unique Voting (Based on IP)</label></td>
|
60 |
+
<td><input type="checkbox" name="<?php echo $this->plugin_id; ?>[unique]" value="1" <?php echo $this->options['unique'] ? "checked='checked'" : ""; ?> /></td>
|
61 |
+
</tr>
|
62 |
+
<tr>
|
63 |
+
<td>4</td>
|
64 |
+
<td><label for="<?php echo $this->plugin_id; ?>[position]">Placement</label></td>
|
65 |
+
<td>
|
66 |
+
<select name="<?php echo $this->plugin_id; ?>[position]">
|
67 |
+
<option value="top-left" <?php echo !strcmp($this->options['position'], 'top-left') ? "selected='selected'" : ""; ?>>Top Left</option>
|
68 |
+
<option value="top-right" <?php echo !strcmp($this->options['position'], 'top-right') ? "selected='selected'" : ""; ?>>Top Right</option>
|
69 |
+
<option value="bottom-left" <?php echo !strcmp($this->options['position'], 'bottom-left') ? "selected='selected'" : ""; ?>>Bottom Left</option>
|
70 |
+
<option value="bottom-right" <?php echo !strcmp($this->options['position'], 'bottom-right') ? "selected='selected'" : ""; ?>>Bottom Right</option>
|
71 |
+
</select>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td>5</td>
|
76 |
+
<td><label for="<?php echo $this->plugin_id; ?>[legend]">Description</label></td>
|
77 |
+
<td>
|
78 |
+
<input type="text" name="<?php echo $this->plugin_id; ?>[legend]" value="<?php echo $this->options['legend']; ?>" size="50" />
|
79 |
+
<p>
|
80 |
+
<strong>[total]</strong> : Total amount of casted votes
|
81 |
+
<br />
|
82 |
+
<strong>[per]</strong> : Rating Percentage
|
83 |
+
<br />
|
84 |
+
<strong>[avg]</strong> : Rating Average
|
85 |
+
</p>
|
86 |
+
</td>
|
87 |
+
</tr>
|
88 |
+
<tr>
|
89 |
+
<td>6</td>
|
90 |
+
<td><label for="<?php echo $this->plugin_id; ?>[init_msg]">Initial Message</label></td>
|
91 |
+
<td>
|
92 |
+
<input type="text" name="<?php echo $this->plugin_id; ?>[init_msg]" value="<?php echo $this->options['init_msg']; ?>" size="50" />
|
93 |
+
</td>
|
94 |
+
</tr>
|
95 |
+
<tr>
|
96 |
+
<td>7</td>
|
97 |
+
<td><label for="<?php echo $this->plugin_id; ?>[clear]">Clear Line</label></td>
|
98 |
+
<td>
|
99 |
+
<input type="checkbox" name="<?php echo $this->plugin_id; ?>[clear]" value="1" <?php echo $this->options['clear'] ? "checked='checked'" : ""; ?> />
|
100 |
+
</td>
|
101 |
+
</tr>
|
102 |
+
</tbody>
|
103 |
+
</table>
|
104 |
+
<p><input type="submit" name="submit" value="Save Settings" class="button" /></p>
|
105 |
+
</form>
|
106 |
+
<form action="" method="POST">
|
107 |
+
<?php
|
108 |
+
if(strcmp($_POST['kkratings-flush'],'Flush Ratings'))
|
109 |
+
{
|
110 |
+
wp_nonce_field('kkratings_flush','kkratings-flush-nonce');
|
111 |
+
?>
|
112 |
+
<p>
|
113 |
+
<strong>RESET RATINGS:</strong> Enter id(s) of posts/pages (comma seperated) and click the 'Flush Ratings' button to reset its ratings
|
114 |
+
</p>
|
115 |
+
<p>
|
116 |
+
<input name="kkratings_input" type="text" value="" size="10" />
|
117 |
+
<input type="submit" value="Flush Ratings" name="kkratings-flush" class="button" />
|
118 |
+
<strong>NOTE:</strong> To reset all votings occured throughout the site, leave the input field empty.
|
119 |
+
</p>
|
120 |
+
<?php
|
121 |
+
}
|
122 |
+
?>
|
123 |
+
</form>
|
124 |
+
<p>Donations to this plugin will always be appreciated. It is a way of saying thanks!</p>
|
125 |
+
<p>
|
126 |
+
|
127 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
128 |
+
<input type="hidden" name="cmd" value="_s-xclick">
|
129 |
+
<input type="hidden" name="hosted_button_id" value="EHPTKTC2TT4QC">
|
130 |
+
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
131 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
132 |
+
</form>
|
133 |
+
</p>
|
134 |
+
<?php
|
135 |
+
/* ************************
|
136 |
+
SETTINGS - ends
|
137 |
+
************************** */
|
138 |
+
?>
|
139 |
+
</div>
|
ajax/kk-ratings-ajax.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$path_to_root = urldecode($_POST['root']);
|
4 |
+
require_once($path_to_root."wp-config.php");
|
5 |
+
|
6 |
+
// check security
|
7 |
+
check_ajax_referer( 'kk-ratings' );
|
8 |
+
|
9 |
+
$kkratings_options = get_option('kk-ratings');
|
10 |
+
|
11 |
+
$userip = $_SERVER['REMOTE_ADDR'];
|
12 |
+
$Ratings['ratings'] = get_post_meta($_POST['id'], '_kk_ratings_ratings', true) ? get_post_meta($_POST['id'], '_kk_ratings_ratings', true) : false;
|
13 |
+
|
14 |
+
if(isset($_POST['id']) && ((!strcmp($_POST['op'], 'get') && $Ratings['ratings']) || (!strcmp($_POST['op'], 'put') && isset($_POST['stars']))))
|
15 |
+
{
|
16 |
+
if(!strcmp($_POST['op'], 'put'))
|
17 |
+
{
|
18 |
+
if($Ratings['ratings'])
|
19 |
+
{
|
20 |
+
$Ratings['casts'] = get_post_meta($_POST['id'], '_kk_ratings_casts', true);
|
21 |
+
$Ratings['ips'] = get_post_meta($_POST['id'], '_kk_ratings_ips', true);
|
22 |
+
update_post_meta($_POST['id'], '_kk_ratings_ratings', $Ratings['ratings'] + $_POST['stars']);
|
23 |
+
update_post_meta($_POST['id'], '_kk_ratings_casts', $Ratings['casts'] + 1);
|
24 |
+
update_post_meta($_POST['id'], '_kk_ratings_ips', $Ratings['ips'].'|'.$userip);
|
25 |
+
}
|
26 |
+
else
|
27 |
+
{
|
28 |
+
update_post_meta($_POST['id'], '_kk_ratings_ratings', $_POST['stars']);
|
29 |
+
update_post_meta($_POST['id'], '_kk_ratings_casts', 1);
|
30 |
+
update_post_meta($_POST['id'], '_kk_ratings_ips', $userip);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
$Ip = array();
|
35 |
+
$Ratings['ratings'] = get_post_meta($_POST['id'], '_kk_ratings_ratings', true);
|
36 |
+
$Ratings['casts'] = get_post_meta($_POST['id'], '_kk_ratings_casts', true);
|
37 |
+
$Ratings['ips'] = get_post_meta($_POST['id'], '_kk_ratings_ips', true);
|
38 |
+
|
39 |
+
// Percentage
|
40 |
+
$Ratings['per'] = round((($Ratings['ratings']/$Ratings['casts'])/5)*100);
|
41 |
+
|
42 |
+
// Can user rate?
|
43 |
+
$Ip = explode('|',$Ratings['ips']);
|
44 |
+
$Ratings['open'] = (in_array($userip, $Ip) && $kkratings_options['unique'])? 'no' : 'yes';
|
45 |
+
|
46 |
+
// Legend
|
47 |
+
$Ratings['avg'] = round($Ratings['ratings']/$Ratings['casts'],1).'/5';
|
48 |
+
$Ratings['legend'] = $kkratings_options['legend'];
|
49 |
+
$Ratings['legend'] = str_replace('[total]',$Ratings['casts'], $Ratings['legend']);
|
50 |
+
$Ratings['legend'] = str_replace('[avg]',$Ratings['avg'], $Ratings['legend']);
|
51 |
+
$Ratings['legend'] = str_replace('[per]',$Ratings['per'].'%', $Ratings['legend']);
|
52 |
+
|
53 |
+
echo "SUCCESS|||".$Ratings['per'].'|||'.$Ratings['legend'].'|||'.$Ratings['open'];
|
54 |
+
}
|
55 |
+
else
|
56 |
+
{
|
57 |
+
echo "FAIL|||";
|
58 |
+
}
|
59 |
+
|
60 |
+
?>
|
css/kk-ratings.css
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@charset "utf-8";
|
2 |
+
/* CSS Document */
|
3 |
+
|
4 |
+
.kk-ratings {
|
5 |
+
margin: 0px 5px;
|
6 |
+
padding: 0px;
|
7 |
+
height: 40px;
|
8 |
+
width: 120px;
|
9 |
+
position: relative;
|
10 |
+
background-image: url(../images/off.png);
|
11 |
+
background-repeat: repeat-x;
|
12 |
+
}
|
13 |
+
.kk-ratings .stars-turned-on {
|
14 |
+
margin: 0px;
|
15 |
+
padding: 0px;
|
16 |
+
width: 0%;
|
17 |
+
height: 24px;
|
18 |
+
position: absolute;
|
19 |
+
left: 0px;
|
20 |
+
top: 0px;
|
21 |
+
z-index: 0;
|
22 |
+
background-image: url(../images/on.png);
|
23 |
+
background-repeat: repeat-x;
|
24 |
+
}
|
25 |
+
.kk-ratings .stars-turned-strict {
|
26 |
+
background-image: url(../images/over.png) !important;
|
27 |
+
}
|
28 |
+
.kk-ratings .hover-panel {
|
29 |
+
margin: 0px;
|
30 |
+
padding: 0px;
|
31 |
+
height: 24px;
|
32 |
+
width: 120px;
|
33 |
+
position: relative;
|
34 |
+
z-index: 1;
|
35 |
+
}
|
36 |
+
.kk-ratings .hover-panel a {
|
37 |
+
margin: 0px;
|
38 |
+
padding: 0px;
|
39 |
+
float: left;
|
40 |
+
height: 24px;
|
41 |
+
width: 24px;
|
42 |
+
text-decoration: none;
|
43 |
+
}
|
44 |
+
.kk-ratings .hover-panel a.hovered-star {
|
45 |
+
background-image: url(../images/over.png);
|
46 |
+
background-repeat: no-repeat;
|
47 |
+
}
|
48 |
+
.kk-ratings .casting-desc {
|
49 |
+
width: 120px;
|
50 |
+
line-height: 16px;
|
51 |
+
text-align:center;
|
52 |
+
font-family: Verdana, Geneva, sans-serif;
|
53 |
+
font-size: 10px;
|
54 |
+
color:#AAA;
|
55 |
+
}
|
56 |
+
.kk-ratings .casting-thanks {
|
57 |
+
width: 120px;
|
58 |
+
line-height: 16px;
|
59 |
+
text-align:center;
|
60 |
+
font-family: Verdana, Geneva, sans-serif;
|
61 |
+
font-size: 10px;
|
62 |
+
color:#248E62;
|
63 |
+
}
|
64 |
+
.kk-ratings .casting-error {
|
65 |
+
width: 120px;
|
66 |
+
line-height: 16px;
|
67 |
+
text-align:center;
|
68 |
+
font-family: Verdana, Geneva, sans-serif;
|
69 |
+
font-size: 10px;
|
70 |
+
color:#F66;
|
71 |
+
}
|
72 |
+
.kk-ratings .casting-thanks {
|
73 |
+
display: none;
|
74 |
+
}
|
75 |
+
.kk-ratings .casting-error {
|
76 |
+
display: none;
|
77 |
+
}
|
78 |
+
.kk-ratings span {
|
79 |
+
display: none;
|
80 |
+
}
|
images/off.png
ADDED
Binary file
|
images/on.png
ADDED
Binary file
|
images/over.png
ADDED
Binary file
|
js/kk-ratings.js
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ***************************
|
2 |
+
kk Star Ratings js - start
|
3 |
+
*************************** */
|
4 |
+
|
5 |
+
jQuery(document).ready( function($){
|
6 |
+
$('.kk-ratings').kkratings({
|
7 |
+
'path' : kk_ratings_settings.path,
|
8 |
+
'root' : kk_ratings_settings.root,
|
9 |
+
'nonce' : kk_ratings_settings.nonce,
|
10 |
+
'position' : kk_ratings_settings.pos
|
11 |
+
});
|
12 |
+
});
|
13 |
+
|
14 |
+
(function( $ ){
|
15 |
+
|
16 |
+
$.fn.kkratings = function( options ) {
|
17 |
+
|
18 |
+
settings = {
|
19 |
+
'path' : null,
|
20 |
+
'nonce' : null,
|
21 |
+
'root' : null,
|
22 |
+
'position' : 'top-left'
|
23 |
+
};
|
24 |
+
|
25 |
+
return this.each(function() {
|
26 |
+
|
27 |
+
if ( options ) {
|
28 |
+
$.extend( settings, options );
|
29 |
+
}
|
30 |
+
|
31 |
+
var obj = this;
|
32 |
+
|
33 |
+
if($.browser.msie)
|
34 |
+
$(obj).css({'background-color' : '#FFF' });
|
35 |
+
|
36 |
+
switch(settings.position)
|
37 |
+
{
|
38 |
+
case 'top-left':
|
39 |
+
case 'bottom-left': $(obj).css({'float':'left'}); break;
|
40 |
+
case 'top-right':
|
41 |
+
case 'bottom-right': $(obj).css({'float':'right'}); break;
|
42 |
+
}
|
43 |
+
|
44 |
+
// ANIMATION
|
45 |
+
|
46 |
+
$(".hover-panel > a", obj).mouseover( function() {
|
47 |
+
var obj = $(this).parent().parent();
|
48 |
+
if(obj.hasClass('open'))
|
49 |
+
{
|
50 |
+
$('.stars-turned-on', obj).stop(true, true);
|
51 |
+
$('.stars-turned-on', obj).hide();
|
52 |
+
$(this).addClass('hovered-rating');
|
53 |
+
var flag = true;
|
54 |
+
$(".hover-panel > a", obj).each( function(index) {
|
55 |
+
if(flag)
|
56 |
+
{
|
57 |
+
$(".hover-panel > a", obj).stop(true, true);
|
58 |
+
$(this).hide();
|
59 |
+
$(this).addClass('hovered-star')
|
60 |
+
$(this).fadeIn('slow');
|
61 |
+
}
|
62 |
+
if($(this).hasClass('hovered-rating')==true)
|
63 |
+
{
|
64 |
+
flag = false;
|
65 |
+
}
|
66 |
+
});
|
67 |
+
$(this).removeClass('hovered-rating');
|
68 |
+
}
|
69 |
+
});
|
70 |
+
|
71 |
+
$(".hover-panel > a", obj).mouseout( function() {
|
72 |
+
var obj = $(this).parent().parent();
|
73 |
+
var stars = $(".hovered-star", obj).get();
|
74 |
+
for(var i = stars.length - 1; i >= 0; i--)
|
75 |
+
{
|
76 |
+
$(".hovered-star", obj).stop(true, true);
|
77 |
+
$(".hovered-star:eq("+i+")", obj).fadeOut('fast', function() {
|
78 |
+
$(this).removeClass('hovered-star') ;
|
79 |
+
$(this).css({'display':'block'});
|
80 |
+
});
|
81 |
+
}
|
82 |
+
$('.stars-turned-on', obj).fadeIn(1000);
|
83 |
+
});
|
84 |
+
|
85 |
+
var id = $("span:eq(0)",obj).html();
|
86 |
+
$(obj).addClass('open');
|
87 |
+
$.ajax({
|
88 |
+
type: "POST",
|
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')
|
96 |
+
{
|
97 |
+
var per = response[1];
|
98 |
+
var legend = response[2];
|
99 |
+
var open = response[3];
|
100 |
+
|
101 |
+
if($.browser.opera)
|
102 |
+
$('.stars-turned-on',obj).css({'width':per+'%'});
|
103 |
+
else
|
104 |
+
{
|
105 |
+
$('.stars-turned-on',obj).animate({
|
106 |
+
'width' : '0%'
|
107 |
+
}, 'slow', function(){
|
108 |
+
$('.stars-turned-on',obj).animate({
|
109 |
+
'width' : per+'%'
|
110 |
+
}, 'slow', function(){
|
111 |
+
|
112 |
+
});
|
113 |
+
});
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
$('.casting-desc',obj).text(legend);
|
118 |
+
|
119 |
+
if(open=='no')
|
120 |
+
{
|
121 |
+
$(obj).removeClass('open');
|
122 |
+
$('.stars-turned-on',obj).addClass('stars-turned-strict');
|
123 |
+
}
|
124 |
+
}
|
125 |
+
else
|
126 |
+
{
|
127 |
+
|
128 |
+
}
|
129 |
+
}
|
130 |
+
});
|
131 |
+
|
132 |
+
$(".hover-panel > a", obj).click( function() {
|
133 |
+
var obj = $(this).parent().parent();
|
134 |
+
var percentage = 0;
|
135 |
+
var flag = true;
|
136 |
+
if(obj.hasClass('open'))
|
137 |
+
{
|
138 |
+
var current = $(this);
|
139 |
+
var starsT = current.attr('rel');
|
140 |
+
var starsTT = starsT.split('-');
|
141 |
+
var stars = parseInt(starsTT[1]);
|
142 |
+
var id = $("span:eq(0)",obj).text();
|
143 |
+
$.ajax({
|
144 |
+
type: "POST",
|
145 |
+
url: settings.path+"ajax/kk-ratings-ajax.php",
|
146 |
+
data: '_ajax_nonce='+settings.nonce+'&root='+settings.root+"&op=put&id="+id+'&stars='+stars,
|
147 |
+
beforeSend: function(){
|
148 |
+
obj.fadeTo('slow',0.3);
|
149 |
+
$('.casting-desc',obj).fadeOut('fast');
|
150 |
+
},
|
151 |
+
success: function(msg){
|
152 |
+
msg = msg.replace(/^\s+|\s+$/g,"");
|
153 |
+
var response = msg.split('|||');
|
154 |
+
if(response[0]=='SUCCESS')
|
155 |
+
{
|
156 |
+
var per = response[1];
|
157 |
+
var legend = response[2];
|
158 |
+
var open = response[3];
|
159 |
+
|
160 |
+
percentage = per;
|
161 |
+
|
162 |
+
$('.casting-desc',obj).text(legend);
|
163 |
+
|
164 |
+
if(open=='no')
|
165 |
+
{
|
166 |
+
obj.removeClass('open');
|
167 |
+
$('.stars-turned-on',obj).addClass('stars-turned-strict');
|
168 |
+
}
|
169 |
+
}
|
170 |
+
else
|
171 |
+
{
|
172 |
+
flag = false;
|
173 |
+
}
|
174 |
+
},
|
175 |
+
complete: function(){
|
176 |
+
if(flag)
|
177 |
+
{
|
178 |
+
obj.stop(true, true);
|
179 |
+
obj.fadeTo('slow',1, function(){
|
180 |
+
$(".casting-thanks",obj).fadeIn('slow').delay(1000).fadeOut('slow', function(){
|
181 |
+
$('.casting-desc',obj).fadeIn('slow');
|
182 |
+
});
|
183 |
+
|
184 |
+
if($.browser.opera)
|
185 |
+
$('.stars-turned-on',obj).css({'width':percentage+'%'});
|
186 |
+
else
|
187 |
+
{
|
188 |
+
$('.stars-turned-on',obj).animate({
|
189 |
+
'width' : '0%'
|
190 |
+
}, 'slow', function(){
|
191 |
+
$('.stars-turned-on',obj).animate({
|
192 |
+
'width' : percentage+'%'
|
193 |
+
}, 'slow', function(){
|
194 |
+
|
195 |
+
});
|
196 |
+
});
|
197 |
+
}
|
198 |
+
});
|
199 |
+
}
|
200 |
+
else
|
201 |
+
{
|
202 |
+
obj.stop(true, true);
|
203 |
+
obj.fadeTo('slow',1, function(){
|
204 |
+
$(".casting-error",obj).fadeIn('slow').delay(1000).fadeOut('slow', function(){
|
205 |
+
$('.casting-desc',obj).fadeIn('slow');
|
206 |
+
});
|
207 |
+
});
|
208 |
+
}
|
209 |
+
}
|
210 |
+
});
|
211 |
+
}
|
212 |
+
return false;
|
213 |
+
});
|
214 |
+
|
215 |
+
});
|
216 |
+
|
217 |
+
};
|
218 |
+
|
219 |
+
})( jQuery );
|
220 |
+
|
221 |
+
|
222 |
+
/* ***************************
|
223 |
+
kk Star Ratings js - end
|
224 |
+
*************************** */
|
kk-ratings.php
ADDED
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
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.0
|
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
|
18 |
+
{
|
19 |
+
// will contain id of plugin
|
20 |
+
private $plugin_id;
|
21 |
+
// js file
|
22 |
+
private $js_file;
|
23 |
+
// css file
|
24 |
+
private $css_file;
|
25 |
+
// Will be responsible for storing plugin options
|
26 |
+
private $options;
|
27 |
+
// Manual mode flag
|
28 |
+
private $manual_mode;
|
29 |
+
|
30 |
+
/** function/method
|
31 |
+
* Usage: defining the constructor (setting the plugin id and table prefix)
|
32 |
+
* Arg(2): string(alphanumeric, underscore, hyphen), string
|
33 |
+
* Return: void
|
34 |
+
*/
|
35 |
+
public function __construct($id)
|
36 |
+
{
|
37 |
+
// set plugin id
|
38 |
+
$this->plugin_id = $id;
|
39 |
+
// set js file
|
40 |
+
$this->js_file = '/js/kk-ratings.js';
|
41 |
+
// set css file
|
42 |
+
$this->css_file = '/css/kk-ratings.css';
|
43 |
+
// retrieve array of options
|
44 |
+
$this->options = $this->get_options();
|
45 |
+
// set manual mode to false
|
46 |
+
$this->manual_mode = false;
|
47 |
+
}
|
48 |
+
/** function/method
|
49 |
+
* Usage: return file path relative to current plugin directory
|
50 |
+
* Arg(1): string
|
51 |
+
* Return: string
|
52 |
+
*/
|
53 |
+
private function file_path($filepath)
|
54 |
+
{
|
55 |
+
return plugins_url($filepath, __FILE__);
|
56 |
+
}
|
57 |
+
/** function/method
|
58 |
+
* Usage: helper for hooking js script
|
59 |
+
* Arg(0): null
|
60 |
+
* Return: void
|
61 |
+
*/
|
62 |
+
public function js()
|
63 |
+
{
|
64 |
+
if (!is_admin())
|
65 |
+
{
|
66 |
+
$nonce = wp_create_nonce($this->plugin_id);
|
67 |
+
$params = array();
|
68 |
+
$params['nonce'] = $nonce; //for security
|
69 |
+
$params['path'] = $this->file_path('').'/';
|
70 |
+
$params['root'] = urlencode(ABSPATH);
|
71 |
+
$params['pos'] = $this->options['position'];
|
72 |
+
|
73 |
+
//wp_deregister_script('jquery');
|
74 |
+
//wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"), false);
|
75 |
+
wp_enqueue_script('jquery');
|
76 |
+
wp_enqueue_script($this->plugin_id.'_js', $this->file_path($this->js_file), array('jquery') );
|
77 |
+
wp_localize_script($this->plugin_id.'_js', str_replace('-', '_', $this->plugin_id).'_settings', $params);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
public function css($head)
|
81 |
+
{
|
82 |
+
echo "<link href='".$this->file_path($this->css_file)."' rel='stylesheet' />";
|
83 |
+
}
|
84 |
+
/** function/method
|
85 |
+
* Usage: return saved options
|
86 |
+
* Arg(0): null
|
87 |
+
* Return: array
|
88 |
+
*/
|
89 |
+
private function get_options($key=false)
|
90 |
+
{
|
91 |
+
// return saved options
|
92 |
+
$options = get_option($this->plugin_id);
|
93 |
+
if($key) return $options[$key];
|
94 |
+
return $options;
|
95 |
+
}
|
96 |
+
/** function/method
|
97 |
+
* Usage: update new options
|
98 |
+
* Arg(0): null
|
99 |
+
* Return: void
|
100 |
+
*/
|
101 |
+
private function update_options($options=false)
|
102 |
+
{
|
103 |
+
// update options
|
104 |
+
update_option($this->plugin_id, $options ? $options : $this->options);
|
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
|
113 |
+
$this->options['show_in_home'] = 0; // 1, 0
|
114 |
+
$this->options['show_in_archives'] = 0; // 1, 0
|
115 |
+
$this->options['show_in_posts'] = 1; // 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;
|
123 |
+
}
|
124 |
+
public function admin_init()
|
125 |
+
{
|
126 |
+
register_setting($this->plugin_id.'_options', $this->plugin_id);
|
127 |
+
}
|
128 |
+
/** function/method
|
129 |
+
* Usage: helper for hooking (registering) the theme menu under settings
|
130 |
+
* Arg(0): null
|
131 |
+
* Return: void
|
132 |
+
*/
|
133 |
+
public function menu()
|
134 |
+
{
|
135 |
+
add_options_page('kk Star Ratings', 'kk Star Ratings', 'manage_options', $this->plugin_id.'_options', array(&$this, 'options_page'));
|
136 |
+
}
|
137 |
+
/** function/method
|
138 |
+
* Usage: show options/settings form page
|
139 |
+
* Arg(0): null
|
140 |
+
* Return: void
|
141 |
+
*/
|
142 |
+
public function options_page()
|
143 |
+
{
|
144 |
+
if (!current_user_can('manage_options'))
|
145 |
+
{
|
146 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
147 |
+
}
|
148 |
+
|
149 |
+
//FLUSH the ratings
|
150 |
+
if(!empty($_POST) && check_admin_referer('kkratings_flush','kkratings-flush-nonce'))
|
151 |
+
{
|
152 |
+
if(!strcmp($_POST['kkratings-flush-cfm'],'Yes'))
|
153 |
+
{
|
154 |
+
$postids = trim($_POST['kkratings_input']);
|
155 |
+
if(strcmp($postids,''))
|
156 |
+
{
|
157 |
+
$posts = explode(',', $postids);
|
158 |
+
$poststoflush = '';
|
159 |
+
foreach($posts as $key=>$val)
|
160 |
+
{
|
161 |
+
delete_post_meta($val, '_kk_ratings_ratings');
|
162 |
+
delete_post_meta($val, '_kk_ratings_casts');
|
163 |
+
delete_post_meta($val, '_kk_ratings_ips');
|
164 |
+
}
|
165 |
+
echo '<div class="updated settings-error" style="padding:5px;">Ratings for id(s) '.$postids.' have been FLUSHED Successfully</div>';
|
166 |
+
}
|
167 |
+
else
|
168 |
+
{
|
169 |
+
$allposts = get_posts('numberposts=-1&post_type=post&post_status=any');
|
170 |
+
foreach( $allposts as $postinfo)
|
171 |
+
{
|
172 |
+
delete_post_meta($postinfo->ID, '_kk_ratings_ratings');
|
173 |
+
delete_post_meta($postinfo->ID, '_kk_ratings_casts');
|
174 |
+
delete_post_meta($postinfo->ID, '_kk_ratings_ips');
|
175 |
+
}
|
176 |
+
echo '<div class="updated settings-error" style="padding:5px;">All ratings have been FLUSHED Successfully</div>';
|
177 |
+
}
|
178 |
+
|
179 |
+
}
|
180 |
+
if(!strcmp($_POST['kkratings-flush'],'Flush Ratings'))
|
181 |
+
{
|
182 |
+
$postids = trim(str_replace(' ', '',$_POST['kkratings_input']));
|
183 |
+
echo '<div class="updated settings-error" style="padding:5px;">';
|
184 |
+
echo '<form action="" method="POST">';
|
185 |
+
wp_nonce_field('kkratings_flush','kkratings-flush-nonce');
|
186 |
+
$msg = "<p>Are you sure to remove ratings of posts/pages for the following id(s) : $postids</p>";
|
187 |
+
if(!strcmp($postids,''))
|
188 |
+
{
|
189 |
+
$msg = '<p>Are you sure to <strong>REMOVE ALL RATINGS</strong> that have been occured on the site</p>';
|
190 |
+
}
|
191 |
+
echo $msg;
|
192 |
+
echo '<input type="submit" value="Yes" name="kkratings-flush-cfm" class="button-primary" />';
|
193 |
+
echo '<input type="submit" value="No" name="kkratings-flush-cfm" class="button-primary" />';
|
194 |
+
echo '<input name="kkratings_input" type="hidden" value="'.$postids.'" size="10" />';
|
195 |
+
echo '</form>';
|
196 |
+
echo '</div>';
|
197 |
+
}
|
198 |
+
}
|
199 |
+
//end
|
200 |
+
|
201 |
+
// get saved options
|
202 |
+
$options = $this->get_options();
|
203 |
+
include('admin/options.php');
|
204 |
+
}
|
205 |
+
public function init()
|
206 |
+
{
|
207 |
+
if(!is_admin() && $this->options['enable'])
|
208 |
+
{
|
209 |
+
add_filter('the_content', array(&$this, 'filter_content'));
|
210 |
+
add_filter('the_excerpt', array(&$this, 'filter_content'));
|
211 |
+
}
|
212 |
+
}
|
213 |
+
public function markup()
|
214 |
+
{
|
215 |
+
$markup = '<div class="kk-ratings open">
|
216 |
+
<span>'.get_the_ID().'</span>
|
217 |
+
<div class="stars-turned-on"> </div>
|
218 |
+
<!--.stars-turned-on-->
|
219 |
+
<div class="hover-panel">
|
220 |
+
<a href="javascript:void();" rel="star-1"></a>
|
221 |
+
<a href="javascript:void();" rel="star-2"></a>
|
222 |
+
<a href="javascript:void();" rel="star-3"></a>
|
223 |
+
<a href="javascript:void();" rel="star-4"></a>
|
224 |
+
<a href="javascript:void();" rel="star-5"></a>
|
225 |
+
</div>
|
226 |
+
<!--.hover-panel-->
|
227 |
+
<div class="casting-desc">'.$this->options['init_msg'].'</div>
|
228 |
+
<div class="casting-thanks">Thanks!</div>
|
229 |
+
<div class="casting-error">An error occurred!</div>
|
230 |
+
<!--.casting-desc-->
|
231 |
+
</div>
|
232 |
+
<!--.kk-ratings-->';
|
233 |
+
$markup .= $this->options['clear']? '<br clear="both" />' : '';
|
234 |
+
|
235 |
+
return $markup;
|
236 |
+
}
|
237 |
+
public function do_it_manually()
|
238 |
+
{
|
239 |
+
if(!is_admin() && $this->options['enable'])
|
240 |
+
{
|
241 |
+
if(
|
242 |
+
(($this->options['show_in_home']) && (is_front_page() || is_home()))
|
243 |
+
|| (($this->options['show_in_archives']) && (is_archive()))
|
244 |
+
)
|
245 |
+
return $this->markup();
|
246 |
+
else if(is_single() || is_page())
|
247 |
+
return $this->markup();
|
248 |
+
}
|
249 |
+
else
|
250 |
+
remove_shortcode('kkratings');
|
251 |
+
return '';
|
252 |
+
}
|
253 |
+
public function filter_content($content)
|
254 |
+
{
|
255 |
+
if(
|
256 |
+
(($this->options['show_in_home']) && (is_front_page() || is_home()))
|
257 |
+
|| (($this->options['show_in_archives']) && (is_archive()))
|
258 |
+
|| (($this->options['show_in_posts']) && (is_single()))
|
259 |
+
|| (($this->options['show_in_pages']) && (is_page()))
|
260 |
+
) :
|
261 |
+
remove_shortcode('kkratings');
|
262 |
+
$content = str_replace('[kkratings]', '', $content);
|
263 |
+
$markup = $this->markup();
|
264 |
+
switch($this->options['position'])
|
265 |
+
{
|
266 |
+
case 'bottom-left' :
|
267 |
+
case 'bottom-right' : return $content . $markup;
|
268 |
+
default : return $markup . $content;
|
269 |
+
}
|
270 |
+
|
271 |
+
endif;
|
272 |
+
return $content;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
// Instantiate the plugin
|
277 |
+
$kkratings = new kk_Ratings('kk-ratings');
|
278 |
+
register_activation_hook(__FILE__, array($kkratings, 'activate'));
|
279 |
+
add_action('wp_head', array($kkratings, 'css'));
|
280 |
+
add_action('wp_print_scripts', array($kkratings, 'js'));
|
281 |
+
add_action('admin_init', array($kkratings, 'admin_init'));
|
282 |
+
add_action('admin_menu', array($kkratings, 'menu'));
|
283 |
+
add_action('init', array($kkratings, 'init'));
|
284 |
+
// add shortcode handler
|
285 |
+
add_shortcode('kkratings', array($kkratings, 'do_it_manually'));
|
286 |
+
endif;
|
287 |
+
|
288 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== kk Star Ratings ===
|
2 |
+
|
3 |
+
|
4 |
+
Contributors: bhittani
|
5 |
+
|
6 |
+
Donate link: http://wakeusup.com/2011/05/kk-star-ratings/
|
7 |
+
|
8 |
+
Tags: star ratings, votings, rate posts, ajax ratings
|
9 |
+
|
10 |
+
Requires at least: 3.0
|
11 |
+
|
12 |
+
Tested up to: 3.1.3
|
13 |
+
|
14 |
+
Stable tag: 1.1
|
15 |
+
|
16 |
+
|
17 |
+
kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
== Description ==
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
As the name states, this plugin displays a 5 star ratings in your posts/pages.
|
27 |
+
|
28 |
+
It has quite cool hover fade effects and animations.
|
29 |
+
|
30 |
+
A settings page is also available where you can adjust the settings. You can:
|
31 |
+
|
32 |
+
|
33 |
+
1. Select where to show the ratings. It can be on homepage, archives, posts, pages or manually.
|
34 |
+
|
35 |
+
1. Restrict votings per unique ip
|
36 |
+
|
37 |
+
1. Choose the placement. Top left, top right, bottom left or bottom right.
|
38 |
+
|
39 |
+
1. Adjust the legend (description) of the ratings. 3 variables are avaialable which are [total] (total amount of casted votes), [per] (percentage of ratings) and [avg] (average ratings).
|
40 |
+
|
41 |
+
1. Adjust the initial message (when no ratings have occured).
|
42 |
+
|
43 |
+
1. Allow the ratings to be visible on its own line (paragraph)
|
44 |
+
|
45 |
+
1. Reset the ratings for individual posts or the entire site.
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
== Installation ==
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
1. Upload the folder 'kk-star-ratings' found inside the zip to the `/wp-content/plugins/` directory
|
55 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress
|
56 |
+
1. Adjust the settings under the settings->kk Star Ratings page in wp-admin.
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
== Frequently Asked Questions ==
|
61 |
+
|
62 |
+
=
|
63 |
+
|
64 |
+
I have installed the plugin, but the ratings are not showing up anywhere
|
65 |
+
|
66 |
+
=
|
67 |
+
|
68 |
+
First of all make sure you have selected where to display the ratings in the settings page. NOTE: unfortunately, some themes are poorly developed, so keep that in mind.
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
== Screenshots ==
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
1. The settings page
|
77 |
+
|
78 |
+
|
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 |
+
|
88 |
+
== Upgrade Notice ==
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|