kk Star Ratings - Version 2.0

Version Description

  • Update: Re-coded the plugin from the ground up, adding rich settings page and more features.
  • Update: Transparent stars and availability of custom stars as per needs.
  • Update: Ajax based settings page. No refreshes what so ever.
  • Update: Seperate settings tab.
  • Update: Visual flushing of ratings. No need to remember post ids.
  • Update: [s] added as a variable for use in the legend (description). Will display the s only if there are 0 or more than 1 ratings.
  • Added: kk Star Ratings now supports Google Rich Snippets. So the ratings will now be indexed in google search.
  • Added: Visual shortcode button. No need to type in a shortcode manually in your posts/pages when in manual mode.
  • Added: User specific amount of stars. Forget the fixed 5 stars.
  • Added: Choose your own images instead of the default ones.
  • Added: Tooltips. Now you can set tooltips for each star when mouse is hovered on each. You can also set colors.
  • Added: Adjustment of fueling speed of stars when being loaded or refilling.
  • Added: Set error message if anything goes unexpectidly.
  • Added: Set thank you message.
Download this release

Release Info

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

Code changes from version 1.7.2 to 2.0

Files changed (81) hide show
  1. admin.php +327 -0
  2. admin/options.php +0 -158
  3. ajax/kk-ratings-ajax.php +0 -76
  4. bhittani-framework/admin/admin.class.php +82 -0
  5. bhittani-framework/admin/css/admin.css +261 -0
  6. bhittani-framework/admin/images/error.png +0 -0
  7. bhittani-framework/admin/images/loading.gif +0 -0
  8. bhittani-framework/admin/images/overlay.png +0 -0
  9. bhittani-framework/admin/images/tick.png +0 -0
  10. bhittani-framework/admin/js/admin.js +302 -0
  11. bhittani-framework/admin/js/colorpicker/css/colorpicker.css +161 -0
  12. bhittani-framework/admin/js/colorpicker/css/layout.css +218 -0
  13. bhittani-framework/admin/js/colorpicker/images/Thumbs.db +0 -0
  14. bhittani-framework/admin/js/colorpicker/images/blank.gif +0 -0
  15. bhittani-framework/admin/js/colorpicker/images/colorpicker_background.png +0 -0
  16. bhittani-framework/admin/js/colorpicker/images/colorpicker_hex.png +0 -0
  17. bhittani-framework/admin/js/colorpicker/images/colorpicker_hsb_b.png +0 -0
  18. bhittani-framework/admin/js/colorpicker/images/colorpicker_hsb_h.png +0 -0
  19. bhittani-framework/admin/js/colorpicker/images/colorpicker_hsb_s.png +0 -0
  20. bhittani-framework/admin/js/colorpicker/images/colorpicker_indic.gif +0 -0
  21. bhittani-framework/admin/js/colorpicker/images/colorpicker_overlay.png +0 -0
  22. bhittani-framework/admin/js/colorpicker/images/colorpicker_rgb_b.png +0 -0
  23. bhittani-framework/admin/js/colorpicker/images/colorpicker_rgb_g.png +0 -0
  24. bhittani-framework/admin/js/colorpicker/images/colorpicker_rgb_r.png +0 -0
  25. bhittani-framework/admin/js/colorpicker/images/colorpicker_select.gif +0 -0
  26. bhittani-framework/admin/js/colorpicker/images/colorpicker_submit.png +0 -0
  27. bhittani-framework/admin/js/colorpicker/images/custom_background.png +0 -0
  28. bhittani-framework/admin/js/colorpicker/images/custom_hex.png +0 -0
  29. bhittani-framework/admin/js/colorpicker/images/custom_hsb_b.png +0 -0
  30. bhittani-framework/admin/js/colorpicker/images/custom_hsb_h.png +0 -0
  31. bhittani-framework/admin/js/colorpicker/images/custom_hsb_s.png +0 -0
  32. bhittani-framework/admin/js/colorpicker/images/custom_indic.gif +0 -0
  33. bhittani-framework/admin/js/colorpicker/images/custom_rgb_b.png +0 -0
  34. bhittani-framework/admin/js/colorpicker/images/custom_rgb_g.png +0 -0
  35. bhittani-framework/admin/js/colorpicker/images/custom_rgb_r.png +0 -0
  36. bhittani-framework/admin/js/colorpicker/images/custom_submit.png +0 -0
  37. bhittani-framework/admin/js/colorpicker/images/select.png +0 -0
  38. bhittani-framework/admin/js/colorpicker/images/select2.png +0 -0
  39. bhittani-framework/admin/js/colorpicker/images/slider.png +0 -0
  40. bhittani-framework/admin/js/colorpicker/index.html +184 -0
  41. bhittani-framework/admin/js/colorpicker/js/colorpicker.js +484 -0
  42. bhittani-framework/admin/js/colorpicker/js/eye.js +34 -0
  43. bhittani-framework/admin/js/colorpicker/js/jquery.js +4376 -0
  44. bhittani-framework/admin/js/colorpicker/js/layout.js +67 -0
  45. bhittani-framework/admin/js/colorpicker/js/utils.js +252 -0
  46. bhittani-framework/admin/js/jquery-ui-1.8.14.custom.min.js +789 -0
  47. bhittani-framework/admin/js/lightbox.js +148 -0
  48. bhittani-framework/admin/markup.class.php +138 -0
  49. css.css +54 -0
  50. css/kk-ratings.css +0 -80
  51. error.png +0 -0
  52. gray.png +0 -0
  53. icon.png +0 -0
  54. images/off.png +0 -0
  55. images/on.png +0 -0
  56. images/over.png +0 -0
  57. index.php +615 -0
  58. js.js +167 -0
  59. js/kk-ratings.js +0 -232
  60. js_admin.js +84 -0
  61. kk-ratings.php +0 -371
  62. orange.png +0 -0
  63. plugin.php +105 -0
  64. readme.txt +85 -41
  65. screenshot-1.png +0 -0
  66. screenshot-10.png +0 -0
  67. screenshot-2.png +0 -0
  68. screenshot-3.png +0 -0
  69. screenshot-4.png +0 -0
  70. screenshot-5.png +0 -0
  71. screenshot-6.png +0 -0
  72. screenshot-7.png +0 -0
  73. screenshot-8.png +0 -0
  74. screenshot-9.png +0 -0
  75. shortcode/mce/kkstarratings/editor_plugin.js +30 -0
  76. shortcode/mce/kkstarratings/icon.png +0 -0
  77. shortcode/mce/kkstarratings/swfobject.js +4 -0
  78. shortcode/mce/kkstarratings/tiny_mce_popup.js +5 -0
  79. shortcode/shortcode.php +38 -0
  80. widget.php +15 -12
  81. yellow.png +0 -0
