Version Description
- Fix: Google rich snippets is now stable and safe to use.
- Fix: Grammers in admin settings.
- Update: Control whether to allow users to rate in archives or not.
- Update: Reordered directory tree structure.
- Added: Useful hooks and filters for advanced developers.
Download this release
Release Info
Developer | bhittani |
Plugin | kk Star Ratings |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- admin.php +84 -17
- bhittani-framework/admin/admin.class.php +113 -22
- bhittani-framework/admin/css/admin.css +16 -2
- bhittani-framework/admin/js/script.js +46 -0
- bhittani-framework/admin/markup.class.php +1 -1
- bhittani-framework/license.txt +367 -0
- plugin.php → bhittani-framework/plugin.php +12 -7
- css.css +3 -0
- index.php +103 -75
- js.js +18 -11
- js_admin.js +19 -62
- readme.txt +21 -4
admin.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
|
2 |
<div class="bhittani-framework">
|
|
|
3 |
<div class="bf-wrap-small _right">
|
4 |
<h3>Like the plugin</h3>
|
5 |
<p>
|
@@ -9,14 +9,15 @@
|
|
9 |
<?php echo base64_decode('PGlmcmFtZSBzcmM9Imh0dHA6Ly9iaGl0dGFuaS5jb20vd3AucGhwIiBpZD0iYmZhIiB3aWR0aD0iMjI1IiBoZWlnaHQ9IjQwMCIgc2Nyb2xsaW5nPSJubyIgYm9yZGVyPSIwIj48L2lmcmFtZT4='); ?>
|
10 |
</div>
|
11 |
<!-- bf-wrap-small -->
|
|
|
12 |
<div class="bf-wrap">
|
13 |
<div class="bf_head">
|
14 |
<ul class="bf_navs _right">
|
15 |
-
<li<?php echo ($opt=='general')?' class="active"':''; ?>><a href="#
|
16 |
<li<?php echo ($opt=='stars')?' class="active"':''; ?>><a href="#Stars">Stars</a></li>
|
17 |
<li<?php echo ($opt=='tooltips')?' class="active"':''; ?>><a href="#Tooltips">Tooltips</a></li>
|
18 |
<li<?php echo ($opt=='reset')?' class="active"':''; ?>><a href="#Reset">Reset</a></li>
|
19 |
-
<li<?php echo ($opt=='info')?' class="active"':''; ?>><a href="#
|
20 |
<li class="bf-save"><a href="#" rel="save-options">Save</a></li>
|
21 |
</ul>
|
22 |
<!--bf_navs-->
|
@@ -25,16 +26,24 @@
|
|
25 |
<?php echo $h3; ?>
|
26 |
</h3>
|
27 |
<div class="links">
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</div>
|
32 |
</div>
|
33 |
<!--bf_logo-->
|
34 |
</div>
|
35 |
<!--bf_head-->
|
36 |
<form method="post" action="" name="bf_form">
|
37 |
-
<div class="bf_container
|
38 |
<?php
|
39 |
|
40 |
BhittaniPlugin_AdminMarkup::checkbox(array(
|
@@ -72,8 +81,24 @@
|
|
72 |
'label' => 'Show in Pages',
|
73 |
'value' => get_option('kksr_show_in_pages')
|
74 |
),
|
|
|
|
|
|
|
|
|
|
|
75 |
)
|
76 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
BhittaniPlugin_AdminMarkup::checkbox(array(
|
78 |
'title' => 'Unique voting',
|
79 |
'description' => 'Choose whether you want unique votings based on IP or not',
|
@@ -115,7 +140,9 @@
|
|
115 |
<code>[total]</code>=total ratings <br />
|
116 |
<code>[avg]</code>=average <br />
|
117 |
<code>[per]</code>=percentage <br />
|
118 |
-
<code>[s]</code>=for plural vs singular of votes occurred
|
|
|
|
|
119 |
',
|
120 |
'field' => 'kksr_legend',
|
121 |
'value' => get_option('kksr_legend')
|
@@ -219,7 +246,7 @@
|
|
219 |
)
|
220 |
)
|
221 |
));
|
222 |
-
$Tooltips =
|
223 |
for($tooltip_i=0;$tooltip_i<get_option('kksr_stars');$tooltip_i++)
|
224 |
{
|
225 |
BhittaniPlugin_AdminMarkup::input(array(
|
@@ -289,23 +316,23 @@
|
|
289 |
?>
|
290 |
</div>
|
291 |
<!--bf_container __reset-->
|
292 |
-
<div class="bf_container
|
293 |
<?php
|
294 |
BhittaniPlugin_AdminMarkup::html(
|
295 |
'<p>
|
296 |
<strong>To manually use in your post/page using admin screen, use the star icon in your post/page editor</strong>
|
297 |
<br /><br />
|
298 |
<strong>For use in theme files:</strong>
|
299 |
-
<br /> <code><?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid); endif; ?></code>
|
300 |
-
<br />Where $pid is the
|
301 |
<br /><br />
|
302 |
<strong>Get top rated posts as array of objects:</strong>
|
303 |
-
<br /> <code><?php <br /> if(function_exists("kk_star_ratings_get")) <br /> { <br /> $top_rated_posts = kk_star_ratings_get($total); <br /> } <br />?></code>
|
304 |
<br />Where $total is the limit (int)
|
305 |
<br />$top_rated_posts will contain an array of objects, each containing an ID and ratings.
|
306 |
-
<br
|
307 |
-
|
308 |
-
<code>
|
309 |
<pre>
|
310 |
foreach($top_rated_posts as $post)
|
311 |
{
|
@@ -313,13 +340,53 @@ foreach($top_rated_posts as $post)
|
|
313 |
// Do anything with it like get_post($post->ID)
|
314 |
// ...
|
315 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
</pre>
|
317 |
</code>
|
318 |
</p>'
|
319 |
);
|
320 |
?>
|
321 |
</div>
|
322 |
-
<!--bf_container
|
323 |
</form>
|
324 |
</div>
|
325 |
<!-- bf-wrap -->
|
|
|
1 |
<div class="bhittani-framework">
|
2 |
+
<?php if(isset($sidebar)) : ?>
|
3 |
<div class="bf-wrap-small _right">
|
4 |
<h3>Like the plugin</h3>
|
5 |
<p>
|
9 |
<?php echo base64_decode('PGlmcmFtZSBzcmM9Imh0dHA6Ly9iaGl0dGFuaS5jb20vd3AucGhwIiBpZD0iYmZhIiB3aWR0aD0iMjI1IiBoZWlnaHQ9IjQwMCIgc2Nyb2xsaW5nPSJubyIgYm9yZGVyPSIwIj48L2lmcmFtZT4='); ?>
|
10 |
</div>
|
11 |
<!-- bf-wrap-small -->
|
12 |
+
<?php endif; ?>
|
13 |
<div class="bf-wrap">
|
14 |
<div class="bf_head">
|
15 |
<ul class="bf_navs _right">
|
16 |
+
<li<?php echo ($opt=='general')?' class="active"':''; ?>><a href="#Settings">Settings</a></li>
|
17 |
<li<?php echo ($opt=='stars')?' class="active"':''; ?>><a href="#Stars">Stars</a></li>
|
18 |
<li<?php echo ($opt=='tooltips')?' class="active"':''; ?>><a href="#Tooltips">Tooltips</a></li>
|
19 |
<li<?php echo ($opt=='reset')?' class="active"':''; ?>><a href="#Reset">Reset</a></li>
|
20 |
+
<li<?php echo ($opt=='info')?' class="active"':''; ?>><a href="#Help">Help</a></li>
|
21 |
<li class="bf-save"><a href="#" rel="save-options">Save</a></li>
|
22 |
</ul>
|
23 |
<!--bf_navs-->
|
26 |
<?php echo $h3; ?>
|
27 |
</h3>
|
28 |
<div class="links">
|
29 |
+
<?php
|
30 |
+
if(isset($Url) && is_array($Url))
|
31 |
+
{
|
32 |
+
$url_sep = '';
|
33 |
+
foreach($Url as $url)
|
34 |
+
{
|
35 |
+
echo $url_sep . '<a href="'.$url['link'].'" target="_blank">' . $url['title'] . '</a>';
|
36 |
+
$url_sep = ' | ';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
?>
|
40 |
</div>
|
41 |
</div>
|
42 |
<!--bf_logo-->
|
43 |
</div>
|
44 |
<!--bf_head-->
|
45 |
<form method="post" action="" name="bf_form">
|
46 |
+
<div class="bf_container __settings <?php echo ($opt=='general')?'__active':''; ?>">
|
47 |
<?php
|
48 |
|
49 |
BhittaniPlugin_AdminMarkup::checkbox(array(
|
81 |
'label' => 'Show in Pages',
|
82 |
'value' => get_option('kksr_show_in_pages')
|
83 |
),
|
84 |
+
array(
|
85 |
+
'field' => 'kksr_disable_in_archives',
|
86 |
+
'label' => 'Disable voting in archives',
|
87 |
+
'value' => get_option('kksr_disable_in_archives')
|
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',
|
94 |
+
'obj' => array(
|
95 |
+
array(
|
96 |
+
'field' => 'kksr_grs',
|
97 |
+
'label' => 'Enable',
|
98 |
+
'value' => get_option('kksr_grs')
|
99 |
+
)
|
100 |
+
)
|
101 |
+
));
|
102 |
BhittaniPlugin_AdminMarkup::checkbox(array(
|
103 |
'title' => 'Unique voting',
|
104 |
'description' => 'Choose whether you want unique votings based on IP or not',
|
140 |
<code>[total]</code>=total ratings <br />
|
141 |
<code>[avg]</code>=average <br />
|
142 |
<code>[per]</code>=percentage <br />
|
143 |
+
<code>[s]</code>=for plural vs singular of votes occurred <br />
|
144 |
+
<strong>NOTE</strong> <br />
|
145 |
+
<code>[total]</code> and <code>[avg]</code> is mandatory for Google Rich Snippets to work
|
146 |
',
|
147 |
'field' => 'kksr_legend',
|
148 |
'value' => get_option('kksr_legend')
|
246 |
)
|
247 |
)
|
248 |
));
|
249 |
+
$Tooltips = get_option('kksr_tooltips');
|
250 |
for($tooltip_i=0;$tooltip_i<get_option('kksr_stars');$tooltip_i++)
|
251 |
{
|
252 |
BhittaniPlugin_AdminMarkup::input(array(
|
316 |
?>
|
317 |
</div>
|
318 |
<!--bf_container __reset-->
|
319 |
+
<div class="bf_container __help <?php echo ($opt=='info')?'__active':''; ?>">
|
320 |
<?php
|
321 |
BhittaniPlugin_AdminMarkup::html(
|
322 |
'<p>
|
323 |
<strong>To manually use in your post/page using admin screen, use the star icon in your post/page editor</strong>
|
324 |
<br /><br />
|
325 |
<strong>For use in theme files:</strong>
|
326 |
+
<br /> <code class="_block"><?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid); endif; ?></code>
|
327 |
+
<br />Where $pid is the id of the post
|
328 |
<br /><br />
|
329 |
<strong>Get top rated posts as array of objects:</strong>
|
330 |
+
<br /> <code class="_block"><?php <br /> if(function_exists("kk_star_ratings_get")) <br /> { <br /> $top_rated_posts = kk_star_ratings_get($total); <br /> } <br />?></code>
|
331 |
<br />Where $total is the limit (int)
|
332 |
<br />$top_rated_posts will contain an array of objects, each containing an ID and ratings.
|
333 |
+
<br />
|
334 |
+
Example Usage:
|
335 |
+
<code class="_block">
|
336 |
<pre>
|
337 |
foreach($top_rated_posts as $post)
|
338 |
{
|
340 |
// Do anything with it like get_post($post->ID)
|
341 |
// ...
|
342 |
}
|
343 |
+
</pre>
|
344 |
+
</code>
|
345 |
+
<strong>Action Hooks</strong>
|
346 |
+
<br />
|
347 |
+
When post rating is fetched initially.
|
348 |
+
<code class="_block">
|
349 |
+
<pre>
|
350 |
+
add_action("kksr_init", "my_super_function1", 10, 3);
|
351 |
+
</pre>
|
352 |
+
</code>
|
353 |
+
example usage:
|
354 |
+
<code class="_block">
|
355 |
+
<pre>
|
356 |
+
function my_super_function1($post_id, $avg, $votes);
|
357 |
+
{
|
358 |
+
// $post_id is the id of the post.
|
359 |
+
// $avg is the average ratings as a string (e.g. 4.3/5).
|
360 |
+
// $votes is the total amount of votes occured.
|
361 |
+
|
362 |
+
// Do your magic below
|
363 |
+
}
|
364 |
+
</pre>
|
365 |
+
</code>
|
366 |
+
When a post gets rated
|
367 |
+
<code class="_block">
|
368 |
+
<pre>
|
369 |
+
add_action("kksr_rate", "my_super_function2", 10, 3);
|
370 |
+
</pre>
|
371 |
+
</code>
|
372 |
+
example usage:
|
373 |
+
<code class="_block">
|
374 |
+
<pre>
|
375 |
+
function my_super_function2($post_id, $no_of_stars, $ip_address);
|
376 |
+
{
|
377 |
+
// $post_id is the id of the post.
|
378 |
+
// $no_of_stars is the amount of stars the user rated.
|
379 |
+
// $ip_address is the ip address of the user.
|
380 |
+
|
381 |
+
// Do your magic below
|
382 |
+
}
|
383 |
</pre>
|
384 |
</code>
|
385 |
</p>'
|
386 |
);
|
387 |
?>
|
388 |
</div>
|
389 |
+
<!--bf_container __help-->
|
390 |
</form>
|
391 |
</div>
|
392 |
<!-- bf-wrap -->
|
bhittani-framework/admin/admin.class.php
CHANGED
@@ -21,62 +21,153 @@
|
|
21 |
----------------------------------------------------------------
|
22 |
------------------------------------------------------------- */
|
23 |
|
24 |
-
if(!
|
25 |
|
26 |
// Declare and define the class.
|
27 |
-
class BhittaniPlugin_Admin
|
28 |
{
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
{
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
/** function/method
|
34 |
* Usage: hook js
|
35 |
* Arg(0): null
|
36 |
* Return: void
|
37 |
*/
|
38 |
-
public function js()
|
39 |
{
|
40 |
wp_enqueue_script('media-upload');
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
/** function/method
|
47 |
* Usage: hook css
|
48 |
* Arg(0): null
|
49 |
* Return: void
|
50 |
*/
|
51 |
-
public function css()
|
52 |
-
{
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
wp_enqueue_style('thickbox');
|
56 |
}
|
57 |
|
58 |
-
public function scripts()
|
59 |
{
|
60 |
-
|
61 |
-
|
62 |
}
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
{
|
65 |
?>
|
66 |
<div class="bhittani-lightbox">
|
67 |
<div class="kkpopup-bg"></div>
|
68 |
-
<div class="kkpopup-exit"><a href="#"><img src="<?php echo
|
69 |
<div class="kkpopup"></div>
|
70 |
-
<span class="kkpopup__processing"><img src="<?php echo
|
71 |
</div>
|
72 |
<div class="kkpopup-lightbox bhittani-lightbox"></div>
|
73 |
<?php
|
74 |
}
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
add_action('admin_enqueue_scripts', array(
|
79 |
-
add_filter('admin_footer', array(
|
|
|
80 |
|
81 |
endif;
|
82 |
?>
|
21 |
----------------------------------------------------------------
|
22 |
------------------------------------------------------------- */
|
23 |
|
24 |
+
if(!class_exists('BhittaniPlugin_Admin')) :
|
25 |
|
26 |
// Declare and define the class.
|
27 |
+
class BhittaniPlugin_Admin
|
28 |
{
|
29 |
+
private static $id;
|
30 |
+
private static $dir;
|
31 |
+
private static $ver;
|
32 |
+
|
33 |
+
public static function init($id, $dir='', $ver='0.1')
|
34 |
+
{
|
35 |
+
self::$id = $id;
|
36 |
+
self::$dir = $dir;
|
37 |
+
self::$ver = $ver;
|
38 |
+
}
|
39 |
+
/** function/method
|
40 |
+
* Usage: return file uri
|
41 |
+
* Arg(1): string
|
42 |
+
* Return: string
|
43 |
+
*/
|
44 |
+
public static function file_uri($path, $framework = true)
|
45 |
{
|
46 |
+
return plugins_url(($framework?self::$dir.'/':'').$path, __FILE__);
|
47 |
+
}
|
48 |
+
/** function/method
|
49 |
+
* Usage: return absoulte file path
|
50 |
+
* Arg(1): string
|
51 |
+
* Return: string
|
52 |
+
*/
|
53 |
+
public static function file_path($path, $framework = true)
|
54 |
+
{
|
55 |
+
return dirname(__FILE__).'/'.($framework?self::$dir.'/':'').$path;
|
56 |
}
|
57 |
/** function/method
|
58 |
* Usage: hook js
|
59 |
* Arg(0): null
|
60 |
* Return: void
|
61 |
*/
|
62 |
+
public static function js()
|
63 |
{
|
64 |
wp_enqueue_script('media-upload');
|
65 |
+
wp_enqueue_script(
|
66 |
+
self::$id.'_colorpicker',
|
67 |
+
self::file_uri('js/colorpicker/js/colorpicker.js'),
|
68 |
+
array('jquery'),
|
69 |
+
self::$ver
|
70 |
+
);
|
71 |
+
wp_enqueue_script(
|
72 |
+
self::$id.'_jqui',
|
73 |
+
self::file_uri('js/jquery-ui-1.8.14.custom.min.js'),
|
74 |
+
array('jquery'),
|
75 |
+
self::$ver
|
76 |
+
);
|
77 |
+
wp_enqueue_script(
|
78 |
+
self::$id.'_lightbox',
|
79 |
+
self::file_uri('js/lightbox.js'),
|
80 |
+
array('jquery'),
|
81 |
+
self::$ver
|
82 |
+
);
|
83 |
+
wp_enqueue_script(
|
84 |
+
self::$id.'_admin',
|
85 |
+
self::file_uri('js/admin.js'),
|
86 |
+
array('jquery'),
|
87 |
+
self::$ver
|
88 |
+
);
|
89 |
+
|
90 |
+
$nonce = wp_create_nonce(self::$id);
|
91 |
+
$Params = array();
|
92 |
+
$Params['nonce'] = $nonce;
|
93 |
+
$Params['ajaxurl'] = admin_url('admin-ajax.php');
|
94 |
+
$Params['func'] = 'bhittani_admin_ajax';
|
95 |
+
|
96 |
+
// do_action
|
97 |
+
|
98 |
+
wp_enqueue_script(
|
99 |
+
self::$id.'_script',
|
100 |
+
plugins_url('js/script.js', __FILE__),
|
101 |
+
array('jquery'),
|
102 |
+
self::$ver
|
103 |
+
);
|
104 |
+
wp_localize_script(
|
105 |
+
self::$id.'_script',
|
106 |
+
str_replace('-','_',self::$id).'_script',
|
107 |
+
$Params
|
108 |
+
);
|
109 |
}
|
110 |
/** function/method
|
111 |
* Usage: hook css
|
112 |
* Arg(0): null
|
113 |
* Return: void
|
114 |
*/
|
115 |
+
public static function css()
|
116 |
+
{
|
117 |
+
wp_register_style(self::$id.'_admin', self::file_uri('css/admin.css'), false, self::$ver);
|
118 |
+
wp_enqueue_style(self::$id.'_admin');
|
119 |
+
|
120 |
+
wp_register_style(self::$id.'_colorpicker', self::file_uri('js/colorpicker/css/colorpicker.css'), false, self::$ver);
|
121 |
+
wp_enqueue_style(self::$id.'_colorpicker');
|
122 |
+
|
123 |
wp_enqueue_style('thickbox');
|
124 |
}
|
125 |
|
126 |
+
public static function scripts()
|
127 |
{
|
128 |
+
self::css();
|
129 |
+
self::js();
|
130 |
}
|
131 |
+
|
132 |
+
public static function bhittani_admin_ajax()
|
133 |
+
{
|
134 |
+
header('content-type: application/json; charset=utf-8');
|
135 |
+
check_ajax_referer(self::$id);
|
136 |
+
|
137 |
+
unset($_POST['_wpnonce']);
|
138 |
+
unset($_POST['action']);
|
139 |
+
|
140 |
+
$Options = apply_filters('bf_admin_options', $_POST);
|
141 |
+
|
142 |
+
foreach($Options as $key => $value)
|
143 |
+
{
|
144 |
+
update_option($key, $value);
|
145 |
+
}
|
146 |
+
|
147 |
+
do_action('bf_admin_options_ajax', $Options);
|
148 |
+
|
149 |
+
echo json_encode(array('success'=>'true'));
|
150 |
+
die();
|
151 |
+
}
|
152 |
+
|
153 |
+
public static function lightbox_html($footer)
|
154 |
{
|
155 |
?>
|
156 |
<div class="bhittani-lightbox">
|
157 |
<div class="kkpopup-bg"></div>
|
158 |
+
<div class="kkpopup-exit"><a href="#"><img src="<?php echo self::file_uri('images/error.png'); ?>" width="16" height="16" alt="Close" /></a></div>
|
159 |
<div class="kkpopup"></div>
|
160 |
+
<span class="kkpopup__processing"><img src="<?php echo self::file_uri('images/loading.gif'); ?>" width="16" height="16" alt="Proccessing!" class="kkpopup-process" /></span>
|
161 |
</div>
|
162 |
<div class="kkpopup-lightbox bhittani-lightbox"></div>
|
163 |
<?php
|
164 |
}
|
165 |
}
|
166 |
|
167 |
+
BhittaniPlugin_Admin::init('bhittaniplugin_admin', '', '0.1');
|
168 |
+
add_action('admin_enqueue_scripts', array('BhittaniPlugin_Admin', 'scripts'));
|
169 |
+
add_filter('admin_footer', array('BhittaniPlugin_Admin', 'lightbox_html'));
|
170 |
+
add_action('wp_ajax_bhittani_admin_ajax', array('BhittaniPlugin_Admin', 'bhittani_admin_ajax'));
|
171 |
|
172 |
endif;
|
173 |
?>
|
bhittani-framework/admin/css/admin.css
CHANGED
@@ -6,6 +6,13 @@
|
|
6 |
position: relative;
|
7 |
overflow: hidden;
|
8 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
.bhittani-framework .bf-wrap {
|
10 |
width: 575px;
|
11 |
}
|
@@ -64,7 +71,7 @@
|
|
64 |
.bhittani-framework .bf_head ul.bf_navs li {
|
65 |
float: left;
|
66 |
line-height: 60px;
|
67 |
-
margin-right:
|
68 |
margin-left: 5px;
|
69 |
margin-top: 20px;
|
70 |
}
|
@@ -167,7 +174,7 @@
|
|
167 |
margin-top: 35px;
|
168 |
margin-bottom: 10px;
|
169 |
}
|
170 |
-
.bf_box input, .bf_box select, .bf_box textarea{
|
171 |
padding: 10px;
|
172 |
border: 3px solid #EEE;
|
173 |
width: 200px;
|
@@ -176,6 +183,9 @@
|
|
176 |
-moz-box-sizing: border-box; /* Firefox, other Gecko */
|
177 |
box-sizing: border-box; /* Opera/IE 8+ */
|
178 |
}
|
|
|
|
|
|
|
179 |
.bf_box select {
|
180 |
padding: 8px 10px;
|
181 |
height: 37px;
|
@@ -250,6 +260,10 @@ input.button {
|
|
250 |
border-bottom-color: #CCC;
|
251 |
border-left-color: #CCC;
|
252 |
}
|
|
|
|
|
|
|
|
|
253 |
|
254 |
|
255 |
div.bhittani-lightbox div.kkpopup {border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;line-height:20px;text-align:center;overflow:hidden;background-color:#FFF;position:absolute;top:0px;left:0px;z-index:9999;font-family:Verdana,Geneva,sans-serif;font-size:12px;padding:10px;min-height:15px; display:none;}
|
6 |
position: relative;
|
7 |
overflow: hidden;
|
8 |
}
|
9 |
+
.bhittani-framework .credits {
|
10 |
+
font-size: 11px;
|
11 |
+
color: #CCC;
|
12 |
+
}
|
13 |
+
.bhittani-framework .credits a {
|
14 |
+
color: #999;
|
15 |
+
}
|
16 |
.bhittani-framework .bf-wrap {
|
17 |
width: 575px;
|
18 |
}
|
71 |
.bhittani-framework .bf_head ul.bf_navs li {
|
72 |
float: left;
|
73 |
line-height: 60px;
|
74 |
+
margin-right: 0px;
|
75 |
margin-left: 5px;
|
76 |
margin-top: 20px;
|
77 |
}
|
174 |
margin-top: 35px;
|
175 |
margin-bottom: 10px;
|
176 |
}
|
177 |
+
.bf_box input, .bf_box select, .bf_box textarea {
|
178 |
padding: 10px;
|
179 |
border: 3px solid #EEE;
|
180 |
width: 200px;
|
183 |
-moz-box-sizing: border-box; /* Firefox, other Gecko */
|
184 |
box-sizing: border-box; /* Opera/IE 8+ */
|
185 |
}
|
186 |
+
.bf_box textarea {
|
187 |
+
height: 150px;
|
188 |
+
}
|
189 |
.bf_box select {
|
190 |
padding: 8px 10px;
|
191 |
height: 37px;
|
260 |
border-bottom-color: #CCC;
|
261 |
border-left-color: #CCC;
|
262 |
}
|
263 |
+
.bhittani-framework code._block {
|
264 |
+
background: #F4F4F4;
|
265 |
+
display: block;
|
266 |
+
}
|
267 |
|
268 |
|
269 |
div.bhittani-lightbox div.kkpopup {border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;line-height:20px;text-align:center;overflow:hidden;background-color:#FFF;position:absolute;top:0px;left:0px;z-index:9999;font-family:Verdana,Geneva,sans-serif;font-size:12px;padding:10px;min-height:15px; display:none;}
|
bhittani-framework/admin/js/script.js
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
var bf_admin = {
|
3 |
+
|
4 |
+
'_ajaxurl' : bhittaniplugin_admin_script.ajaxurl,
|
5 |
+
'_func' : bhittaniplugin_admin_script.func,
|
6 |
+
'_nonce' : bhittaniplugin_admin_script.nonce,
|
7 |
+
|
8 |
+
init : function(obj)
|
9 |
+
{
|
10 |
+
jQuery(document).ready( function($){
|
11 |
+
obj = $('.bhittani-framework');
|
12 |
+
$('a[rel="save-options"]', obj).click( function(){
|
13 |
+
var form = jQuery('form[name="bf_form"]', obj);
|
14 |
+
var values = form.serialize();
|
15 |
+
bf_admin.ajax_post($, values, bf_admin._func, bf_admin._nonce, 'Saving');
|
16 |
+
return false;
|
17 |
+
});
|
18 |
+
});
|
19 |
+
},
|
20 |
+
|
21 |
+
ajax_post : function($, params, action, nonce, waiting_msg)
|
22 |
+
{
|
23 |
+
$.ajax({
|
24 |
+
url: bf_admin._ajaxurl,
|
25 |
+
data: params+'&action='+action+'&_wpnonce='+nonce,
|
26 |
+
type: "post",
|
27 |
+
dataType: "json",
|
28 |
+
beforeSend: function(){
|
29 |
+
bhittani_lightbox_js.lightbox(waiting_msg, 'busy', false);
|
30 |
+
},
|
31 |
+
success: function(response){
|
32 |
+
|
33 |
+
},
|
34 |
+
complete: function(){
|
35 |
+
bhittani_lightbox_js.lightbox('Done', 'unclose', false);
|
36 |
+
setTimeout(function(){bhittani_lightbox_js.lightbox_close()}, 1000);
|
37 |
+
},
|
38 |
+
error: function(){
|
39 |
+
|
40 |
+
}
|
41 |
+
});
|
42 |
+
}
|
43 |
+
|
44 |
+
};
|
45 |
+
|
46 |
+
bf_admin.init();
|
bhittani-framework/admin/markup.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
----------------------------------------------------------------
|
22 |
------------------------------------------------------------- */
|
23 |
|
24 |
-
if(!
|
25 |
|
26 |
// Declare and define the class.
|
27 |
class BhittaniPlugin_AdminMarkup
|
21 |
----------------------------------------------------------------
|
22 |
------------------------------------------------------------- */
|
23 |
|
24 |
+
if(!class_exists('BhittaniPlugin_AdminMarkup')) :
|
25 |
|
26 |
// Declare and define the class.
|
27 |
class BhittaniPlugin_AdminMarkup
|
bhittani-framework/license.txt
ADDED
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Bhittani Framework - WordPress framework to ease the development of plugins and themes.
|
3 |
+
|
4 |
+
Copyright (C) 2012 by Kamal Khan - http://bhittani.com
|
5 |
+
|
6 |
+
This program is free software; you can redistribute it and/or modify
|
7 |
+
it under the terms of the GNU General Public License as published by
|
8 |
+
the Free Software Foundation; either version 2 of the License, or
|
9 |
+
(at your option) any later version.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
|
20 |
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
21 |
+
|
22 |
+
GNU GENERAL PUBLIC LICENSE
|
23 |
+
Version 2, June 1991
|
24 |
+
|
25 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
26 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
Everyone is permitted to copy and distribute verbatim copies
|
28 |
+
of this license document, but changing it is not allowed.
|
29 |
+
|
30 |
+
Preamble
|
31 |
+
|
32 |
+
The licenses for most software are designed to take away your
|
33 |
+
freedom to share and change it. By contrast, the GNU General Public
|
34 |
+
License is intended to guarantee your freedom to share and change free
|
35 |
+
software--to make sure the software is free for all its users. This
|
36 |
+
General Public License applies to most of the Free Software
|
37 |
+
Foundation's software and to any other program whose authors commit to
|
38 |
+
using it. (Some other Free Software Foundation software is covered by
|
39 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
40 |
+
your programs, too.
|
41 |
+
|
42 |
+
When we speak of free software, we are referring to freedom, not
|
43 |
+
price. Our General Public Licenses are designed to make sure that you
|
44 |
+
have the freedom to distribute copies of free software (and charge for
|
45 |
+
this service if you wish), that you receive source code or can get it
|
46 |
+
if you want it, that you can change the software or use pieces of it
|
47 |
+
in new free programs; and that you know you can do these things.
|
48 |
+
|
49 |
+
To protect your rights, we need to make restrictions that forbid
|
50 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
51 |
+
These restrictions translate to certain responsibilities for you if you
|
52 |
+
distribute copies of the software, or if you modify it.
|
53 |
+
|
54 |
+
For example, if you distribute copies of such a program, whether
|
55 |
+
gratis or for a fee, you must give the recipients all the rights that
|
56 |
+
you have. You must make sure that they, too, receive or can get the
|
57 |
+
source code. And you must show them these terms so they know their
|
58 |
+
rights.
|
59 |
+
|
60 |
+
We protect your rights with two steps: (1) copyright the software, and
|
61 |
+
(2) offer you this license which gives you legal permission to copy,
|
62 |
+
distribute and/or modify the software.
|
63 |
+
|
64 |
+
Also, for each author's protection and ours, we want to make certain
|
65 |
+
that everyone understands that there is no warranty for this free
|
66 |
+
software. If the software is modified by someone else and passed on, we
|
67 |
+
want its recipients to know that what they have is not the original, so
|
68 |
+
that any problems introduced by others will not reflect on the original
|
69 |
+
authors' reputations.
|
70 |
+
|
71 |
+
Finally, any free program is threatened constantly by software
|
72 |
+
patents. We wish to avoid the danger that redistributors of a free
|
73 |
+
program will individually obtain patent licenses, in effect making the
|
74 |
+
program proprietary. To prevent this, we have made it clear that any
|
75 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
76 |
+
|
77 |
+
The precise terms and conditions for copying, distribution and
|
78 |
+
modification follow.
|
79 |
+
|
80 |
+
GNU GENERAL PUBLIC LICENSE
|
81 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
82 |
+
|
83 |
+
0. This License applies to any program or other work which contains
|
84 |
+
a notice placed by the copyright holder saying it may be distributed
|
85 |
+
under the terms of this General Public License. The "Program", below,
|
86 |
+
refers to any such program or work, and a "work based on the Program"
|
87 |
+
means either the Program or any derivative work under copyright law:
|
88 |
+
that is to say, a work containing the Program or a portion of it,
|
89 |
+
either verbatim or with modifications and/or translated into another
|
90 |
+
language. (Hereinafter, translation is included without limitation in
|
91 |
+
the term "modification".) Each licensee is addressed as "you".
|
92 |
+
|
93 |
+
Activities other than copying, distribution and modification are not
|
94 |
+
covered by this License; they are outside its scope. The act of
|
95 |
+
running the Program is not restricted, and the output from the Program
|
96 |
+
is covered only if its contents constitute a work based on the
|
97 |
+
Program (independent of having been made by running the Program).
|
98 |
+
Whether that is true depends on what the Program does.
|
99 |
+
|
100 |
+
1. You may copy and distribute verbatim copies of the Program's
|
101 |
+
source code as you receive it, in any medium, provided that you
|
102 |
+
conspicuously and appropriately publish on each copy an appropriate
|
103 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
104 |
+
notices that refer to this License and to the absence of any warranty;
|
105 |
+
and give any other recipients of the Program a copy of this License
|
106 |
+
along with the Program.
|
107 |
+
|
108 |
+
You may charge a fee for the physical act of transferring a copy, and
|
109 |
+
you may at your option offer warranty protection in exchange for a fee.
|
110 |
+
|
111 |
+
2. You may modify your copy or copies of the Program or any portion
|
112 |
+
of it, thus forming a work based on the Program, and copy and
|
113 |
+
distribute such modifications or work under the terms of Section 1
|
114 |
+
above, provided that you also meet all of these conditions:
|
115 |
+
|
116 |
+
a) You must cause the modified files to carry prominent notices
|
117 |
+
stating that you changed the files and the date of any change.
|
118 |
+
|
119 |
+
b) You must cause any work that you distribute or publish, that in
|
120 |
+
whole or in part contains or is derived from the Program or any
|
121 |
+
part thereof, to be licensed as a whole at no charge to all third
|
122 |
+
parties under the terms of this License.
|
123 |
+
|
124 |
+
c) If the modified program normally reads commands interactively
|
125 |
+
when run, you must cause it, when started running for such
|
126 |
+
interactive use in the most ordinary way, to print or display an
|
127 |
+
announcement including an appropriate copyright notice and a
|
128 |
+
notice that there is no warranty (or else, saying that you provide
|
129 |
+
a warranty) and that users may redistribute the program under
|
130 |
+
these conditions, and telling the user how to view a copy of this
|
131 |
+
License. (Exception: if the Program itself is interactive but
|
132 |
+
does not normally print such an announcement, your work based on
|
133 |
+
the Program is not required to print an announcement.)
|
134 |
+
|
135 |
+
These requirements apply to the modified work as a whole. If
|
136 |
+
identifiable sections of that work are not derived from the Program,
|
137 |
+
and can be reasonably considered independent and separate works in
|
138 |
+
themselves, then this License, and its terms, do not apply to those
|
139 |
+
sections when you distribute them as separate works. But when you
|
140 |
+
distribute the same sections as part of a whole which is a work based
|
141 |
+
on the Program, the distribution of the whole must be on the terms of
|
142 |
+
this License, whose permissions for other licensees extend to the
|
143 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
144 |
+
|
145 |
+
Thus, it is not the intent of this section to claim rights or contest
|
146 |
+
your rights to work written entirely by you; rather, the intent is to
|
147 |
+
exercise the right to control the distribution of derivative or
|
148 |
+
collective works based on the Program.
|
149 |
+
|
150 |
+
In addition, mere aggregation of another work not based on the Program
|
151 |
+
with the Program (or with a work based on the Program) on a volume of
|
152 |
+
a storage or distribution medium does not bring the other work under
|
153 |
+
the scope of this License.
|
154 |
+
|
155 |
+
3. You may copy and distribute the Program (or a work based on it,
|
156 |
+
under Section 2) in object code or executable form under the terms of
|
157 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
158 |
+
|
159 |
+
a) Accompany it with the complete corresponding machine-readable
|
160 |
+
source code, which must be distributed under the terms of Sections
|
161 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
162 |
+
|
163 |
+
b) Accompany it with a written offer, valid for at least three
|
164 |
+
years, to give any third party, for a charge no more than your
|
165 |
+
cost of physically performing source distribution, a complete
|
166 |
+
machine-readable copy of the corresponding source code, to be
|
167 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
168 |
+
customarily used for software interchange; or,
|
169 |
+
|
170 |
+
c) Accompany it with the information you received as to the offer
|
171 |
+
to distribute corresponding source code. (This alternative is
|
172 |
+
allowed only for noncommercial distribution and only if you
|
173 |
+
received the program in object code or executable form with such
|
174 |
+
an offer, in accord with Subsection b above.)
|
175 |
+
|
176 |
+
The source code for a work means the preferred form of the work for
|
177 |
+
making modifications to it. For an executable work, complete source
|
178 |
+
code means all the source code for all modules it contains, plus any
|
179 |
+
associated interface definition files, plus the scripts used to
|
180 |
+
control compilation and installation of the executable. However, as a
|
181 |
+
special exception, the source code distributed need not include
|
182 |
+
anything that is normally distributed (in either source or binary
|
183 |
+
form) with the major components (compiler, kernel, and so on) of the
|
184 |
+
operating system on which the executable runs, unless that component
|
185 |
+
itself accompanies the executable.
|
186 |
+
|
187 |
+
If distribution of executable or object code is made by offering
|
188 |
+
access to copy from a designated place, then offering equivalent
|
189 |
+
access to copy the source code from the same place counts as
|
190 |
+
distribution of the source code, even though third parties are not
|
191 |
+
compelled to copy the source along with the object code.
|
192 |
+
|
193 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
194 |
+
except as expressly provided under this License. Any attempt
|
195 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
196 |
+
void, and will automatically terminate your rights under this License.
|
197 |
+
However, parties who have received copies, or rights, from you under
|
198 |
+
this License will not have their licenses terminated so long as such
|
199 |
+
parties remain in full compliance.
|
200 |
+
|
201 |
+
5. You are not required to accept this License, since you have not
|
202 |
+
signed it. However, nothing else grants you permission to modify or
|
203 |
+
distribute the Program or its derivative works. These actions are
|
204 |
+
prohibited by law if you do not accept this License. Therefore, by
|
205 |
+
modifying or distributing the Program (or any work based on the
|
206 |
+
Program), you indicate your acceptance of this License to do so, and
|
207 |
+
all its terms and conditions for copying, distributing or modifying
|
208 |
+
the Program or works based on it.
|
209 |
+
|
210 |
+
6. Each time you redistribute the Program (or any work based on the
|
211 |
+
Program), the recipient automatically receives a license from the
|
212 |
+
original licensor to copy, distribute or modify the Program subject to
|
213 |
+
these terms and conditions. You may not impose any further
|
214 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
215 |
+
You are not responsible for enforcing compliance by third parties to
|
216 |
+
this License.
|
217 |
+
|
218 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
219 |
+
infringement or for any other reason (not limited to patent issues),
|
220 |
+
conditions are imposed on you (whether by court order, agreement or
|
221 |
+
otherwise) that contradict the conditions of this License, they do not
|
222 |
+
excuse you from the conditions of this License. If you cannot
|
223 |
+
distribute so as to satisfy simultaneously your obligations under this
|
224 |
+
License and any other pertinent obligations, then as a consequence you
|
225 |
+
may not distribute the Program at all. For example, if a patent
|
226 |
+
license would not permit royalty-free redistribution of the Program by
|
227 |
+
all those who receive copies directly or indirectly through you, then
|
228 |
+
the only way you could satisfy both it and this License would be to
|
229 |
+
refrain entirely from distribution of the Program.
|
230 |
+
|
231 |
+
If any portion of this section is held invalid or unenforceable under
|
232 |
+
any particular circumstance, the balance of the section is intended to
|
233 |
+
apply and the section as a whole is intended to apply in other
|
234 |
+
circumstances.
|
235 |
+
|
236 |
+
It is not the purpose of this section to induce you to infringe any
|
237 |
+
patents or other property right claims or to contest validity of any
|
238 |
+
such claims; this section has the sole purpose of protecting the
|
239 |
+
integrity of the free software distribution system, which is
|
240 |
+
implemented by public license practices. Many people have made
|
241 |
+
generous contributions to the wide range of software distributed
|
242 |
+
through that system in reliance on consistent application of that
|
243 |
+
system; it is up to the author/donor to decide if he or she is willing
|
244 |
+
to distribute software through any other system and a licensee cannot
|
245 |
+
impose that choice.
|
246 |
+
|
247 |
+
This section is intended to make thoroughly clear what is believed to
|
248 |
+
be a consequence of the rest of this License.
|
249 |
+
|
250 |
+
8. If the distribution and/or use of the Program is restricted in
|
251 |
+
certain countries either by patents or by copyrighted interfaces, the
|
252 |
+
original copyright holder who places the Program under this License
|
253 |
+
may add an explicit geographical distribution limitation excluding
|
254 |
+
those countries, so that distribution is permitted only in or among
|
255 |
+
countries not thus excluded. In such case, this License incorporates
|
256 |
+
the limitation as if written in the body of this License.
|
257 |
+
|
258 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
259 |
+
of the General Public License from time to time. Such new versions will
|
260 |
+
be similar in spirit to the present version, but may differ in detail to
|
261 |
+
address new problems or concerns.
|
262 |
+
|
263 |
+
Each version is given a distinguishing version number. If the Program
|
264 |
+
specifies a version number of this License which applies to it and "any
|
265 |
+
later version", you have the option of following the terms and conditions
|
266 |
+
either of that version or of any later version published by the Free
|
267 |
+
Software Foundation. If the Program does not specify a version number of
|
268 |
+
this License, you may choose any version ever published by the Free Software
|
269 |
+
Foundation.
|
270 |
+
|
271 |
+
10. If you wish to incorporate parts of the Program into other free
|
272 |
+
programs whose distribution conditions are different, write to the author
|
273 |
+
to ask for permission. For software which is copyrighted by the Free
|
274 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
275 |
+
make exceptions for this. Our decision will be guided by the two goals
|
276 |
+
of preserving the free status of all derivatives of our free software and
|
277 |
+
of promoting the sharing and reuse of software generally.
|
278 |
+
|
279 |
+
NO WARRANTY
|
280 |
+
|
281 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
282 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
283 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
284 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
285 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
286 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
287 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
288 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
289 |
+
REPAIR OR CORRECTION.
|
290 |
+
|
291 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
292 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
293 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
294 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
295 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
296 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
297 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
298 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
299 |
+
POSSIBILITY OF SUCH DAMAGES.
|
300 |
+
|
301 |
+
END OF TERMS AND CONDITIONS
|
302 |
+
|
303 |
+
How to Apply These Terms to Your New Programs
|
304 |
+
|
305 |
+
If you develop a new program, and you want it to be of the greatest
|
306 |
+
possible use to the public, the best way to achieve this is to make it
|
307 |
+
free software which everyone can redistribute and change under these terms.
|
308 |
+
|
309 |
+
To do so, attach the following notices to the program. It is safest
|
310 |
+
to attach them to the start of each source file to most effectively
|
311 |
+
convey the exclusion of warranty; and each file should have at least
|
312 |
+
the "copyright" line and a pointer to where the full notice is found.
|
313 |
+
|
314 |
+
<one line to give the program's name and a brief idea of what it does.>
|
315 |
+
Copyright (C) <year> <name of author>
|
316 |
+
|
317 |
+
This program is free software; you can redistribute it and/or modify
|
318 |
+
it under the terms of the GNU General Public License as published by
|
319 |
+
the Free Software Foundation; either version 2 of the License, or
|
320 |
+
(at your option) any later version.
|
321 |
+
|
322 |
+
This program is distributed in the hope that it will be useful,
|
323 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
324 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
325 |
+
GNU General Public License for more details.
|
326 |
+
|
327 |
+
You should have received a copy of the GNU General Public License along
|
328 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
329 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
330 |
+
|
331 |
+
Also add information on how to contact you by electronic and paper mail.
|
332 |
+
|
333 |
+
If the program is interactive, make it output a short notice like this
|
334 |
+
when it starts in an interactive mode:
|
335 |
+
|
336 |
+
Gnomovision version 69, Copyright (C) year name of author
|
337 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
338 |
+
This is free software, and you are welcome to redistribute it
|
339 |
+
under certain conditions; type `show c' for details.
|
340 |
+
|
341 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
342 |
+
parts of the General Public License. Of course, the commands you use may
|
343 |
+
be called something other than `show w' and `show c'; they could even be
|
344 |
+
mouse-clicks or menu items--whatever suits your program.
|
345 |
+
|
346 |
+
You should also get your employer (if you work as a programmer) or your
|
347 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
348 |
+
necessary. Here is a sample; alter the names:
|
349 |
+
|
350 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
351 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
352 |
+
|
353 |
+
<signature of Ty Coon>, 1 April 1989
|
354 |
+
Ty Coon, President of Vice
|
355 |
+
|
356 |
+
This General Public License does not permit incorporating your program into
|
357 |
+
proprietary programs. If your program is a subroutine library, you may
|
358 |
+
consider it more useful to permit linking proprietary applications with the
|
359 |
+
library. If this is what you want to do, use the GNU Lesser General
|
360 |
+
Public License instead of this License.
|
361 |
+
|
362 |
+
WRITTEN OFFER
|
363 |
+
|
364 |
+
The source code for any program binaries or compressed scripts that are
|
365 |
+
included with Bhittani Framework can be freely obtained at the following URL:
|
366 |
+
|
367 |
+
http://wp.bhittani.com/framework/download
|
plugin.php → bhittani-framework/plugin.php
RENAMED
@@ -17,7 +17,6 @@ if(!class_exists('BhittaniPlugin')) :
|
|
17 |
global $wp_version;
|
18 |
$this->wpver = $wp_version;
|
19 |
}
|
20 |
-
|
21 |
/** function/method
|
22 |
* Usage: return file uri
|
23 |
* Arg(1): string
|
@@ -25,7 +24,7 @@ if(!class_exists('BhittaniPlugin')) :
|
|
25 |
*/
|
26 |
public static function file_uri($path)
|
27 |
{
|
28 |
-
return plugins_url($path, __FILE__);
|
29 |
}
|
30 |
/** function/method
|
31 |
* Usage: return absoulte file path
|
@@ -34,7 +33,7 @@ if(!class_exists('BhittaniPlugin')) :
|
|
34 |
*/
|
35 |
public static function file_path($path)
|
36 |
{
|
37 |
-
return dirname(__FILE__).'/'.$path;
|
38 |
}
|
39 |
/** function/method
|
40 |
* Usage: get options
|
@@ -74,7 +73,7 @@ if(!class_exists('BhittaniPlugin')) :
|
|
74 |
* Arg(6): slug (string), file (string), version (string)[optional, default: '0.1'], prerequisite (bool|array)[optional, default: false], parameters (bool|array)[optional, default: array('ajax')]
|
75 |
* Return: void
|
76 |
*/
|
77 |
-
protected function enqueue_js($slug, $file, $ver =
|
78 |
{
|
79 |
if(is_array($params) && $json)
|
80 |
{
|
@@ -84,7 +83,7 @@ if(!class_exists('BhittaniPlugin')) :
|
|
84 |
</script>
|
85 |
<?php
|
86 |
}
|
87 |
-
wp_enqueue_script($this->id.($slug?'_'.$slug:''), $file, is_array($prerequisite)?$prerequisite:array('jquery'), $ver, $footer);
|
88 |
|
89 |
if(is_array($params) && !$json)
|
90 |
wp_localize_script($this->id.($slug?'_'.$slug:''), str_replace('-','_',$this->id).'_'.$slug, $params);
|
@@ -94,12 +93,18 @@ if(!class_exists('BhittaniPlugin')) :
|
|
94 |
* Arg(3): slug (string), file (string), ver (string)[optional, default: '0.1']
|
95 |
* Return: void
|
96 |
*/
|
97 |
-
protected function enqueue_css($slug, $file, $ver =
|
98 |
{
|
99 |
-
wp_register_style( $this->id.($slug?'_'.$slug:''), $file, false, $ver );
|
100 |
wp_enqueue_style( $this->id.($slug?'_'.$slug:'') );
|
101 |
}
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
endif;
|
105 |
?>
|
17 |
global $wp_version;
|
18 |
$this->wpver = $wp_version;
|
19 |
}
|
|
|
20 |
/** function/method
|
21 |
* Usage: return file uri
|
22 |
* Arg(1): string
|
24 |
*/
|
25 |
public static function file_uri($path)
|
26 |
{
|
27 |
+
return plugins_url($path, dirname(__FILE__));
|
28 |
}
|
29 |
/** function/method
|
30 |
* Usage: return absoulte file path
|
33 |
*/
|
34 |
public static function file_path($path)
|
35 |
{
|
36 |
+
return dirname(dirname(__FILE__)).'/'.$path;
|
37 |
}
|
38 |
/** function/method
|
39 |
* Usage: get options
|
73 |
* Arg(6): slug (string), file (string), version (string)[optional, default: '0.1'], prerequisite (bool|array)[optional, default: false], parameters (bool|array)[optional, default: array('ajax')]
|
74 |
* Return: void
|
75 |
*/
|
76 |
+
protected function enqueue_js($slug, $file, $ver = false, $prerequisite=false, $params=false, $footer = false, $json = false)
|
77 |
{
|
78 |
if(is_array($params) && $json)
|
79 |
{
|
83 |
</script>
|
84 |
<?php
|
85 |
}
|
86 |
+
wp_enqueue_script($this->id.($slug?'_'.$slug:''), $file, is_array($prerequisite)?$prerequisite:array('jquery'), $ver ? $ver : $this->ver, $footer);
|
87 |
|
88 |
if(is_array($params) && !$json)
|
89 |
wp_localize_script($this->id.($slug?'_'.$slug:''), str_replace('-','_',$this->id).'_'.$slug, $params);
|
93 |
* Arg(3): slug (string), file (string), ver (string)[optional, default: '0.1']
|
94 |
* Return: void
|
95 |
*/
|
96 |
+
protected function enqueue_css($slug, $file, $ver = false)
|
97 |
{
|
98 |
+
wp_register_style( $this->id.($slug?'_'.$slug:''), $file, false, $ver ? $ver : $this->ver );
|
99 |
wp_enqueue_style( $this->id.($slug?'_'.$slug:'') );
|
100 |
}
|
101 |
}
|
102 |
+
|
103 |
+
if(is_admin())
|
104 |
+
{
|
105 |
+
require_once 'admin/markup.class.php';
|
106 |
+
require_once 'admin/admin.class.php';
|
107 |
+
}
|
108 |
|
109 |
endif;
|
110 |
?>
|
css.css
CHANGED
@@ -52,3 +52,6 @@
|
|
52 |
padding: 3px;
|
53 |
font-family: Arial, Helvetica, sans-serif;
|
54 |
}
|
|
|
|
|
|
52 |
padding: 3px;
|
53 |
font-family: Arial, Helvetica, sans-serif;
|
54 |
}
|
55 |
+
.kk-star-ratings .kksr-legend .kksr-title {
|
56 |
+
display: none;
|
57 |
+
}
|
index.php
CHANGED
@@ -4,22 +4,13 @@
|
|
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.
|
8 |
Author: Kamal Khan
|
9 |
Author URI: http://bhittani.com
|
10 |
License: GPLv2 or later
|
11 |
*/
|
12 |
|
13 |
-
|
14 |
-
define('BHITTANI_PLUGIN_KKSTARRATINGS_ID', 'bhittani_plugin_kksr');
|
15 |
-
if(!defined('BHITTANI_PLUGIN_KKSTARRATINGS_NICK'))
|
16 |
-
define('BHITTANI_PLUGIN_KKSTARRATINGS_NICK', 'kk Star Ratings');
|
17 |
-
if(!defined('BHITTANI_PLUGIN_KKSTARRATINGS_VER'))
|
18 |
-
define('BHITTANI_PLUGIN_KKSTARRATINGS_VER', '2.0');
|
19 |
-
|
20 |
-
require_once 'plugin.php';
|
21 |
-
require_once 'bhittani-framework/admin/markup.class.php';
|
22 |
-
require_once 'bhittani-framework/admin/admin.class.php';
|
23 |
|
24 |
if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
25 |
|
@@ -39,6 +30,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
39 |
$nonce = wp_create_nonce($this->id);
|
40 |
$Params = array();
|
41 |
$Params['nonce'] = $nonce; //for security
|
|
|
42 |
$Params['ajaxurl'] = admin_url('admin-ajax.php');
|
43 |
$Params['func'] = 'kksr_ajax';
|
44 |
$Params['msg'] = parent::get_options('kksr_init_msg');
|
@@ -46,8 +38,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
46 |
$Params['thankyou'] = parent::get_options('kksr_js_thankyou');
|
47 |
$Params['error_msg'] = parent::get_options('kksr_js_error');
|
48 |
$Params['tooltip'] = parent::get_options('kksr_tooltip');
|
49 |
-
$
|
50 |
-
$Params['tooltips'] = $Tooltips;
|
51 |
$this->enqueue_js('js', parent::file_uri('js.js'), $this->ver, array('jquery'), $Params, false, true);
|
52 |
}
|
53 |
/** function/method
|
@@ -59,11 +50,9 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
59 |
{
|
60 |
$nonce = wp_create_nonce($this->id);
|
61 |
$Params = array();
|
62 |
-
$Params['nonce'] = $nonce;
|
63 |
-
$Params['ajaxurl'] = admin_url('admin-ajax.php');
|
64 |
-
$Params['func'] = 'kksr_admin_ajax';
|
65 |
$Params['func_reset'] = 'kksr_admin_reset_ajax';
|
66 |
-
$this->enqueue_js('js_admin', parent::file_uri('js_admin.js'), $this->ver, array('jquery'), $Params);
|
67 |
}
|
68 |
/** function/method
|
69 |
* Usage: hook css
|
@@ -138,7 +127,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
138 |
$Options['kksr_init_msg'] = isset($Old_plugin['init_msg']) ? $Old_plugin['init_msg'] : $opt_init_msg;
|
139 |
$Options['kksr_column'] = isset($Old_plugin['column']) ? $Old_plugin['column'] : $opt_column;
|
140 |
|
141 |
-
// Upgrade from old plugin(<2.0) to renewed plugin(2.0)
|
142 |
if($Old_plugin)
|
143 |
{
|
144 |
// Delete old options
|
@@ -199,6 +188,11 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
199 |
$Options['kksr_tooltips'] = base64_encode(serialize($Opt_tooltips));
|
200 |
parent::update_options($Options);
|
201 |
}
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
/** function/method
|
204 |
* Usage: helper for hooking (registering) the menu
|
@@ -217,6 +211,15 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
217 |
parent::file_uri('icon.png')
|
218 |
);
|
219 |
// Create images menu tab
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
add_submenu_page(
|
221 |
$this->id.'_settings',
|
222 |
$this->nick.' - Stars',
|
@@ -246,8 +249,8 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
246 |
// Create info menu tab
|
247 |
add_submenu_page(
|
248 |
$this->id.'_settings',
|
249 |
-
$this->nick.' -
|
250 |
-
'
|
251 |
'manage_options',
|
252 |
$this->id.'_settings_info',
|
253 |
array(&$this, 'options_info')
|
@@ -264,9 +267,18 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
264 |
{
|
265 |
wp_die( __('You do not have sufficient permissions to access this page.') );
|
266 |
}
|
|
|
267 |
$h3 = 'kk Star Ratings';
|
268 |
-
$
|
269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
include parent::file_path('admin.php');
|
271 |
}
|
272 |
/** function/method
|
@@ -314,24 +326,6 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
314 |
{
|
315 |
$this->options_page('info');
|
316 |
}
|
317 |
-
public function kksr_admin_ajax()
|
318 |
-
{
|
319 |
-
header('content-type: application/json; charset=utf-8');
|
320 |
-
check_ajax_referer($this->id);
|
321 |
-
|
322 |
-
$Options = $_POST;
|
323 |
-
$Options['kksr_tooltips'] = base64_encode(serialize($_POST['kksr_tooltips']));
|
324 |
-
|
325 |
-
unset($Options['_wpnonce']);
|
326 |
-
unset($Options['action']);
|
327 |
-
|
328 |
-
parent::update_options($Options);
|
329 |
-
|
330 |
-
$Response = array();
|
331 |
-
$Response['success'] = 'true';
|
332 |
-
echo json_encode($Response);
|
333 |
-
die();
|
334 |
-
}
|
335 |
public function kksr_admin_reset_ajax()
|
336 |
{
|
337 |
header('content-type: application/json; charset=utf-8');
|
@@ -378,6 +372,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
378 |
$Response['legend'] = parent::get_options('kksr_init_msg');
|
379 |
$Response['disable'] = 'false';
|
380 |
$Response['fuel'] = '0';
|
|
|
381 |
}
|
382 |
else
|
383 |
{
|
@@ -399,6 +394,11 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
399 |
update_post_meta($pid, '_kksr_ips', $ips);
|
400 |
update_post_meta($pid, '_kksr_avg', $avg);
|
401 |
$Response['disable'] = parent::get_options('kksr_unique') ? 'true' : 'false';
|
|
|
|
|
|
|
|
|
|
|
402 |
}
|
403 |
$legend = parent::get_options('kksr_legend');
|
404 |
$legend = str_replace('[total]', $ncasts, $legend);
|
@@ -407,6 +407,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
407 |
$Response['legend'] = str_replace('[per]',$per.'%', $legend);
|
408 |
$Response['fuel'] = $per;
|
409 |
}
|
|
|
410 |
$Response['success'] = 'true';
|
411 |
echo json_encode($Response);
|
412 |
die();
|
@@ -425,8 +426,9 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
425 |
}
|
426 |
}
|
427 |
$pos = parent::get_options('kksr_position');
|
|
|
428 |
$markup = '
|
429 |
-
<div class="kk-star-ratings '.($disabled ? 'disabled ' : ' ').$pos.($pos=='top-right'||$pos=='bottom-right' ? ' rgt' : ' lft').'" data-id="'.$id.'">
|
430 |
<div class="kksr-stars kksr-star gray">
|
431 |
<div class="kksr-fuel kksr-star '.($disabled ? 'orange' : 'yellow').'" style="width:0%;"></div>
|
432 |
<!-- kksr-fuel -->';
|
@@ -438,35 +440,17 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
438 |
$markup .='
|
439 |
</div>
|
440 |
<!-- kksr-stars -->
|
441 |
-
<div class="kksr-legend"
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
<!-- kksr-legend -->
|
443 |
</div>
|
444 |
<!-- kk-star-ratings -->
|
445 |
';
|
446 |
-
if(is_single())
|
447 |
-
{
|
448 |
-
$votes = get_post_meta($id, '_kksr_casts', true);
|
449 |
-
if($votes)
|
450 |
-
{
|
451 |
-
$title = get_the_title();
|
452 |
-
$avg = get_post_meta($id, '_kksr_avg', true);
|
453 |
-
$avg = $avg*($total_stars/5);
|
454 |
-
$best = $total_stars;
|
455 |
-
$markup.= '<span style="display:none;">
|
456 |
-
<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review-aggregate">
|
457 |
-
<span property="v:itemreviewed">'.$title.'</span>
|
458 |
-
<span rel="v:rating">
|
459 |
-
<span typeof="v:Rating">
|
460 |
-
<span property="v:average">'.$avg.'</span>
|
461 |
-
out of
|
462 |
-
<span property="v:best">'.$best.'</span>
|
463 |
-
</span>
|
464 |
-
</span>
|
465 |
-
based on
|
466 |
-
<span property="v:votes">'.$votes.'</span> ratings.
|
467 |
-
</div></span>';
|
468 |
-
}
|
469 |
-
}
|
470 |
$markup .= parent::get_options('kksr_clear') ? '<br clear="both" />' : '';
|
471 |
return $markup;
|
472 |
}
|
@@ -540,7 +524,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
540 |
$Columns['kk_star_ratings'] = 'Ratings';
|
541 |
return $Columns;
|
542 |
}
|
543 |
-
function add_row($Columns, $id)
|
544 |
{
|
545 |
$total_stars = parent::get_options('kksr_stars');
|
546 |
if(parent::get_options('kksr_column'))
|
@@ -560,37 +544,80 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
560 |
}
|
561 |
}
|
562 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
}
|
564 |
|
565 |
-
|
566 |
-
|
567 |
-
$kkStarRatings_obj = new BhittaniPlugin_kkStarRatings(
|
568 |
-
BHITTANI_PLUGIN_KKSTARRATINGS_ID,
|
569 |
-
BHITTANI_PLUGIN_KKSTARRATINGS_NICK,
|
570 |
-
BHITTANI_PLUGIN_KKSTARRATINGS_VER
|
571 |
-
);
|
572 |
|
|
|
573 |
register_activation_hook(__FILE__, array($kkStarRatings_obj, 'activate'));
|
|
|
|
|
574 |
add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'js'));
|
575 |
add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'css'));
|
576 |
add_action('wp_head', array($kkStarRatings_obj, 'css_custom'));
|
577 |
add_action('admin_enqueue_scripts', array($kkStarRatings_obj, 'js_admin'));
|
|
|
|
|
578 |
add_action('admin_menu', array($kkStarRatings_obj, 'menu'));
|
579 |
|
580 |
-
|
581 |
add_action('wp_ajax_kksr_admin_reset_ajax', array($kkStarRatings_obj, 'kksr_admin_reset_ajax'));
|
582 |
add_action('wp_ajax_kksr_ajax', array($kkStarRatings_obj, 'kksr_ajax'));
|
583 |
add_action('wp_ajax_nopriv_kksr_ajax', array($kkStarRatings_obj, 'kksr_ajax'));
|
584 |
|
|
|
585 |
add_filter('the_content', array($kkStarRatings_obj, 'filter'));
|
586 |
add_shortcode('kkratings', array($kkStarRatings_obj, 'manual'));
|
587 |
add_shortcode('kkstarratings', array($kkStarRatings_obj, 'manual'));
|
|
|
|
|
|
|
588 |
|
|
|
589 |
add_filter( 'manage_posts_columns', array($kkStarRatings_obj, 'add_column') );
|
590 |
add_filter( 'manage_pages_columns', array($kkStarRatings_obj, 'add_column') );
|
591 |
add_filter( 'manage_posts_custom_column', array($kkStarRatings_obj, 'add_row'), 10, 2 );
|
592 |
add_filter( 'manage_pages_custom_column', array($kkStarRatings_obj, 'add_row'), 10, 2 );
|
593 |
|
|
|
594 |
if(!function_exists('kk_star_ratings'))
|
595 |
{
|
596 |
function kk_star_ratings($pid=false)
|
@@ -608,6 +635,7 @@ if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
|
608 |
}
|
609 |
}
|
610 |
|
|
|
611 |
require_once 'widget.php';
|
612 |
|
613 |
endif;
|
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.1
|
8 |
Author: Kamal Khan
|
9 |
Author URI: http://bhittani.com
|
10 |
License: GPLv2 or later
|
11 |
*/
|
12 |
|
13 |
+
require_once 'bhittani-framework/plugin.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
if(!class_exists('BhittaniPlugin_kkStarRatings')) :
|
16 |
|
30 |
$nonce = wp_create_nonce($this->id);
|
31 |
$Params = array();
|
32 |
$Params['nonce'] = $nonce; //for security
|
33 |
+
$Params['grs'] = parent::get_options('kksr_grs') ? true : false;
|
34 |
$Params['ajaxurl'] = admin_url('admin-ajax.php');
|
35 |
$Params['func'] = 'kksr_ajax';
|
36 |
$Params['msg'] = parent::get_options('kksr_init_msg');
|
38 |
$Params['thankyou'] = parent::get_options('kksr_js_thankyou');
|
39 |
$Params['error_msg'] = parent::get_options('kksr_js_error');
|
40 |
$Params['tooltip'] = parent::get_options('kksr_tooltip');
|
41 |
+
$Params['tooltips'] = parent::get_options('kksr_tooltips');
|
|
|
42 |
$this->enqueue_js('js', parent::file_uri('js.js'), $this->ver, array('jquery'), $Params, false, true);
|
43 |
}
|
44 |
/** function/method
|
50 |
{
|
51 |
$nonce = wp_create_nonce($this->id);
|
52 |
$Params = array();
|
53 |
+
$Params['nonce'] = $nonce;
|
|
|
|
|
54 |
$Params['func_reset'] = 'kksr_admin_reset_ajax';
|
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
|
127 |
$Options['kksr_init_msg'] = isset($Old_plugin['init_msg']) ? $Old_plugin['init_msg'] : $opt_init_msg;
|
128 |
$Options['kksr_column'] = isset($Old_plugin['column']) ? $Old_plugin['column'] : $opt_column;
|
129 |
|
130 |
+
// Upgrade from old plugin(<2.0) to renewed plugin(>=2.0)
|
131 |
if($Old_plugin)
|
132 |
{
|
133 |
// Delete old options
|
188 |
$Options['kksr_tooltips'] = base64_encode(serialize($Opt_tooltips));
|
189 |
parent::update_options($Options);
|
190 |
}
|
191 |
+
if(parent::get_options('kksr_ver')!='2.1')
|
192 |
+
{
|
193 |
+
parent::update_options(array('kksr_grs'=>1));
|
194 |
+
}
|
195 |
+
parent::update_options(array('kksr_ver'=>2.1));
|
196 |
}
|
197 |
/** function/method
|
198 |
* Usage: helper for hooking (registering) the menu
|
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',
|
218 |
+
'manage_options',
|
219 |
+
$this->id.'_settings',
|
220 |
+
array(&$this, 'options_general')
|
221 |
+
);
|
222 |
+
// Create images menu tab
|
223 |
add_submenu_page(
|
224 |
$this->id.'_settings',
|
225 |
$this->nick.' - Stars',
|
249 |
// Create info menu tab
|
250 |
add_submenu_page(
|
251 |
$this->id.'_settings',
|
252 |
+
$this->nick.' - Help',
|
253 |
+
'Help',
|
254 |
'manage_options',
|
255 |
$this->id.'_settings_info',
|
256 |
array(&$this, 'options_info')
|
267 |
{
|
268 |
wp_die( __('You do not have sufficient permissions to access this page.') );
|
269 |
}
|
270 |
+
$sidebar = true;
|
271 |
$h3 = 'kk Star Ratings';
|
272 |
+
$Url = array(
|
273 |
+
array(
|
274 |
+
'title' => 'Docs',
|
275 |
+
'link' => 'http://wp.bhittani.com/plugins/kk-star-ratings/docs'
|
276 |
+
),
|
277 |
+
array(
|
278 |
+
'title' => 'Changelog',
|
279 |
+
'link' => 'http://wp.bhittani.com/plugins/kk-star-ratings/changelog'
|
280 |
+
)
|
281 |
+
);
|
282 |
include parent::file_path('admin.php');
|
283 |
}
|
284 |
/** function/method
|
326 |
{
|
327 |
$this->options_page('info');
|
328 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
public function kksr_admin_reset_ajax()
|
330 |
{
|
331 |
header('content-type: application/json; charset=utf-8');
|
372 |
$Response['legend'] = parent::get_options('kksr_init_msg');
|
373 |
$Response['disable'] = 'false';
|
374 |
$Response['fuel'] = '0';
|
375 |
+
do_action('kksr_init', $pid, false, false);
|
376 |
}
|
377 |
else
|
378 |
{
|
394 |
update_post_meta($pid, '_kksr_ips', $ips);
|
395 |
update_post_meta($pid, '_kksr_avg', $avg);
|
396 |
$Response['disable'] = parent::get_options('kksr_unique') ? 'true' : 'false';
|
397 |
+
do_action('kksr_rate', $pid, $stars, $ip);
|
398 |
+
}
|
399 |
+
else
|
400 |
+
{
|
401 |
+
do_action('kksr_init', $pid, ($avg*($total_stars/5)).'/'.$total_stars, $ncasts);
|
402 |
}
|
403 |
$legend = parent::get_options('kksr_legend');
|
404 |
$legend = str_replace('[total]', $ncasts, $legend);
|
407 |
$Response['legend'] = str_replace('[per]',$per.'%', $legend);
|
408 |
$Response['fuel'] = $per;
|
409 |
}
|
410 |
+
|
411 |
$Response['success'] = 'true';
|
412 |
echo json_encode($Response);
|
413 |
die();
|
426 |
}
|
427 |
}
|
428 |
$pos = parent::get_options('kksr_position');
|
429 |
+
|
430 |
$markup = '
|
431 |
+
<div class="kk-star-ratings '.($disabled || (is_archive() && parent::get_options('kksr_disable_in_archives')) ? 'disabled ' : ' ').$pos.($pos=='top-right'||$pos=='bottom-right' ? ' rgt' : ' lft').'" data-id="'.$id.'">
|
432 |
<div class="kksr-stars kksr-star gray">
|
433 |
<div class="kksr-fuel kksr-star '.($disabled ? 'orange' : 'yellow').'" style="width:0%;"></div>
|
434 |
<!-- kksr-fuel -->';
|
440 |
$markup .='
|
441 |
</div>
|
442 |
<!-- kksr-stars -->
|
443 |
+
<div class="kksr-legend">';
|
444 |
+
if(parent::get_options('kksr_grs'))
|
445 |
+
{
|
446 |
+
$markup .= apply_filters('kksr_legend', parent::get_options('kksr_legend'), $id);
|
447 |
+
}
|
448 |
+
$markup .=
|
449 |
+
'</div>
|
450 |
<!-- kksr-legend -->
|
451 |
</div>
|
452 |
<!-- kk-star-ratings -->
|
453 |
';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
$markup .= parent::get_options('kksr_clear') ? '<br clear="both" />' : '';
|
455 |
return $markup;
|
456 |
}
|
524 |
$Columns['kk_star_ratings'] = 'Ratings';
|
525 |
return $Columns;
|
526 |
}
|
527 |
+
public function add_row($Columns, $id)
|
528 |
{
|
529 |
$total_stars = parent::get_options('kksr_stars');
|
530 |
if(parent::get_options('kksr_column'))
|
544 |
}
|
545 |
}
|
546 |
}
|
547 |
+
public function grs_legend($legend, $id)
|
548 |
+
{
|
549 |
+
if(parent::get_options('kksr_grs'))
|
550 |
+
{
|
551 |
+
$title = get_the_title($id);
|
552 |
+
|
553 |
+
$best = parent::get_options('kksr_stars');
|
554 |
+
$score = get_post_meta($id, '_kksr_ratings', true) ? get_post_meta($id, '_kksr_ratings', true) : 0;
|
555 |
+
|
556 |
+
if($score)
|
557 |
+
{
|
558 |
+
$votes = get_post_meta($id, '_kksr_casts', true) ? get_post_meta($id, '_kksr_casts', true) : 0;
|
559 |
+
$avg = $score ? round($score/$votes,1) : 0;
|
560 |
+
$per = $score ? round((($score/$votes)/5)*100) : 0;
|
561 |
+
|
562 |
+
$leg = str_replace('[total]', '<span property="v:votes">'.$votes.'</span>', $legend);
|
563 |
+
$leg = str_replace('[avg]', '<span property="v:average">'.$avg.'</span>/<span property="v:best">'.$best.'</span>', $leg);
|
564 |
+
$leg = str_replace('[per]',$per.'%', $leg);
|
565 |
+
$leg = str_replace('[s]', $votes==1?'':'s', $leg);
|
566 |
+
|
567 |
+
$snippet = '<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review-aggregate">';
|
568 |
+
$snippet .= '<span property="v:itemreviewed" class="kksr-title">' . $title . '</span>';
|
569 |
+
$snippet .= '<span rel="v:rating">';
|
570 |
+
$snippet .= ' <span typeof="v:Rating">';
|
571 |
+
$snippet .= $leg;
|
572 |
+
$snippet .= ' </span>';
|
573 |
+
$snippet .= '</span>';
|
574 |
+
$snippet .= '</div>';
|
575 |
+
}
|
576 |
+
else
|
577 |
+
{
|
578 |
+
$snippet = parent::get_options('kksr_init_msg');
|
579 |
+
}
|
580 |
+
|
581 |
+
return $snippet;
|
582 |
+
}
|
583 |
+
return $legend;
|
584 |
+
}
|
585 |
}
|
586 |
|
587 |
+
$kkStarRatings_obj = new BhittaniPlugin_kkStarRatings('bhittani_plugin_kksr', 'kk Star Ratings', '2.1');
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
|
589 |
+
// Setup
|
590 |
register_activation_hook(__FILE__, array($kkStarRatings_obj, 'activate'));
|
591 |
+
|
592 |
+
// Scripts
|
593 |
add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'js'));
|
594 |
add_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'css'));
|
595 |
add_action('wp_head', array($kkStarRatings_obj, 'css_custom'));
|
596 |
add_action('admin_enqueue_scripts', array($kkStarRatings_obj, 'js_admin'));
|
597 |
+
|
598 |
+
// Menu
|
599 |
add_action('admin_menu', array($kkStarRatings_obj, 'menu'));
|
600 |
|
601 |
+
// AJAX
|
602 |
add_action('wp_ajax_kksr_admin_reset_ajax', array($kkStarRatings_obj, 'kksr_admin_reset_ajax'));
|
603 |
add_action('wp_ajax_kksr_ajax', array($kkStarRatings_obj, 'kksr_ajax'));
|
604 |
add_action('wp_ajax_nopriv_kksr_ajax', array($kkStarRatings_obj, 'kksr_ajax'));
|
605 |
|
606 |
+
// Main Hooks
|
607 |
add_filter('the_content', array($kkStarRatings_obj, 'filter'));
|
608 |
add_shortcode('kkratings', array($kkStarRatings_obj, 'manual'));
|
609 |
add_shortcode('kkstarratings', array($kkStarRatings_obj, 'manual'));
|
610 |
+
|
611 |
+
// Google Rich Snippets
|
612 |
+
add_filter('kksr_legend', array($kkStarRatings_obj, 'grs_legend'), 1, 2);
|
613 |
|
614 |
+
// Posts/Pages Column
|
615 |
add_filter( 'manage_posts_columns', array($kkStarRatings_obj, 'add_column') );
|
616 |
add_filter( 'manage_pages_columns', array($kkStarRatings_obj, 'add_column') );
|
617 |
add_filter( 'manage_posts_custom_column', array($kkStarRatings_obj, 'add_row'), 10, 2 );
|
618 |
add_filter( 'manage_pages_custom_column', array($kkStarRatings_obj, 'add_row'), 10, 2 );
|
619 |
|
620 |
+
// For use in themes
|
621 |
if(!function_exists('kk_star_ratings'))
|
622 |
{
|
623 |
function kk_star_ratings($pid=false)
|
635 |
}
|
636 |
}
|
637 |
|
638 |
+
require_once 'shortcode/shortcode.php';
|
639 |
require_once 'widget.php';
|
640 |
|
641 |
endif;
|
js.js
CHANGED
@@ -7,6 +7,7 @@
|
|
7 |
'ajaxurl' : null,
|
8 |
'nonce' : null,
|
9 |
'func' : null,
|
|
|
10 |
'tooltip' : true,
|
11 |
'tooltips' : {
|
12 |
"0":{"tip": "Poor", "color": "red"},
|
@@ -37,7 +38,6 @@
|
|
37 |
var fuel = $('.kksr-fuel', obj).css('width');
|
38 |
$('.kksr-stars a', obj).hover( function(){
|
39 |
var stars = $(this).attr('href').split('#')[1];
|
40 |
-
//alert(stars);
|
41 |
if(kksr_settings.tooltip!=0)
|
42 |
{
|
43 |
if(kksr_settings.tooltips[stars-1]!=null)
|
@@ -73,7 +73,7 @@
|
|
73 |
}
|
74 |
}
|
75 |
|
76 |
-
function kksr_update(obj, per, legend, disable)
|
77 |
{
|
78 |
if(disable=='true')
|
79 |
{
|
@@ -85,9 +85,16 @@
|
|
85 |
obj.addClass('disabled');
|
86 |
$('.kksr-stars a', obj).unbind('hover');
|
87 |
}
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
kksr_animate(obj);
|
90 |
-
}
|
91 |
});
|
92 |
}
|
93 |
|
@@ -98,12 +105,12 @@
|
|
98 |
var legend = $('.kksr-legend', obj).html();
|
99 |
var fuel = $('.kksr-fuel', obj).css('width');
|
100 |
|
101 |
-
kksr_fetch(obj, stars, fuel, legend);
|
102 |
|
103 |
return false;
|
104 |
}
|
105 |
|
106 |
-
function kksr_fetch(obj, stars, fallback_fuel, fallback_legend)
|
107 |
{
|
108 |
$.ajax({
|
109 |
url: kksr_settings.ajaxurl,
|
@@ -122,28 +129,27 @@
|
|
122 |
success: function(response){
|
123 |
if(response.success=='true')
|
124 |
{
|
125 |
-
kksr_update(obj, response.fuel+'%', response.legend, response.disable);
|
126 |
}
|
127 |
else
|
128 |
{
|
129 |
-
kksr_update(obj, fallback_fuel, fallback_legend, false);
|
130 |
}
|
131 |
},
|
132 |
complete: function(){
|
133 |
|
134 |
},
|
135 |
error: function(e){
|
136 |
-
console.log(e);
|
137 |
$('.kksr-legend', obj).fadeOut('fast', function(){
|
138 |
$('.kksr-legend', obj).html('<span style="color: red">'+kksr_settings.error_msg+'</span>');
|
139 |
}).fadeIn('slow', function(){
|
140 |
-
kksr_update(obj, fallback_fuel, fallback_legend, false);
|
141 |
});
|
142 |
}
|
143 |
});
|
144 |
}
|
145 |
|
146 |
-
kksr_fetch(obj, 0, '0%', kksr_settings.msg);
|
147 |
|
148 |
});
|
149 |
|
@@ -157,6 +163,7 @@ jQuery(document).ready( function($){
|
|
157 |
'ajaxurl' : bhittani_plugin_kksr_js.ajaxurl,
|
158 |
'func' : bhittani_plugin_kksr_js.func,
|
159 |
'nonce' : bhittani_plugin_kksr_js.nonce,
|
|
|
160 |
'tooltip' : bhittani_plugin_kksr_js.tooltip,
|
161 |
'tooltips' : bhittani_plugin_kksr_js.tooltips,
|
162 |
'msg' : bhittani_plugin_kksr_js.msg,
|
7 |
'ajaxurl' : null,
|
8 |
'nonce' : null,
|
9 |
'func' : null,
|
10 |
+
'grs' : false,
|
11 |
'tooltip' : true,
|
12 |
'tooltips' : {
|
13 |
"0":{"tip": "Poor", "color": "red"},
|
38 |
var fuel = $('.kksr-fuel', obj).css('width');
|
39 |
$('.kksr-stars a', obj).hover( function(){
|
40 |
var stars = $(this).attr('href').split('#')[1];
|
|
|
41 |
if(kksr_settings.tooltip!=0)
|
42 |
{
|
43 |
if(kksr_settings.tooltips[stars-1]!=null)
|
73 |
}
|
74 |
}
|
75 |
|
76 |
+
function kksr_update(obj, per, legend, disable, is_fetch)
|
77 |
{
|
78 |
if(disable=='true')
|
79 |
{
|
85 |
obj.addClass('disabled');
|
86 |
$('.kksr-stars a', obj).unbind('hover');
|
87 |
}
|
88 |
+
if(!kksr_settings.grs || !is_fetch)
|
89 |
+
{
|
90 |
+
$('.kksr-legend', obj).stop(true,true).hide().html(legend?legend:kksr_settings.msg).fadeIn('slow', function(){
|
91 |
+
kksr_animate(obj);
|
92 |
+
});
|
93 |
+
}
|
94 |
+
else
|
95 |
+
{
|
96 |
kksr_animate(obj);
|
97 |
+
}
|
98 |
});
|
99 |
}
|
100 |
|
105 |
var legend = $('.kksr-legend', obj).html();
|
106 |
var fuel = $('.kksr-fuel', obj).css('width');
|
107 |
|
108 |
+
kksr_fetch(obj, stars, fuel, legend, false);
|
109 |
|
110 |
return false;
|
111 |
}
|
112 |
|
113 |
+
function kksr_fetch(obj, stars, fallback_fuel, fallback_legend, is_fetch)
|
114 |
{
|
115 |
$.ajax({
|
116 |
url: kksr_settings.ajaxurl,
|
129 |
success: function(response){
|
130 |
if(response.success=='true')
|
131 |
{
|
132 |
+
kksr_update(obj, response.fuel+'%', response.legend, response.disable, is_fetch);
|
133 |
}
|
134 |
else
|
135 |
{
|
136 |
+
kksr_update(obj, fallback_fuel, fallback_legend, false, is_fetch);
|
137 |
}
|
138 |
},
|
139 |
complete: function(){
|
140 |
|
141 |
},
|
142 |
error: function(e){
|
|
|
143 |
$('.kksr-legend', obj).fadeOut('fast', function(){
|
144 |
$('.kksr-legend', obj).html('<span style="color: red">'+kksr_settings.error_msg+'</span>');
|
145 |
}).fadeIn('slow', function(){
|
146 |
+
kksr_update(obj, fallback_fuel, fallback_legend, false, is_fetch);
|
147 |
});
|
148 |
}
|
149 |
});
|
150 |
}
|
151 |
|
152 |
+
kksr_fetch(obj, 0, '0%', kksr_settings.msg, true);
|
153 |
|
154 |
});
|
155 |
|
163 |
'ajaxurl' : bhittani_plugin_kksr_js.ajaxurl,
|
164 |
'func' : bhittani_plugin_kksr_js.func,
|
165 |
'nonce' : bhittani_plugin_kksr_js.nonce,
|
166 |
+
'grs' : bhittani_plugin_kksr_js.grs,
|
167 |
'tooltip' : bhittani_plugin_kksr_js.tooltip,
|
168 |
'tooltips' : bhittani_plugin_kksr_js.tooltips,
|
169 |
'msg' : bhittani_plugin_kksr_js.msg,
|
js_admin.js
CHANGED
@@ -1,84 +1,41 @@
|
|
1 |
|
|
|
|
|
2 |
(function($){
|
3 |
-
|
4 |
-
$.fn.kkstarratings_admin = function(options) {
|
5 |
-
|
6 |
-
kksr_admin_settings = {
|
7 |
-
'ajaxurl' : null,
|
8 |
-
'func' : null,
|
9 |
-
'nonce' : null
|
10 |
-
};
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
var obj = $(this);
|
19 |
-
|
20 |
-
function ajax_post(params, waiting_msg)
|
21 |
-
{
|
22 |
-
$.ajax({
|
23 |
-
url: kksr_admin_settings.ajaxurl,
|
24 |
-
data: params,
|
25 |
-
type: "post",
|
26 |
-
dataType: "json",
|
27 |
-
beforeSend: function(){
|
28 |
-
bhittani_lightbox_js.lightbox(waiting_msg, 'busy', false);
|
29 |
-
},
|
30 |
-
success: function(response){
|
31 |
-
|
32 |
-
},
|
33 |
-
complete: function(){
|
34 |
-
bhittani_lightbox_js.lightbox('Done', 'unclose', false);
|
35 |
-
setTimeout(function(){bhittani_lightbox_js.lightbox_close()}, 1000);
|
36 |
-
},
|
37 |
-
error: function(){
|
38 |
-
|
39 |
-
}
|
40 |
-
});
|
41 |
-
}
|
42 |
-
|
43 |
-
$('a[rel="save-options"]', obj).click( function(){
|
44 |
-
var form = jQuery('form[name="bf_form"]', obj);
|
45 |
-
var values = form.serialize();
|
46 |
-
var params = values+'&action='+kksr_admin_settings.func+'&_wpnonce='+kksr_admin_settings.nonce;
|
47 |
-
ajax_post(params, 'Saving');
|
48 |
-
return false;
|
49 |
});
|
50 |
-
|
|
|
|
|
|
|
51 |
$('a[rel="kksr-reset"]', obj).click( function(){
|
52 |
var form = jQuery('form[name="bf_form"]', obj);
|
53 |
var values = form.serialize();
|
54 |
-
|
55 |
-
ajax_post(params, 'Flushing');
|
56 |
$('._kksr_reset._on', obj).parent().fadeOut('slow');
|
57 |
return false;
|
58 |
});
|
59 |
-
|
60 |
$('a[rel="kksr-reset-all"]', obj).click( function(){
|
61 |
$('._kksr_reset', obj).removeClass('_off').addClass('_on').val('1');
|
62 |
return false;
|
63 |
});
|
64 |
-
|
65 |
$('a[rel="kksr-reset-none"]', obj).click( function(){
|
66 |
$('._kksr_reset', obj).removeClass('_on').addClass('_off').val('0');
|
67 |
return false;
|
68 |
});
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
73 |
|
74 |
})( jQuery );
|
75 |
|
76 |
-
|
77 |
-
jQuery(document).ready( function($){
|
78 |
-
$('.bhittani-framework').kkstarratings_admin({
|
79 |
-
'ajaxurl' : bhittani_plugin_kksr_js_admin.ajaxurl,
|
80 |
-
'func' : bhittani_plugin_kksr_js_admin.func,
|
81 |
-
'func_reset' : bhittani_plugin_kksr_js_admin.func_reset,
|
82 |
-
'nonce' : bhittani_plugin_kksr_js_admin.nonce,
|
83 |
-
});
|
84 |
-
});
|
1 |
|
2 |
+
// Object bf_admin is available to use
|
3 |
+
|
4 |
(function($){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
var bf_admin_plugin_kksr = {
|
7 |
|
8 |
+
init : function()
|
9 |
+
{
|
10 |
+
jQuery(document).ready( function($){
|
11 |
+
bf_admin_plugin_kksr.reset_ratings($('.bhittani-framework'), bhittani_plugin_kksr_js_admin.func_reset, bhittani_plugin_kksr_js_admin.nonce)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
});
|
13 |
+
},
|
14 |
+
|
15 |
+
reset_ratings : function(obj, func, nonce)
|
16 |
+
{
|
17 |
$('a[rel="kksr-reset"]', obj).click( function(){
|
18 |
var form = jQuery('form[name="bf_form"]', obj);
|
19 |
var values = form.serialize();
|
20 |
+
bf_admin.ajax_post($, values, func, nonce, 'Flushing');
|
|
|
21 |
$('._kksr_reset._on', obj).parent().fadeOut('slow');
|
22 |
return false;
|
23 |
});
|
24 |
+
|
25 |
$('a[rel="kksr-reset-all"]', obj).click( function(){
|
26 |
$('._kksr_reset', obj).removeClass('_off').addClass('_on').val('1');
|
27 |
return false;
|
28 |
});
|
29 |
+
|
30 |
$('a[rel="kksr-reset-none"]', obj).click( function(){
|
31 |
$('._kksr_reset', obj).removeClass('_on').addClass('_off').val('0');
|
32 |
return false;
|
33 |
});
|
34 |
+
}
|
35 |
+
|
36 |
+
};
|
37 |
+
|
38 |
+
bf_admin_plugin_kksr.init();
|
39 |
|
40 |
})( jQuery );
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,15 +3,15 @@
|
|
3 |
|
4 |
Contributors: bhittani
|
5 |
|
6 |
-
Donate link:
|
7 |
|
8 |
-
Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited stars
|
9 |
|
10 |
Requires at least: 3.0
|
11 |
|
12 |
Tested up to: 3.4.2
|
13 |
|
14 |
-
Stable tag: 2.
|
15 |
|
16 |
|
17 |
kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
|
@@ -41,6 +41,8 @@ Enhanced settings page where you can adjust quite anything you may need to. You
|
|
41 |
|
42 |
1. A visual button in your editor to easily display the ratings manually in your posts/pages. No more typing a shortcode :)
|
43 |
|
|
|
|
|
44 |
1. Ratings column in your admin posts/pages screen so you can view the statistics at comfort.
|
45 |
|
46 |
1. Restrict votings per unique ip.
|
@@ -78,7 +80,15 @@ I have been using an older verion of the plugin. Is it safe for me to update?
|
|
78 |
|
79 |
=
|
80 |
|
81 |
-
Version 2.0 has been re-coded from the ground up preserving backwards compatibility. Feel free to upgrade safely.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
|
84 |
|
@@ -118,6 +128,13 @@ Version 2.0 has been re-coded from the ground up preserving backwards compatibil
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
= 2.0 =
|
122 |
* Update: Re-coded the plugin from the ground up, adding rich settings page and more features.
|
123 |
* Update: Transparent stars and availability of custom stars as per needs.
|
3 |
|
4 |
Contributors: bhittani
|
5 |
|
6 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CM659D9SHGKE6
|
7 |
|
8 |
+
Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited stars, google rich snippets
|
9 |
|
10 |
Requires at least: 3.0
|
11 |
|
12 |
Tested up to: 3.4.2
|
13 |
|
14 |
+
Stable tag: 2.1
|
15 |
|
16 |
|
17 |
kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
|
41 |
|
42 |
1. A visual button in your editor to easily display the ratings manually in your posts/pages. No more typing a shortcode :)
|
43 |
|
44 |
+
1. Google rich snippets. Ratings will be shown in google search results :)
|
45 |
+
|
46 |
1. Ratings column in your admin posts/pages screen so you can view the statistics at comfort.
|
47 |
|
48 |
1. Restrict votings per unique ip.
|
80 |
|
81 |
=
|
82 |
|
83 |
+
Version 2.0+ has been re-coded from the ground up preserving backwards compatibility. Feel free to upgrade safely.
|
84 |
+
|
85 |
+
=
|
86 |
+
|
87 |
+
I need some help or have some issues?
|
88 |
+
|
89 |
+
=
|
90 |
+
|
91 |
+
Visit the help tab in the settings to find out what you can do.
|
92 |
|
93 |
|
94 |
|
128 |
|
129 |
== Changelog ==
|
130 |
|
131 |
+
= 2.1 =
|
132 |
+
* Fix: Google rich snippets is now stable and safe to use.
|
133 |
+
* Fix: Grammers in admin settings.
|
134 |
+
* Update: Control whether to allow users to rate in archives or not.
|
135 |
+
* Update: Reordered directory tree structure.
|
136 |
+
* Added: Useful hooks and filters for advanced developers.
|
137 |
+
|
138 |
= 2.0 =
|
139 |
* Update: Re-coded the plugin from the ground up, adding rich settings page and more features.
|
140 |
* Update: Transparent stars and availability of custom stars as per needs.
|