admin.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="bhittani-framework">
3
+ <div class="bf-wrap-small _right">
4
+ <h3>Like the plugin</h3>
5
+ <p>
6
+ <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
7
+ <fb:like send="false" layout="box_count" width="225" show_faces="false" href="http://wakeusup.com/2011/05/kk-star-ratings/"></fb:like>
8
+ </p>
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="#General">General</a></li>
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="#Info">Info</a></li>
20
+ <li class="bf-save"><a href="#" rel="save-options">Save</a></li>
21
+ </ul>
22
+ <!--bf_navs-->
23
+ <div class="bf_logo">
24
+ <h3>
25
+ <?php echo $h3; ?>
26
+ </h3>
27
+ <div class="links">
28
+ <a href="<?php echo $url_docs; ?>" target="_blank">Docs</a>
29
+ |
30
+ <a href="<?php echo $url_changelog; ?>" target="_blank">Changelog</a>
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 __general <?php echo ($opt=='general')?'__active':''; ?>">
38
+ <?php
39
+
40
+ BhittaniPlugin_AdminMarkup::checkbox(array(
41
+ 'title' => 'Enable/Disable',
42
+ 'description' => 'Choose whether you want to enable or disable the plugin',
43
+ 'obj' => array(
44
+ array(
45
+ 'field' => 'kksr_enable',
46
+ 'label' => 'Enable',
47
+ 'value' => get_option('kksr_enable')
48
+ )
49
+ )
50
+ ));
51
+ BhittaniPlugin_AdminMarkup::checkbox(array(
52
+ 'title' => 'Placement',
53
+ 'description' => 'Choose where you want the ratings to be placed',
54
+ 'obj' => array(
55
+ array(
56
+ 'field' => 'kksr_show_in_home',
57
+ 'label' => 'Show on Home Page',
58
+ 'value' => get_option('kksr_show_in_home')
59
+ ),
60
+ array(
61
+ 'field' => 'kksr_show_in_archives',
62
+ 'label' => 'Show in Archives',
63
+ 'value' => get_option('kksr_show_in_archives')
64
+ ),
65
+ array(
66
+ 'field' => 'kksr_show_in_posts',
67
+ 'label' => 'Show in Posts',
68
+ 'value' => get_option('kksr_show_in_posts')
69
+ ),
70
+ array(
71
+ 'field' => 'kksr_show_in_pages',
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',
80
+ 'obj' => array(
81
+ array(
82
+ 'field' => 'kksr_unique',
83
+ 'label' => 'Unique based on User IP',
84
+ 'value' => get_option('kksr_unique')
85
+ )
86
+ )
87
+ ));
88
+ BhittaniPlugin_AdminMarkup::checkbox(array(
89
+ 'title' => 'Clear line',
90
+ 'description' => 'Choose whether you want the ratings to be on its own line rather than floated',
91
+ 'obj' => array(
92
+ array(
93
+ 'field' => 'kksr_clear',
94
+ 'label' => 'Clear',
95
+ 'value' => get_option('kksr_clear')
96
+ )
97
+ )
98
+ ));
99
+ BhittaniPlugin_AdminMarkup::checkbox(array(
100
+ 'title' => 'Admin screen column',
101
+ 'description' => 'Choose whether you want a ratings column in the admin post/page screen',
102
+ 'obj' => array(
103
+ array(
104
+ 'field' => 'kksr_column',
105
+ 'label' => 'Admin Posts/Pages Column',
106
+ 'value' => get_option('kksr_column')
107
+ )
108
+ )
109
+ ));
110
+ BhittaniPlugin_AdminMarkup::input(array(
111
+ 'title' => 'Legend',
112
+ 'description' => '
113
+ How do you want the legend of the ratings to be shown? <br />
114
+ <strong>Variables</strong> <br />
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')
122
+ ));
123
+ BhittaniPlugin_AdminMarkup::select(array(
124
+ 'title' => 'Position',
125
+ 'description' => 'Choose the position of the ratings',
126
+ 'field' => 'kksr_position',
127
+ 'options' => array(
128
+ array('top-left','Top Left'),
129
+ array('top-right','Top Right'),
130
+ array('bottom-left','Bottom Left'),
131
+ array('bottom-right','Bottom Right'),
132
+ ),
133
+ 'value' => get_option('kksr_position')
134
+ ));
135
+ BhittaniPlugin_AdminMarkup::input(array(
136
+ 'title' => 'Speed of fueling (in milliseconds)',
137
+ 'description' => 'Adjust the speed of the fueling of stars in milliseconds',
138
+ 'field' => 'kksr_js_fuelspeed',
139
+ 'value' => get_option('kksr_js_fuelspeed')
140
+ ));
141
+ BhittaniPlugin_AdminMarkup::input(array(
142
+ 'title' => 'Initial text',
143
+ 'description' => 'Text to be displayed when there are no ratings',
144
+ 'field' => 'kksr_init_msg',
145
+ 'value' => get_option('kksr_init_msg')
146
+ ));
147
+ BhittaniPlugin_AdminMarkup::input(array(
148
+ 'title' => 'Thank you message',
149
+ 'description' => 'Text to be displayed when user places a vote',
150
+ 'field' => 'kksr_js_thankyou',
151
+ 'value' => get_option('kksr_js_thankyou')
152
+ ));
153
+ BhittaniPlugin_AdminMarkup::input(array(
154
+ 'title' => 'Error message',
155
+ 'description' => 'Text to be displayed when something goes wrong unexpectidly',
156
+ 'field' => 'kksr_js_error',
157
+ 'value' => get_option('kksr_js_error')
158
+ ));
159
+ ?>
160
+ </div>
161
+ <!--bf_container __general-->
162
+ <div class="bf_container __stars <?php echo ($opt=='stars')?'__active':''; ?>">
163
+ <?php
164
+ BhittaniPlugin_AdminMarkup::input(array(
165
+ 'title' => 'Amount of stars',
166
+ 'description' => 'How many stars do you want the ratings based on? Enter a numeric value',
167
+ 'field' => 'kksr_stars',
168
+ 'value' => get_option('kksr_stars')
169
+ ));
170
+ BhittaniPlugin_AdminMarkup::input(array(
171
+ 'title' => 'Width of single star',
172
+ 'description' => 'Set the width of a single star in pixels(px).<br /><strong>Note: </strong>All stars must be of equal width',
173
+ 'field' => 'kksr_stars_w',
174
+ 'value' => get_option('kksr_stars_w')
175
+ ));
176
+ BhittaniPlugin_AdminMarkup::input(array(
177
+ 'title' => 'Height of single star',
178
+ 'description' => 'Set the height of a single star in pixels(px).<br /><strong>Note: </strong>All stars must be of equal height',
179
+ 'field' => 'kksr_stars_h',
180
+ 'value' => get_option('kksr_stars_h')
181
+ ));
182
+ BhittaniPlugin_AdminMarkup::image(array(
183
+ 'title' => 'Gray Star',
184
+ 'description' => 'You can modify the gray star image here',
185
+ 'field' => 'kksr_stars_gray',
186
+ 'label' => 'Choose an image',
187
+ 'caption' => 'Gray Star',
188
+ 'value' => get_option('kksr_stars_gray') ? get_option('kksr_stars_gray') : BhittaniPlugin::file_uri('gray.png')
189
+ ));
190
+ BhittaniPlugin_AdminMarkup::image(array(
191
+ 'title' => 'Yellow Star',
192
+ 'description' => 'You can modify the yellow star image here',
193
+ 'field' => 'kksr_stars_yellow',
194
+ 'label' => 'Choose an image',
195
+ 'caption' => 'Yellow Star',
196
+ 'value' => get_option('kksr_stars_yellow') ? get_option('kksr_stars_yellow') : BhittaniPlugin::file_uri('yellow.png')
197
+ ));
198
+ BhittaniPlugin_AdminMarkup::image(array(
199
+ 'title' => 'Orange Star',
200
+ 'description' => 'You can modify the orange star image here',
201
+ 'field' => 'kksr_stars_orange',
202
+ 'label' => 'Choose an image',
203
+ 'caption' => 'Orange Star',
204
+ 'value' => get_option('kksr_stars_orange') ? get_option('kksr_stars_orange') : BhittaniPlugin::file_uri('orange.png')
205
+ ));
206
+ ?>
207
+ </div>
208
+ <!--bf_container __stars-->
209
+ <div class="bf_container __tooltips <?php echo ($opt=='tooltips')?'__active':''; ?>">
210
+ <?php
211
+ BhittaniPlugin_AdminMarkup::checkbox(array(
212
+ 'title' => 'Tooltips',
213
+ 'description' => 'Choose whether you want to enable or disable the tooltips',
214
+ 'obj' => array(
215
+ array(
216
+ 'field' => 'kksr_tooltip',
217
+ 'label' => 'Enable Tooltips',
218
+ 'value' => get_option('kksr_tooltip')
219
+ )
220
+ )
221
+ ));
222
+ $Tooltips = unserialize(base64_decode(get_option('kksr_tooltips')));
223
+ for($tooltip_i=0;$tooltip_i<get_option('kksr_stars');$tooltip_i++)
224
+ {
225
+ BhittaniPlugin_AdminMarkup::input(array(
226
+ 'title' => 'Tooltip - star '.($tooltip_i+1),
227
+ 'description' => 'Displayed when mouse is hovered over star '.($tooltip_i+1),
228
+ 'field' => 'kksr_tooltips['.($tooltip_i).'][tip]',
229
+ 'value' => isset($Tooltips[$tooltip_i]['tip']) ? $Tooltips[$tooltip_i]['tip'] : ''
230
+ ));
231
+ BhittaniPlugin_AdminMarkup::color(array(
232
+ 'title' => 'Tooltip Color - star '.($tooltip_i+1),
233
+ 'description' => 'Color for tooltip of star '.($tooltip_i+1),
234
+ 'field' => 'kksr_tooltips['.($tooltip_i).'][color]',
235
+ 'label' => 'Choose a color',
236
+ 'value' => isset($Tooltips[$tooltip_i]['color']) ? $Tooltips[$tooltip_i]['color'] : '#ffffff'
237
+ ));
238
+ }
239
+ ?>
240
+ </div>
241
+ <!--bf_container __tooltips-->
242
+ <div class="bf_container __reset <?php echo ($opt=='reset')?'__active':''; ?>">
243
+ <?php
244
+ global $wpdb;
245
+ $table = $wpdb->prefix . 'postmeta';
246
+ $Posts = $wpdb->get_results("SELECT a.ID, a.post_title
247
+ FROM " . $wpdb->posts . " a, $table b
248
+ WHERE a.ID=b.post_id AND
249
+ b.meta_key='_kksr_ratings'
250
+ ORDER BY a.ID ASC");
251
+ if(is_array($Posts))
252
+ {
253
+ $Obj = array();
254
+ foreach($Posts as $post)
255
+ {
256
+ $Obj[] = array(
257
+ 'field' => 'kksr_reset['.$post->ID.']',
258
+ 'label' => $post->post_title,
259
+ 'class' => '_kksr_reset'
260
+ );
261
+ }
262
+ if(count($Obj))
263
+ {
264
+ BhittaniPlugin_AdminMarkup::html('<p>Select the posts/pages below
265
+ and click the reset button to reset
266
+ their ratings.</p>
267
+ <p>
268
+ <a href="#" rel="kksr-reset-all" class="button">Select All</a>
269
+ <a href="#" rel="kksr-reset-none" class="button">Select None</a>
270
+ <a href="#" rel="kksr-reset" class="button-primary" style="color:white;">Reset</a>
271
+ </p>'
272
+ );
273
+ BhittaniPlugin_AdminMarkup::checkbox(array(
274
+ 'title' => '',
275
+ 'description' => '',
276
+ 'pclass' => '_left',
277
+ 'obj' => $Obj
278
+ ));
279
+ }
280
+ else
281
+ {
282
+ BhittaniPlugin_AdminMarkup::html('No ratings have been placed.');
283
+ }
284
+ }
285
+ else
286
+ {
287
+ BhittaniPlugin_AdminMarkup::html('No ratings have been placed.');
288
+ }
289
+ ?>
290
+ </div>
291
+ <!--bf_container __reset-->
292
+ <div class="bf_container __info <?php echo ($opt=='info')?'__active':''; ?>">
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>&lt;?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid); endif; ?&gt;</code>
300
+ <br />Where $pid is the post of the id
301
+ <br /><br />
302
+ <strong>Get top rated posts as array of objects:</strong>
303
+ <br /> <code>&lt;?php <br /> if(function_exists("kk_star_ratings_get")) <br /> { <br /> $top_rated_posts = kk_star_ratings_get($total); <br /> } <br />?&gt;</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 /><br />
307
+ <strong>Example Usage:</strong>
308
+ <code>
309
+ <pre>
310
+ foreach($top_rated_posts as $post)
311
+ {
312
+ // you get $post->ID and $post->ratings
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 __info-->
323
+ </form>
324
+ </div>
325
+ <!-- bf-wrap -->
326
+ </div>
327
+ <!--bhittani-framework-->
admin/options.php DELETED
@@ -1,158 +0,0 @@
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 &raquo; Settings</h2>
15
- <table width="697" class="widefat" style="width:600px;">
16
- <thead>
17
-    <tr>
18
-      <th width="8">#</th>
19
- <th width="69">Label</th>
20
- <th width="604">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
- <br /><br />
54
- <strong>For use in theme files:</strong>
55
- <br /> <span style="color:#F60;">&lt;?php if(function_exists('kk_star_ratings')) : echo kk_star_ratings($pid); endif; ?&gt;</span>
56
- <br />Where $pid is the post of the id
57
- <br /><br />
58
- <strong>Get top rated posts as array of objects:</strong>
59
- <br /> <span style="color:#F60;">&lt;?php if(function_exists('kk_star_ratings_get')) : $top_rated_posts = kk_star_ratings_get($total); endif; ?&gt;</span>
60
- <br />Where $total is the limit (int)
61
- <br />$top_rated_posts will contain an array of objects, each containing an ID and ratings.
62
- <br />
63
- <strong>Example Usage:</strong>
64
- <pre>
65
- foreach($top_rated_posts as $post)
66
- {
67
- // you get $post->ID and $post->ratings
68
- // Do anything with it like get_post($post->ID)
69
- // ...
70
- }
71
- </pre>
72
- <br />
73
- </p>
74
- </td>
75
- </tr>
76
- <tr>
77
- <td>3</td>
78
- <td><label for="<?php echo $this->plugin_id; ?>[unique]">Unique Voting (Based on IP)</label></td>
79
- <td><input type="checkbox" name="<?php echo $this->plugin_id; ?>[unique]" value="1" <?php echo $this->options['unique'] ? "checked='checked'" : ""; ?> /></td>
80
- </tr>
81
- <tr>
82
- <td>4</td>
83
- <td><label for="<?php echo $this->plugin_id; ?>[position]">Placement</label></td>
84
- <td>
85
- <select name="<?php echo $this->plugin_id; ?>[position]">
86
- <option value="top-left" <?php echo !strcmp($this->options['position'], 'top-left') ? "selected='selected'" : ""; ?>>Top Left</option>
87
- <option value="top-right" <?php echo !strcmp($this->options['position'], 'top-right') ? "selected='selected'" : ""; ?>>Top Right</option>
88
- <option value="bottom-left" <?php echo !strcmp($this->options['position'], 'bottom-left') ? "selected='selected'" : ""; ?>>Bottom Left</option>
89
- <option value="bottom-right" <?php echo !strcmp($this->options['position'], 'bottom-right') ? "selected='selected'" : ""; ?>>Bottom Right</option>
90
- </select>
91
- </td>
92
- </tr>
93
- <tr>
94
- <td>5</td>
95
- <td><label for="<?php echo $this->plugin_id; ?>[legend]">Description</label></td>
96
- <td>
97
- <input type="text" name="<?php echo $this->plugin_id; ?>[legend]" value="<?php echo $this->options['legend']; ?>" size="50" />
98
- <p>
99
- <strong>[total]</strong> : Total amount of casted votes
100
- <br />
101
- <strong>[per]</strong> &nbsp;&nbsp;: Rating Percentage
102
- <br />
103
- <strong>[avg]</strong> &nbsp;: Rating Average
104
- </p>
105
- </td>
106
- </tr>
107
- <tr>
108
- <td>6</td>
109
- <td><label for="<?php echo $this->plugin_id; ?>[init_msg]">Initial Message</label></td>
110
- <td>
111
- <input type="text" name="<?php echo $this->plugin_id; ?>[init_msg]" value="<?php echo $this->options['init_msg']; ?>" size="50" />
112
- </td>
113
- </tr>
114
- <tr>
115
- <td>7</td>
116
- <td><label for="<?php echo $this->plugin_id; ?>[clear]">Clear Line</label></td>
117
- <td>
118
- <input type="checkbox" name="<?php echo $this->plugin_id; ?>[clear]" value="1" <?php echo $this->options['clear'] ? "checked='checked'" : ""; ?> />
119
- </td>
120
- </tr>
121
- </tbody>
122
- </table>
123
- <p><input type="submit" name="submit" value="Save Settings" class="button" /></p>
124
- </form>
125
- <form action="" method="POST">
126
- <?php
127
- if(strcmp($_POST['kkratings-flush'],'Flush Ratings'))
128
- {
129
- wp_nonce_field('kkratings_flush','kkratings-flush-nonce');
130
- ?>
131
- <p>
132
- <strong>RESET RATINGS:</strong> Enter id(s) of posts/pages (comma seperated) and click the 'Flush Ratings' button to reset its ratings
133
- </p>
134
- <p>
135
- <input name="kkratings_input" type="text" value="" size="10" />
136
- <input type="submit" value="Flush Ratings" name="kkratings-flush" class="button" />
137
- <strong>NOTE:</strong> To reset all votings occured throughout the site, leave the input field empty.
138
- </p>
139
- <?php
140
- }
141
- ?>
142
- </form>
143
- <p>Donations to this plugin will always be appreciated. It is a way of saying thanks!</p>
144
- <p>
145
-
146
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
147
- <input type="hidden" name="cmd" value="_s-xclick">
148
- <input type="hidden" name="hosted_button_id" value="EHPTKTC2TT4QC">
149
- <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!">
150
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
151
- </form>
152
- </p>
153
- <?php
154
- /* ************************
155
- SETTINGS - ends
156
- ************************** */
157
- ?>
158
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ajax/kk-ratings-ajax.php DELETED
@@ -1,76 +0,0 @@
1
- <?php
2
-
3
- header("Content-type: text/xml");
4
-
5
- $path_to_root = '../../../../';
6
- require_once($path_to_root."wp-config.php");
7
-
8
- // check security
9
- check_ajax_referer( 'kk-ratings' );
10
-
11
- $kkratings_options = get_option('kk-ratings');
12
-
13
- $userip = $_SERVER['REMOTE_ADDR'];
14
- $Ratings['ratings'] = get_post_meta($_POST['id'], '_kk_ratings_ratings', true) ? get_post_meta($_POST['id'], '_kk_ratings_ratings', true) : false;
15
-
16
- if(isset($_POST['id']) && ((!strcmp($_POST['op'], 'get') && $Ratings['ratings']) || (!strcmp($_POST['op'], 'put') && isset($_POST['stars']))))
17
- {
18
- if(!strcmp($_POST['op'], 'put'))
19
- {
20
- if($Ratings['ratings'])
21
- {
22
- $Ratings['casts'] = get_post_meta($_POST['id'], '_kk_ratings_casts', true);
23
- $Ratings['ips'] = get_post_meta($_POST['id'], '_kk_ratings_ips', true);
24
- update_post_meta($_POST['id'], '_kk_ratings_ratings', $Ratings['ratings'] + $_POST['stars']);
25
- update_post_meta($_POST['id'], '_kk_ratings_casts', $Ratings['casts'] + 1);
26
- update_post_meta($_POST['id'], '_kk_ratings_ips', $Ratings['ips'].'|'.$userip);
27
- update_post_meta($_POST['id'], '_kk_ratings_avg', round(($Ratings['ratings']/$Ratings['casts']),1));
28
- }
29
- else
30
- {
31
- update_post_meta($_POST['id'], '_kk_ratings_ratings', $_POST['stars']);
32
- update_post_meta($_POST['id'], '_kk_ratings_casts', 1);
33
- update_post_meta($_POST['id'], '_kk_ratings_ips', $userip);
34
- update_post_meta($_POST['id'], '_kk_ratings_avg', $_POST['stars']);
35
- }
36
- }
37
-
38
- $Ip = array();
39
- $Ratings['ratings'] = get_post_meta($_POST['id'], '_kk_ratings_ratings', true);
40
- $Ratings['casts'] = get_post_meta($_POST['id'], '_kk_ratings_casts', true);
41
- $Ratings['ips'] = get_post_meta($_POST['id'], '_kk_ratings_ips', true);
42
- $Ratings['avg'] = get_post_meta($_POST['id'], '_kk_ratings_avg', true).'/5';
43
-
44
- // Percentage
45
- $Ratings['per'] = round((($Ratings['ratings']/$Ratings['casts'])/5)*100);
46
-
47
- // Can user rate?
48
- $Ip = explode('|',$Ratings['ips']);
49
- $Ratings['open'] = (in_array($userip, $Ip) && $kkratings_options['unique'])? 'no' : 'yes';
50
-
51
- // Legend
52
-
53
- $Ratings['legend'] = $kkratings_options['legend'];
54
- $Ratings['legend'] = str_replace('[total]',$Ratings['casts'], $Ratings['legend']);
55
- $Ratings['legend'] = str_replace('[avg]',$Ratings['avg'], $Ratings['legend']);
56
- $Ratings['legend'] = str_replace('[per]',$Ratings['per'].'%', $Ratings['legend']);
57
-
58
- echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
59
- echo "<response>";
60
- echo "<success>1</success>";
61
- echo "<percentage>".$Ratings['per']."</percentage>";
62
- echo "<legend>".$Ratings['legend']."</legend>";
63
- echo "<open>".$Ratings['open']."</open>";
64
- echo "</response>";
65
- exit;
66
- }
67
- else
68
- {
69
- echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
70
- echo "<response>";
71
- echo "<error>Invalid error occurred</error>";
72
- echo "</response>";
73
- exit;
74
- }
75
-
76
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bhittani-framework/admin/admin.class.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* -------------------------------------------------------------
4
+ ----------------------------------------------------------------
5
+ | |
6
+ | File name : admin.class.php |
7
+ | Usage : Hooks the options/settings into wordpress |
8
+ | Class : BhittaniPlugin_Admin |
9
+ | Version : 0.1 |
10
+ | Author : Kamal Khan |
11
+ | URI : http://wp.bhittani.com/framework |
12
+ | |
13
+ | Description : |
14
+ | Creates the settings page and includes all the neccessary |
15
+ | HTML to generate the page, including scripts |
16
+ | |
17
+ | -CHANGELOG- |
18
+ | ---------------------------------------------------------- |
19
+ | 0.1 - First release |
20
+ | |
21
+ ----------------------------------------------------------------
22
+ ------------------------------------------------------------- */
23
+
24
+ if(!defined('BhittaniPlugin_Admin')) :
25
+
26
+ // Declare and define the class.
27
+ class BhittaniPlugin_Admin extends BhittaniPlugin
28
+ {
29
+ public function __construct($id, $nick, $ver)
30
+ {
31
+ parent::__construct($id, $nick, $ver);
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
+ $this->enqueue_js('colorpicker', parent::file_uri('bhittani-framework/admin/js/colorpicker/js/colorpicker.js'));
42
+ $this->enqueue_js('jqui', parent::file_uri('bhittani-framework/admin/js/jquery-ui-1.8.14.custom.min.js'));
43
+ $this->enqueue_js('lightbox', parent::file_uri('bhittani-framework/admin/js/lightbox.js'));
44
+ $this->enqueue_js('admin', parent::file_uri('bhittani-framework/admin/js/admin.js'));
45
+ }
46
+ /** function/method
47
+ * Usage: hook css
48
+ * Arg(0): null
49
+ * Return: void
50
+ */
51
+ public function css()
52
+ {
53
+ $this->enqueue_css('admin', parent::file_uri('bhittani-framework/admin/css/admin.css'));
54
+ $this->enqueue_css('colorpicker', parent::file_uri('bhittani-framework/admin/js/colorpicker/css/colorpicker.css'));
55
+ wp_enqueue_style('thickbox');
56
+ }
57
+
58
+ public function scripts()
59
+ {
60
+ $this->js();
61
+ $this->css();
62
+ }
63
+ public function lightbox_html($footer)
64
+ {
65
+ ?>
66
+ <div class="bhittani-lightbox">
67
+ <div class="kkpopup-bg"></div>
68
+ <div class="kkpopup-exit"><a href="#"><img src="<?php echo parent::file_uri('bhittani-framework/admin/images/error.png'); ?>" width="16" height="16" alt="Close" /></a></div>
69
+ <div class="kkpopup"></div>
70
+ <span class="kkpopup__processing"><img src="<?php echo parent::file_uri('bhittani-framework/admin/images/loading.gif'); ?>" width="16" height="16" alt="Proccessing!" class="kkpopup-process" /></span>
71
+ </div>
72
+ <div class="kkpopup-lightbox bhittani-lightbox"></div>
73
+ <?php
74
+ }
75
+ }
76
+
77
+ $BhittaniPlugin_Admin_obj = new BhittaniPlugin_Admin(BHITTANI_PLUGIN_KKSTARRATINGS_ID, BHITTANI_PLUGIN_KKSTARRATINGS_NICK, BHITTANI_PLUGIN_KKSTARRATINGS_VER);
78
+ add_action('admin_enqueue_scripts', array($BhittaniPlugin_Admin_obj, 'scripts'));
79
+ add_filter('admin_footer', array($BhittaniPlugin_Admin_obj, 'lightbox_html'));
80
+
81
+ endif;
82
+ ?>
bhittani-framework/admin/css/admin.css ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bhittani-framework {
2
+ font-family: Arial, Helvetica, sans-serif;
3
+ color: #333;
4
+ font-size: 12px;
5
+ width: 800px;
6
+ position: relative;
7
+ overflow: hidden;
8
+ }
9
+ .bhittani-framework .bf-wrap {
10
+ width: 575px;
11
+ }
12
+ .bhittani-framework .bf-wrap-small {
13
+ width: 225px;
14
+ top: 100px;
15
+ left: 765px;
16
+ position: fixed;
17
+ }
18
+ .bhittani-framework img {
19
+ max-width: 100%;
20
+ height: auto;
21
+ width: auto\9; /* ie8 */
22
+ }
23
+ .bhittani-framework ._right {
24
+ float:right;
25
+ }
26
+ .bhittani-framework ._left {
27
+ float:left;
28
+ }
29
+ .bhittani-framework a {
30
+ color: #06F;
31
+ text-decoration: none;
32
+ }
33
+ .bhittani-framework a:hover {
34
+ color: #F90;
35
+ }
36
+ .bhittani-framework a:focus {
37
+ outline: none;
38
+ }
39
+
40
+ .bhittani-framework .bf_head {
41
+ overflow: hidden;
42
+ }
43
+ .bhittani-framework .bf_head .bf_logo {
44
+ padding: 10px;
45
+ }
46
+ .bhittani-framework .bf_head .bf_logo h3 {
47
+ font-size: 16px;
48
+ margin: 0px;
49
+ padding: 0px;
50
+ line-height: 28px;
51
+ color: #666;
52
+ }
53
+ .bhittani-framework .bf_head .bf_logo .links {
54
+ /*text-align: center;*/
55
+ }
56
+ .bhittani-framework .bf_head .bf_logo a {
57
+ text-align: center;
58
+ }
59
+ .bhittani-framework .bf_head ul.bf_navs {
60
+ margin: 0px;
61
+ padding: 0px;
62
+ list-style-type: none;
63
+ }
64
+ .bhittani-framework .bf_head ul.bf_navs li {
65
+ float: left;
66
+ line-height: 60px;
67
+ margin-right: 5px;
68
+ margin-left: 5px;
69
+ margin-top: 20px;
70
+ }
71
+ .bhittani-framework .bf_head ul.bf_navs li a {
72
+ line-height: 25px;
73
+ padding-right: 10px;
74
+ padding-left: 10px;
75
+ font-size: 12px;
76
+ color: #CCC;
77
+ text-transform: uppercase;
78
+ display: block;
79
+ margin-top: 12px;
80
+ border: 1px solid transparent;
81
+ }
82
+ .bhittani-framework .bf_head ul.bf_navs li a:hover {
83
+ color: #333;
84
+ }
85
+ .bhittani-framework .bf_head ul.bf_navs li.active a {
86
+ padding: 5px 10px;
87
+ background-color: #FCFCFC;
88
+ color: #999;
89
+ border-top-width: 1px;
90
+ border-right-width: 1px;
91
+ border-left-width: 1px;
92
+ border-top-style: dashed;
93
+ border-right-style: dashed;
94
+ border-left-style: dashed;
95
+ border-top-color: #EEE;
96
+ border-right-color: #EEE;
97
+ border-left-color: #EEE;
98
+ box-shadow: #EEE 0px -3px 5px;
99
+ -moz-box-shadow: #EEE 0px -3px 5px;
100
+ -webkit-box-shadow: #EEE 0px -3px 5px;
101
+ border-radius: 5px 5px 0px 0px;
102
+ -moz-border-radius: 5px 5px 0px 0px;
103
+ -webkit-border-radius: 5px 5px 0px 0px;
104
+ }
105
+ .bhittani-framework .bf_head ul.bf_navs li.bf-save a {
106
+ color: #FFF;
107
+ border: 1px solid #52B0F5;
108
+ background-image: url(../images/overlay.png);
109
+ background-repeat: repeat-x;
110
+ border-radius: 3px;
111
+ -moz-border-radius: 3px;
112
+ -webkit-border-radius: 3px;
113
+ box-shadow: #EEE 0px 0px 5px;
114
+ -moz-box-shadow: #EEE 0px 0px 5px;
115
+ -webkit-box-shadow: #EEE 0px 0px 5px;
116
+ background-color: #52B0F5;
117
+ }
118
+ .bhittani-framework .bf_head ul.bf_navs li.bf-save a:hover {
119
+ background-color: #0F6A97;
120
+ border: 1px solid #0F6A97;
121
+ color: #FFF;
122
+ }
123
+
124
+ .bhittani-framework .bf_line {
125
+ background-color: #E9E9E9;
126
+ height: 10px;
127
+ border-right-width: 1px;
128
+ border-bottom-width: 1px;
129
+ border-left-width: 1px;
130
+ border-right-style: dashed;
131
+ border-bottom-style: dashed;
132
+ border-left-style: dashed;
133
+ border-right-color: #FFF;
134
+ border-bottom-color: #FFF;
135
+ border-left-color: #FFF;
136
+ }
137
+ .bhittani-framework .bf_container {
138
+ line-height: 25px;
139
+ margin-top: -15px;
140
+ display: none;
141
+ }
142
+ .bhittani-framework .bf_container.__active {
143
+ display: block;
144
+ }
145
+ .bhittani-framework .bf_container .bf_box {
146
+ background-color: #FCFCFC;
147
+ padding: 10px 20px;
148
+ border: 1px solid #F4F4F4;
149
+ overflow: hidden;
150
+ margin-top: 5px;
151
+ margin-bottom: 5px;
152
+ }
153
+ .bhittani-framework .bf_container .bf_box h4 {
154
+ margin: 0px;
155
+ padding: 0px;
156
+ line-height: 35px;
157
+ font-size: 14px;
158
+ font-weight: normal;
159
+ }
160
+ .bhittani-framework .bf_container .bf_box .bf_aside {
161
+ float: right;
162
+ width: 250px;
163
+ border: 1px solid #F0F0F0;
164
+ padding: 7px 15px;
165
+ background-color: #FEFEFE;
166
+ color: #999;
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;
174
+ line-height: 15px;
175
+ -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
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;
182
+ }
183
+ .bf_box input.mini {
184
+ width: 20px;
185
+ }
186
+ .allow-click {
187
+ cursor: pointer;
188
+ -moz-user-select: none;
189
+ -khtml-user-select: none;
190
+ -webkit-user-select: none;
191
+ -o-user-select: none;
192
+ }
193
+ input.modern {
194
+ width: 80px;
195
+ background-color: #FFFFFF;
196
+ border: 3px solid #EEE;
197
+ padding-right: 3px;
198
+ padding-left: 3px;
199
+ text-align: center;
200
+ margin-top: 5px;
201
+ margin-bottom: 5px;
202
+ }
203
+ input.chkbox, input.rad {
204
+ width: 48px;
205
+ text-indent: -9999px;
206
+ background-position: center center;
207
+ background-repeat: no-repeat;
208
+ }
209
+ input.chkbox._on, input.rad._on {
210
+ background-image: url(../images/tick.png);
211
+ }
212
+ input.chkbox._off, input.rad._off {
213
+ background-image: url(../images/error.png);
214
+ }
215
+ .bf-label {
216
+ margin-left: -10px;
217
+ margin-right: 15px;
218
+ background-color: #F4F4F4;
219
+ border: 1px solid #EEE;
220
+ padding: 9px 5px;
221
+ }
222
+ input.button {
223
+ width: auto;
224
+ padding: 7px;
225
+ border: 1px solid #EEE;
226
+ }
227
+ .bf-image {
228
+ width: 170px;
229
+ max-width: 170px !important;
230
+ background-color: white;
231
+ padding: 15px;
232
+ border: 5px solid #EEE;
233
+ line-height: 0px;
234
+ text-align: center;
235
+ position: relative;
236
+ }
237
+ .bf-remove {
238
+ background-image:url(../images/error.png);
239
+ height: 16px;
240
+ width: 16px;
241
+ position: absolute;
242
+ z-index: 9;
243
+ right: -8px;
244
+ bottom: -8px;
245
+ }
246
+ .bf_box input:focus, .bf_box select:focus, .bf_box textarea:focus{
247
+ outline: none;
248
+ border-top-color: #CCC;
249
+ border-right-color: #CCC;
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;}
256
+ div.bhittani-lightbox div.kkpopup-bg {display:none;background-color:#FFF;padding:10px;position:absolute;z-index:999;border-radius:6px;-moz-border-radius:6px;-webkit-border-radius:6px;}
257
+ div.bhittani-lightbox div.kkpopup-exit {overflow:hidden;float:right;width:20px;position:absolute;z-index:9999; display:none;}
258
+ div.bhittani-lightbox div.kkpopup-exit a {padding:3px;color:#999;font-weight:bold;float:right;font-family:Verdana,Geneva,sans-serif;font-size:16px;text-decoration:none;}
259
+ div.bhittani-lightbox span.kkpopup__processing {display:none;}
260
+ div.bhittani-lightbox img.kkpopup-process {padding-top:3px;padding-right:5px;float:left;}
261
+ div.bhittani-lightbox.kkpopup-lightbox {position:absolute;top:0px;left:0px;z-index:99;display:none;}
bhittani-framework/admin/images/error.png ADDED
Binary file
bhittani-framework/admin/images/loading.gif ADDED
Binary file
bhittani-framework/admin/images/overlay.png ADDED
Binary file
bhittani-framework/admin/images/tick.png ADDED
Binary file
bhittani-framework/admin/js/admin.js ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ (function( $ ){
4
+
5
+ /* ----------------------
6
+ NAVIGATION
7
+ $(obj).bfNavigation();
8
+ ------------------------- */
9
+
10
+ $.fn.bfNavigation = function( options ) {
11
+
12
+ bfNavigation_settings = {
13
+ container: '.bf_container'
14
+ };
15
+
16
+ return this.each( function(){
17
+
18
+ if ( options ) {
19
+ $.extend( bfNavigation_settings, options );
20
+ }
21
+ var obj = $(this);
22
+
23
+ var all_containers = $(bfNavigation_settings.container);
24
+
25
+ $('a', obj).click( function(){
26
+ var a = $(this);
27
+ var li = a.parent();
28
+ var id = (a.attr('href')).split('#')[1];
29
+ if(id!='')
30
+ {
31
+ var container = $('.__'+id.toLowerCase());
32
+ $('li', obj).stop(true, true).removeClass('active');
33
+ li.stop(true, true).addClass('active');
34
+ all_containers.stop(true,true).removeClass('__active');
35
+ container.stop(true,true).addClass('__active');
36
+ }
37
+ });
38
+
39
+ var hash = (window.location.href).split('#')[1];
40
+ if(hash!=null && hash!='')
41
+ {
42
+ $('a[href="#'+hash+'"]').click();
43
+ }
44
+
45
+ });
46
+
47
+ };
48
+
49
+
50
+ /* ----------------------
51
+ CLICKER
52
+ $(obj).bfClicker();
53
+ ------------------------- */
54
+
55
+ $.fn.bfClicker = function( options ) {
56
+
57
+ bfClicker_settings = {
58
+ // no options
59
+ };
60
+
61
+ return this.each( function(){
62
+
63
+ if ( options ) {
64
+ $.extend( bfClicker_settings, options );
65
+ }
66
+ var obj = $(this);
67
+
68
+ obj.click( function(){
69
+ $(this).prev().click();
70
+ });
71
+
72
+ });
73
+
74
+ };
75
+
76
+
77
+ /* ----------------------
78
+ COLOR PICKER
79
+ $(obj).bfColorPicker();
80
+ ------------------------- */
81
+
82
+ $.fn.bfColorPicker = function( options ) {
83
+
84
+ bfColorPicker_settings = {
85
+ // no options
86
+ };
87
+
88
+ return this.each( function(){
89
+
90
+ if ( options ) {
91
+ $.extend( bfColorPicker_settings, options );
92
+ }
93
+ var obj = $(this);
94
+
95
+ obj.ColorPicker({
96
+ onSubmit: function(hsb, hex, rgb, el) {
97
+ $(el).attr('value', '#' + hex.toUpperCase());
98
+ $(el).css('backgroundColor', '#' + hex);
99
+ $(el).ColorPickerHide();
100
+ },
101
+ onBeforeShow: function () {
102
+ obj.ColorPickerSetColor(this.value);
103
+ },
104
+ onChange: function (hsb, hex, rgb) {
105
+ obj.attr('value', '#' + hex.toUpperCase());
106
+ obj.css('backgroundColor', '#' + hex);
107
+ }
108
+ });
109
+
110
+ });
111
+
112
+ };
113
+
114
+
115
+ /* ----------------------
116
+ CHECKBOX
117
+ $(obj).bfCheckbox();
118
+ ------------------------- */
119
+
120
+ $.fn.bfCheckbox = function( options ) {
121
+
122
+ bfCheckbox_settings = {
123
+ // no options
124
+ };
125
+
126
+ return this.each( function(){
127
+
128
+ if ( options ) {
129
+ $.extend( bfCheckbox_settings, options );
130
+ }
131
+ var obj = $(this);
132
+
133
+ obj.click( function(){
134
+ if(obj.val()=='0')
135
+ obj.stop(true,true).attr('value',1).removeClass('_off').addClass('_on');
136
+ else
137
+ obj.stop(true,true).attr('value',0).removeClass('_on').addClass('_off');
138
+ });
139
+
140
+ });
141
+
142
+ };
143
+
144
+
145
+ /* ----------------------
146
+ RADIO BUTTON
147
+ $(obj).bfRadio();
148
+ ------------------------- */
149
+
150
+ $.fn.bfRadio = function( options ) {
151
+
152
+ bfRadio_settings = {
153
+ // no options
154
+ };
155
+
156
+ return this.each( function(){
157
+
158
+ if ( options ) {
159
+ $.extend( bfRadio_settings, options );
160
+ }
161
+ var obj = $(this);
162
+
163
+ obj.click( function(){
164
+ var obj = $(this);
165
+ var scope = $(this).parent().parent();
166
+ obj.addClass('__radio-selected');
167
+ $('.bf__radio', scope).stop(true,true).attr('value',0).removeClass('_on').addClass('_off');
168
+ obj.stop(true,true).removeClass('__radio-selected').attr('value',1).removeClass('_off').addClass('_on');
169
+ });
170
+
171
+ });
172
+
173
+ };
174
+
175
+
176
+ /* ----------------------
177
+ UPLOAD IMAGE
178
+ $(obj).bfUploadImage();
179
+ ------------------------- */
180
+
181
+ $.fn.bfUploadImage = function( options ) {
182
+
183
+ bfUploadImage_settings = {
184
+ _custom_upload : false,
185
+ _upload_image : function(container)
186
+ {
187
+ bfUploadImage_settings._custom_upload = true;
188
+ var tbframe_interval = setInterval(function() {jQuery('#TB_iframeContent').contents().find('.savesend .button').val(container.attr('alt')?container.attr('alt'):'Use This Image');}, 2000);
189
+ tb_show("Image Manager", 'media-upload.php?type=image&TB_iframe=1');
190
+ window.original_send_to_editor = window.send_to_editor;
191
+ window.send_to_editor = function(html)
192
+ {
193
+ clearInterval(tbframe_interval);
194
+ if(bfUploadImage_settings._custom_upload)
195
+ {
196
+ var value = jQuery(html).attr('href');
197
+
198
+ var parent = container.parent();
199
+ var rem_link = jQuery('a.bf__img_remove', parent);
200
+ var button = jQuery('input.button', parent);
201
+ var img = jQuery('img', parent);
202
+ var img_width = img.attr('width');
203
+ var img_height = img.attr('height');
204
+
205
+ // Update the preview
206
+ parent_prev_width = parent.css('width');
207
+ parent.css({width:'0px'});
208
+ button.fadeOut();
209
+ img.attr({'src':value});
210
+ img.fadeIn('fast');
211
+ parent.animate({'width':parent_prev_width}, 500, function(){rem_link.fadeIn();});
212
+ //end
213
+
214
+ container.val(value);
215
+ tb_remove();
216
+ bfUploadImage_settings._custom_upload = false;
217
+ }
218
+ else
219
+ window.original_send_to_editor(html);
220
+ }
221
+ }
222
+ };
223
+
224
+ return this.each( function(){
225
+
226
+ if ( options ) {
227
+ $.extend( bfUploadImage_settings, options );
228
+ }
229
+ var obj = $(this);
230
+
231
+ $('.__imageupload', obj).click( function(){
232
+ var input_field = $(this).prev();
233
+ bfUploadImage_settings._upload_image(input_field);
234
+ });
235
+ $('.__imageuploadid', obj).click( function(){
236
+ var parent = $(this).parent();
237
+ var input_class = $('a.bf__img_remove', parent).attr('rel');
238
+ var input_field = $('input[name="'+input_class+'"]', parent);
239
+ bfUploadImage_settings._upload_image(input_field);
240
+ });
241
+
242
+ $('a.bf__img_remove', obj).click( function(){
243
+ var a = $(this);
244
+ var parent = a.parent();
245
+ var input_class = a.attr('rel');
246
+ var input_field = $('input[name="'+input_class+'"]', parent);
247
+ var img = $('img', parent);
248
+ var button = $('input.button', parent);
249
+ input_field.val('');
250
+ a.fadeOut('slow', function(){
251
+ img.fadeOut('fast', function(){
252
+ button.fadeIn();
253
+ });
254
+ });
255
+ return false;
256
+ });
257
+
258
+ // hide img if no source
259
+ var img = $('img', obj);
260
+ var button = $('input.button', obj);
261
+ var remove = $('a.bf__img_remove', obj);
262
+ if(img.attr('src')=='')
263
+ {
264
+ img.hide();
265
+ remove.hide();
266
+ }
267
+ else
268
+ {
269
+ button.hide();
270
+ }
271
+
272
+ });
273
+
274
+ };
275
+
276
+ })( jQuery );
277
+
278
+
279
+ jQuery(document).ready( function($){
280
+
281
+ // NAVIGATION
282
+ $('.bf_navs').bfNavigation({container:'.bf_container'});
283
+
284
+ // BIND CLICK
285
+ $('.bf-label.allow-click').bfClicker();
286
+
287
+ // COLOR PICKER
288
+ $('.bf__color').bfColorPicker();
289
+
290
+ // CHECKBOX
291
+ $('.bf__checkbox').bfCheckbox();
292
+
293
+ // RADIO BUTTON
294
+ $('.bf__radio').bfRadio();
295
+
296
+ // UPLOAD IMAGES
297
+ $('.bf__img_preview').bfUploadImage();
298
+
299
+ });
300
+
301
+
302
+
bhittani-framework/admin/js/colorpicker/css/colorpicker.css ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .colorpicker {
2
+ width: 356px;
3
+ height: 176px;
4
+ overflow: hidden;
5
+ position: absolute;
6
+ background: url(../images/colorpicker_background.png);
7
+ font-family: Arial, Helvetica, sans-serif;
8
+ display: none;
9
+ }
10
+ .colorpicker_color {
11
+ width: 150px;
12
+ height: 150px;
13
+ left: 14px;