Changeset 486495
- Timestamp:
- 01/08/2012 12:51:57 PM (14 years ago)
- Location:
- post-ratings
- Files:
-
- 14 added
- 5 edited
-
tags/1.6 (added)
-
tags/1.6/lang (added)
-
tags/1.6/lang/post-ratings.pot (added)
-
tags/1.6/post-ratings.css (added)
-
tags/1.6/post-ratings.js (added)
-
tags/1.6/post-ratings.php (added)
-
tags/1.6/readme.txt (added)
-
tags/1.6/screenshot-1.png (added)
-
tags/1.6/screenshot-2.png (added)
-
tags/1.6/screenshot-3.png (added)
-
tags/1.6/screenshot-4.png (added)
-
tags/1.6/star.png (added)
-
tags/1.6/star.psd (added)
-
tags/1.6/widget.php (added)
-
trunk/lang/post-ratings.pot (modified) (4 diffs)
-
trunk/post-ratings.js (modified) (2 diffs)
-
trunk/post-ratings.php (modified) (37 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/widget.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-ratings/trunk/lang/post-ratings.pot
r476957 r486495 3 3 "Project-Id-Version: Post Ratings\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 201 1-12-18 00:20+0200\n"5 "POT-Creation-Date: 2012-01-05 21:13+0200\n" 6 6 "PO-Revision-Date: \n" 7 7 "Last-Translator: http://digitalnature.eu <hello@digitalnature.eu>\n" … … 17 17 "X-Poedit-SearchPath-1: .\n" 18 18 19 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:1 5620 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:2 5019 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:149 20 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:246 21 21 msgid "Post Ratings" 22 22 msgstr "" 23 23 24 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:1 8124 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:177 25 25 msgid "Settings" 26 26 msgstr "" 27 27 28 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:2 4228 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:238 29 29 msgid "Home" 30 30 msgstr "" 31 31 32 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:2 4332 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:239 33 33 msgid "Archives" 34 34 msgstr "" 35 35 36 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:24 436 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:240 37 37 msgid "Single pages" 38 38 msgstr "" 39 39 40 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:24 540 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:241 41 41 msgid "Search results" 42 42 msgstr "" 43 43 44 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:25 644 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:251 45 45 msgid "Global stats" 46 46 msgstr "" 47 47 48 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:25 848 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:253 49 49 #, php-format 50 50 msgid "%1$s votes (on %2$s posts)" 51 51 msgstr "" 52 52 53 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:25 953 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:254 54 54 #, php-format 55 55 msgid "Average vote count per post: %s" 56 56 msgstr "" 57 57 58 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:2 6058 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:255 59 59 #, php-format 60 60 msgid "Average rating per post: %s" 61 61 msgstr "" 62 62 63 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:26 963 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:264 64 64 msgid "Access level" 65 65 msgstr "" 66 66 67 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:2 7367 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:268 68 68 msgid "Allow unregistered users to vote" 69 69 msgstr "" 70 70 71 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:27 971 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:274 72 72 msgid "Maximum rating" 73 73 msgstr "" 74 74 75 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:2 8275 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:277 76 76 msgid "Changing this option will reset existing post rating records" 77 77 msgstr "" 78 78 79 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:28 779 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:283 80 80 msgid "Bayesian rating (score) formula" 81 81 msgstr "" 82 82 83 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:3 1083 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:306 84 84 msgid "I have my own formula:" 85 85 msgstr "" 86 86 87 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:316 87 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:308 88 msgid "Legend" 89 msgstr "" 90 91 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:313 88 92 msgid "Global average number of votes per post" 89 93 msgstr "" 90 94 91 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:31 895 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:315 92 96 msgid "Global number of votes (from all posts)" 93 97 msgstr "" 94 98 95 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:3 2099 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:317 96 100 msgid "Number of votes from the current post" 97 101 msgstr "" 98 102 99 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:3 22103 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:319 100 104 #, php-format 101 105 msgid "Global average rating per post (from 1 to %d)" 102 106 msgstr "" 103 107 104 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:32 4108 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:321 105 109 #, php-format 106 110 msgid "Average rating of the current post (from 1 to %d)" 107 111 msgstr "" 108 112 109 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:32 6113 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:323 110 114 #, php-format 111 115 msgid "Minimum vote count per post to consider (%d by default)" 112 116 msgstr "" 113 117 114 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:32 8118 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:325 115 119 #, php-format 116 120 msgid "Maximum rating, see option above (currently %d)" 117 121 msgstr "" 118 122 119 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:33 6123 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:334 120 124 msgid "Allow ratings on" 121 125 msgstr "" 122 126 123 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:35 2127 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:350 124 128 msgid "Locations of the rate links" 125 129 msgstr "" 126 130 127 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:35 8131 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:356 128 132 msgid "Before post content" 129 133 msgstr "" 130 134 131 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:36 3135 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:361 132 136 msgid "After post content " 133 137 msgstr "" 134 138 135 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:36 8139 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:366 136 140 msgid "I have my own action hook:" 137 141 msgstr "" 138 142 139 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:37 4143 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:372 140 144 #, php-format 141 145 msgid "You can also add it manually anywhere by using the %s shortcode" 142 146 msgstr "" 143 147 144 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:3 81148 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:379 145 149 msgid "Page visibility" 146 150 msgstr "" 147 151 148 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php: 401152 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:399 149 153 msgid "Save Changes" 150 154 msgstr "" 151 155 152 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:40 5156 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:403 153 157 msgid "Delete rating records from all posts" 154 158 msgstr "" 155 159 156 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:5 12160 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:502 157 161 msgid "Invalid vote! Cheatin' uh?" 158 162 msgstr "" 159 163 160 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:5 76164 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:563 161 165 msgid "You cannot rate this post!" 162 166 msgstr "" 163 167 164 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:6 64168 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:652 165 169 #, php-format 166 170 msgid "%1$s vote, %2$s avg. rating (%3$s%% score)" … … 169 173 msgstr[1] "" 170 174 171 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:6 95175 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:685 172 176 #, php-format 173 177 msgid "Your '%s' action is must run in a post's context!" 174 178 msgstr "" 175 179 176 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:7 23180 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/post-ratings.php:715 177 181 #, php-format 178 182 msgid "Give %1$d out of %2$d stars" … … 180 184 181 185 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:28 182 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:3 4183 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:3 64184 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:3 97185 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:4 98186 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:35 187 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:341 188 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:375 189 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:474 186 190 msgid "Top Rated" 187 191 msgstr "" 188 192 189 193 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:29 190 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:3 63194 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:340 191 195 msgid "The highest rated posts on your site" 192 196 msgstr "" 193 197 194 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:1 39195 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:1 42198 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:117 199 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:120 196 200 #, php-format 197 201 msgid "%s out of 10" 198 202 msgstr "" 199 203 200 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:256 201 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:508 204 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:187 205 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:288 206 msgid "Show More" 207 msgstr "" 208 209 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:234 210 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:484 202 211 msgid "Title:" 203 212 msgstr "" 204 213 205 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:2 61206 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php: 513214 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:239 215 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:489 207 216 msgid "Get most rated:" 208 217 msgstr "" 209 218 219 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:249 220 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:499 221 msgid "Sort by:" 222 msgstr "" 223 224 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:251 225 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:501 226 msgid "Overall bayesian rating (score)" 227 msgstr "" 228 229 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:252 230 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:502 231 msgid "Average rating" 232 msgstr "" 233 234 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:253 235 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:503 236 msgid "Number of votes" 237 msgstr "" 238 239 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:260 240 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:510 241 msgid "Descending" 242 msgstr "" 243 244 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:265 245 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:515 246 msgid "Ascending" 247 msgstr "" 248 249 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:270 250 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:520 251 msgid "Ignore posts older than:" 252 msgstr "" 253 210 254 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:271 255 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:521 256 msgid "days" 257 msgstr "" 258 259 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:273 211 260 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:523 212 msgid "Sort by:" 213 msgstr "" 214 215 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:273 216 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:525 217 msgid "Overall bayesian rating (score)" 218 msgstr "" 219 220 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:274 221 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:526 222 msgid "Average rating" 223 msgstr "" 224 225 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:275 261 msgid "(0 to ignore date)" 262 msgstr "" 263 264 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:277 265 msgid "Thumbnail Size:" 266 msgstr "" 267 268 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:278 269 msgid "pixels" 270 msgstr "" 271 272 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:282 226 273 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:527 227 msgid "Number of votes" 228 msgstr "" 229 230 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:282 231 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:534 232 msgid "Descending" 233 msgstr "" 234 235 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:287 236 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:539 237 msgid "Ascending" 238 msgstr "" 239 240 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:292 241 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:544 242 msgid "Ignore posts older than:" 243 msgstr "" 244 245 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:293 246 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:545 247 msgid "days" 274 msgid "Limit:" 275 msgstr "" 276 277 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:288 278 #, php-format 279 msgid "Display %s Link" 248 280 msgstr "" 249 281 250 282 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:295 251 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:547252 msgid "(0 to ignore date)"253 msgstr ""254 255 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:299256 msgid "Thumbnail Size:"257 msgstr ""258 259 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:300260 msgid "pixels"261 msgstr ""262 263 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:305264 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:551265 msgid "Limit:"266 msgstr ""267 268 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:311269 #, php-format270 msgid "Display %s Link"271 msgstr ""272 273 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:311274 msgid "Show More"275 msgstr ""276 277 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:318278 283 #, php-format 279 284 msgid "Read the %s to see all available keywords." 280 285 msgstr "" 281 286 282 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php: 318287 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:295 283 288 msgid "documentation" 284 289 msgstr "" 285 290 286 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:3 27291 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:304 287 292 #, php-format 288 293 msgid "<strong>Important:</strong> %1$s sized thumbnails have to be created if you just added this widget, or if you're changing the thumbnail size. Read more about thumbnail sizes %2$s" 289 294 msgstr "" 290 295 291 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:3 27296 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:304 292 297 msgid "here" 293 298 msgstr "" 294 299 295 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:4 27300 #: c:\wamp\www\wpmu\wp-content\plugins\post-ratings/widget.php:403 296 301 #, php-format 297 302 msgid "%d vote" -
post-ratings/trunk/post-ratings.js
r466038 r486495 2 2 jQuery(document).ready(function($){ 3 3 4 // @todo: use $.on in future versions , when 1.74 // @todo: use $.on in future versions (jQuery 1.7+) 5 5 $(document).delegate('.rating:not(.rated) a', 'click', function(){ 6 6 … … 29 29 }else{ 30 30 control.removeClass('loading').addClass('rated'); 31 $('.now', control).width(response.rating * 16).parents('ul').attr('title', response. rating + '/' + response.max_rating);31 $('.now', control).width(response.rating * 16).parents('ul').attr('title', response.text); 32 32 $('.meta', control).html(response.status); 33 34 // other plugin can hook into this event... 35 control.trigger('rated_post', response); 33 36 } 34 37 -
post-ratings/trunk/post-ratings.php
r483864 r486495 2 2 /* 3 3 Plugin Name: Post Ratings 4 Version: 1. 54 Version: 1.6 5 5 Plugin URI: http://digitalnature.eu/forum/plugins/post-ratings/ 6 6 Description: Simple, developer-friendly, straightforward post rating plugin. Relies on post meta to store avg. rating / vote count. … … 30 30 31 31 32 /* *32 /* 33 33 * PostRatings Class 34 34 * … … 40 40 41 41 const 42 VERSION = '1. 5', // plugin version42 VERSION = '1.6', // plugin version 43 43 ID = 'post_ratings', // internally used for text domain, theme option group name etc. 44 44 MIN_VOTES = 1, // minimum vote count (MV) 45 45 BR1 = '(v / (v + MV)) * r + (MV / (v + MV)) * R', // bayesian rating formula (the IMDB version) 46 BR2 = '((AV * R) + (v * r)) / (AV + v)'; // thebroth.com version46 BR2 = '((AV * R) + (v * r)) / (AV + v)'; // bayesian rating formula (thebroth.com version) 47 47 48 48 … … 50 50 // this will be a singleton instance 51 51 // we can call any public methods below trough PostRatings::app(), without having to worry about instantiation, globals etc. 52 pr ivatestatic $instance;53 54 55 56 /**57 * This will instantiate the class if needed, and return the only class instance if not...58 *59 * @since 1.060 */52 protected static $instance; 53 54 55 56 /* 57 * This will instantiate the class if needed, and return the only class instance if not... 58 * 59 * @since 1.0 60 */ 61 61 public static function app(){ 62 62 … … 67 67 68 68 // localize 69 $locale = get_locale();70 $locale_file = dirname(plugin_basename(__FILE__))."/lang/{$locale}.php";71 if(is_readable($locale_file))72 require_once($locale_file);73 74 69 load_plugin_textdomain(self::ID, false, dirname(plugin_basename(__FILE__)).'/lang'); 75 70 … … 80 75 }else{ 81 76 add_action('wp', array(self::$instance, 'Run')); 82 83 77 } 84 78 … … 93 87 } 94 88 95 96 89 return self::$instance; 97 90 } … … 99 92 100 93 101 /**102 * A single instance only103 *104 * @since 1.0105 */94 /* 95 * A single instance only 96 * 97 * @since 1.0 98 */ 106 99 final protected function __construct(){} 107 100 108 101 109 102 110 /**111 * No cloning112 *113 * @since 1.0114 */103 /* 104 * No cloning 105 * 106 * @since 1.0 107 */ 115 108 final protected function __clone(){} 116 109 117 110 118 111 119 /**120 * Plugin options.121 * If an option doesn't exist in the db, the default value will be returned instead122 *123 * @since1.0124 * @param string $single_option_reqOptional, if passed the function will return the value of this option125 * @returnarray|string126 */112 /* 113 * Plugin options. 114 * If an option doesn't exist in the db, the default value will be returned instead 115 * 116 * @since 1.0 117 * @param string $single_option_req Optional, if passed the function will return the value of this option 118 * @return array|string 119 */ 127 120 public function Options($single_option_req = ''){ 128 121 … … 148 141 149 142 150 /**151 * Hook our plugin options menu / page152 *153 * @since 1.0154 */143 /* 144 * Hook our plugin options menu / page 145 * 146 * @since 1.0 147 */ 155 148 public function CreateMenu(){ 156 149 add_options_page(__('Post Ratings', self::ID), __('Post Ratings', self::ID), 'manage_options', self::ID, array(&$this, 'SettingsPage')); … … 159 152 160 153 161 /**162 * Register our setting with the new useless Settings API bloat...163 *164 * @since 1.0165 */154 /* 155 * Register our setting with the new useless Settings API bloat... 156 * 157 * @since 1.0 158 */ 166 159 public function RegisterSettings(){ 167 160 register_setting(self::ID, self::ID, array(&$this, 'ValidateSettings')); … … 171 164 172 165 173 /** 174 * Settings link in the plugin list 175 * 176 * @since 1.0 177 */ 166 /* 167 * Settings link in the plugin list 168 * 169 * @since 1.0 170 * @param string $file 171 * @param array $links 172 * @return array 173 */ 178 174 public function PluginSettingsLink($links, $file){ 179 175 … … 188 184 189 185 190 /**191 * Validate our settings192 *193 * @param array $input194 * @return array195 * @since 1.0196 */186 /* 187 * Validate our settings 188 * 189 * @since 1.0 190 * @param array $input 191 * @return array 192 */ 197 193 public function ValidateSettings($input){ 198 194 … … 229 225 230 226 231 /**232 * The options page (form)233 *234 * @since 1.0235 */227 /* 228 * The options page (form) 229 * 230 * @since 1.0 231 */ 236 232 public function SettingsPage(){ 237 233 … … 249 245 <div class="wrap metabox-holder"> 250 246 <h2><?php _e('Post Ratings', self::ID); ?></h2> 251 252 247 253 248 <form method="post" action="options.php" style="position:relative;"> … … 285 280 286 281 <tr valign="top"> 287 <th scope="row"><?php _e('Bayesian rating (score) formula', self::ID); ?></th> 282 <th scope="row"> 283 <?php _e('Bayesian rating (score) formula', self::ID); ?> 284 </th> 288 285 <td> 289 286 … … 304 301 </p> 305 302 306 307 303 <p> 308 304 <label for="user_formula"> … … 310 306 <?php _e('I have my own formula:'); ?> 311 307 <input <?php if(!current_user_can('edit_plugins')): ?>disabled="disabled"<?php endif; ?> type=text name="<?php echo self::ID; ?>[user_formula]" size="46" class="code" value="<?php echo $user_formula; ?>" /> 312 </label> 308 </label> <a href="#" onclick="jQuery('#legend').toggle();">(<?php _e('Legend', self::ID); ?>)</a> 313 309 </p> 314 310 315 <p> 311 <div id="legend" style="display:none;"> 312 <p> 316 313 <code style="font-size: 14px;"><strong>AV</strong></code> = <?php _e('Global average number of votes per post', self::ID); ?> 317 314 <br /> 318 315 <code style="font-size: 14px;"><strong> V</strong></code> = <?php _e('Global number of votes (from all posts)', self::ID); ?> 319 316 <br /> 320 <code style="font-size: 14px;"><em> v</em></code> = <?php _e( "Number of votes from the current post", self::ID); ?>317 <code style="font-size: 14px;"><em> v</em></code> = <?php _e('Number of votes from the current post', self::ID); ?> 321 318 <br /> 322 319 <code style="font-size: 14px;"><strong> R</strong></code> = <?php printf(__('Global average rating per post (from 1 to %d)', self::ID), $max_rating); ?> 323 320 <br /> 324 <code style="font-size: 14px;"><em> r</em></code> = <?php printf(__( "Average rating of the current post (from 1 to %d)", self::ID), $max_rating); ?>321 <code style="font-size: 14px;"><em> r</em></code> = <?php printf(__('Average rating of the current post (from 1 to %d)', self::ID), $max_rating); ?> 325 322 <br /> 326 323 <code style="font-size: 14px;"><strong>MV</strong></code> = <?php printf(__('Minimum vote count per post to consider (%d by default)', self::ID), self::MIN_VOTES); ?> … … 328 325 <code style="font-size: 14px;"><strong>MR</strong></code> = <?php printf(__('Maximum rating, see option above (currently %d)', self::ID), $max_rating); ?> 329 326 </p> 327 </div> 330 328 331 329 </fieldset> … … 419 417 420 418 421 /** 422 * Javascript used by the plugin 423 * 424 * @since 1.0 425 */ 426 public function JS(){ 427 419 /* 420 * Javascript and CSS used by the plugin 421 * 422 * @since 1.0 423 */ 424 public function assets(){ 425 426 // js 428 427 wp_enqueue_script('jquery'); 429 428 wp_enqueue_script(self::ID, plugins_url('post-ratings.js', __FILE__), array('jquery'), self::VERSION, true); … … 432 431 if(!class_exists('Atom') && (!defined('Atom::VERSION'))) 433 432 wp_localize_script(self::ID, 'post_ratings', array('blog_url' => home_url('/'))); 434 } 435 436 437 438 /** 439 * CSS used by the plugin 440 * 441 * @since 1.0 442 */ 443 public function CSS(){ 433 434 // css 444 435 wp_enqueue_style(self::ID, plugins_url('post-ratings.css', __FILE__)); 445 436 } … … 447 438 448 439 449 /**450 * Remove plugin options and rating stats on uninstall451 *452 * @since 1.0453 */440 /* 441 * Remove plugin options and rating stats on uninstall 442 * 443 * @since 1.0 444 */ 454 445 public static function Uninstall(){ 455 446 PostRatings::app()->DeleteRatingRecords(); … … 459 450 460 451 461 /**462 * Get user rating for a post463 *464 * @param int $post_id Post ID465 * @since 1.0466 * @return arrayRating and vote count467 */452 /* 453 * Get user rating for a post 454 * 455 * @since 1.0 456 * @param int $post_id Post ID 457 * @return array Rating and vote count 458 */ 468 459 public function getRating($post_id){ 469 460 return array((float)get_post_meta($post_id, 'rating', true), (int)get_post_meta($post_id, 'votes', true)); … … 472 463 473 464 474 /**475 * Process rating, or set up plugin hooks if this is not a rate request476 *477 * @since 1.0478 */465 /* 466 * Process rating, or set up plugin hooks if this is not a rate request 467 * 468 * @since 1.0 469 */ 479 470 public function Run(){ 480 471 … … 495 486 } 496 487 497 add_action('wp_print_scripts', array(&$this, 'JS')); 498 add_action('wp_print_styles', array(&$this, 'CSS')); 488 add_action('wp_enqueue_scripts', array(&$this, 'assets')); 499 489 500 490 // this is our $.ajax request … … 554 544 array_shift($ip_cache[$post_id]); 555 545 556 set_transient('post_ratings_ip_cache', $ip_cache, 60 *60*24*14);546 set_transient('post_ratings_ip_cache', $ip_cache, 60 * 60 * 24 * 14); 557 547 558 548 // update user meta … … 566 556 $posts_rated = array_slice($posts_rated, -20); // keep it under 20 entries 567 557 $posts_rated[] = $post_id; 568 setcookie('posts_rated', implode('-', $posts_rated), time() + 60*60*24*90, '/'); // keep it for 90 days 569 570 571 558 setcookie('posts_rated', implode('-', $posts_rated), time() + 60 * 60 * 24 * 90, '/'); // keep it for 90 days 572 559 573 560 do_action('rated_post', $post_id); … … 583 570 'error' => $error, 584 571 'rating' => sprintf('%.2F', $rating), 572 'text' => esc_attr(apply_filters('post_ratings_current_rating', sprintf('%.2F / %d', $rating, $max_rating), $rating, $max_rating)), 585 573 'max_rating' => $max_rating, 586 574 'votes' => $votes, … … 596 584 597 585 598 /**599 * Delete all ratings-related meta data from the database600 *601 * @since 1.0602 */586 /* 587 * Delete all ratings-related meta data from the database 588 * 589 * @since 1.0 590 */ 603 591 public function DeleteRatingRecords(){ 604 592 … … 621 609 622 610 623 /**624 * Return a string with the rating and vote count info625 *626 * @since1.0627 * @paramint $rating628 * @paramint $votes629 * @returnstring630 */611 /* 612 * Return a string with the rating and vote count info 613 * 614 * @since 1.0 615 * @param int $rating 616 * @param int $votes 617 * @return string 618 */ 631 619 public function FormatRatingMeta($rating, $votes){ 632 620 … … 662 650 } 663 651 664 returnsprintf(_n('%1$s vote, %2$s avg. rating (%3$s%% score)', '%1$s votes, %2$s avg. rating (%3$s%% score)', $votes, self::ID),652 $text = sprintf(_n('%1$s vote, %2$s avg. rating (%3$s%% score)', '%1$s votes, %2$s avg. rating (%3$s%% score)', $votes, self::ID), 665 653 sprintf('<strong>%d</strong>', $votes), sprintf('<strong>%.2F</strong>', $rating), sprintf('<strong>%d</strong>', $bayesian_rating)); 666 } 667 668 669 670 /** 671 * The rate links 672 * 673 * @param string $content 674 * @param int $post_id 675 * @param bool $ignore_visibility_setting 676 * @return string 677 * @since 1.0 678 */ 654 655 return apply_filters('post_ratings_meta_text', $text, $votes, $rating, $bayesian_rating); 656 } 657 658 659 660 /* 661 * The rate links 662 * 663 * @since 1.0 664 * @param string $content 665 * @param int $post_id 666 * @param bool $ignore_visibility_setting 667 * @return string 668 */ 679 669 public function Control($content = '', $post_id = '', $ignore_visibility_setting = false){ 680 670 global $post, $wp_current_filter; … … 715 705 $can_rate = $this->CurrentUserCanRate($post_id); 716 706 707 $current_rating = apply_filters('post_ratings_current_rating', sprintf('%.2F / %d', $rating, $max_rating), $rating, $max_rating); 708 717 709 $control[] = '<div class="rating">'; 718 $control[] = '<ul '.(!$can_rate ? 'class="rated"' : '').' data-post="'.$post_id.'" style="width:'.($max_rating * 16).'px" title="'. sprintf('%.2F / %d', $rating, $max_rating).'">';710 $control[] = '<ul '.(!$can_rate ? 'class="rated"' : '').' data-post="'.$post_id.'" style="width:'.($max_rating * 16).'px" title="'.esc_attr($current_rating).'">'; 719 711 $control[] = '<li class="now" style="width:'.($rating * 16).'px"></li>'; 720 712 721 713 if($can_rate) 722 for($i = 1; $i <= $max_rating; $i++) 723 $control[] = '<li class="s'.$i.'"><a title="'.sprintf(__('Give %1$d out of %2$d stars', self::ID), $i, $max_rating).'">'.sprintf('%d / %d', $i, $max_rating).'</a></li>'; 714 for($i = 1; $i <= $max_rating; $i++){ 715 $title = apply_filters('post_ratings_control_title', sprintf(__('Give %1$d out of %2$d stars', self::ID), $i, $max_rating), $i, $max_rating); 716 $text = apply_filters('post_ratings_control_text', sprintf('%d / %d', $i, $max_rating), $i, $max_rating); 717 $control[] = '<li class="s'.$i.'"><a title="'.esc_attr($title).'">'.$text.'</a></li>'; 718 } 724 719 725 720 $control[] = '</ul>'; … … 728 723 729 724 $control = implode("\n", $control); 730 731 725 732 726 // this is the user's custom action, so directly output the HTML … … 759 753 760 754 761 /**762 * Checks if the current user can rate a post.763 *764 * @since1.0765 * @param int $post_idPost ID to check766 * @returnbool767 */755 /* 756 * Checks if the current user can rate a post. 757 * 758 * @since 1.0 759 * @param int $post_id Post ID to check 760 * @return bool 761 */ 768 762 public function CurrentUserCanRate($post_id){ 769 763 … … 775 769 $ip_cache = get_transient('post_ratings_ip_cache'); 776 770 $posts_rated = isset($_COOKIE['posts_rated']) ? explode('-', $_COOKIE['posts_rated']) : array(); 777 $user_ip = $_SERVER['REMOTE_ADDR'];771 $user_ip = $_SERVER['REMOTE_ADDR']; 778 772 779 773 if(is_user_logged_in()){ … … 791 785 792 786 793 /**794 * Get a list of most rated posts.795 * The results are returned as an array of objects796 *797 * @since1.0798 * @param array $args Arguments799 * @returnarray800 */787 /* 788 * Get a list of most rated posts. 789 * The results are returned as an array of objects 790 * 791 * @since 1.0 792 * @param array $args Arguments, see below 793 * @return array 794 */ 801 795 public function getTopRated($args){ 802 796 global $wpdb; … … 874 868 875 869 876 /**877 * The [rate] shortcode878 *879 * @since1.0880 * @params string $attsCan accept the post ID as argument; if not given, control() will use the $post global881 * @returnstring870 /* 871 * The [rate] shortcode 872 * 873 * @since 1.0 874 * @params array $atts Can accept the post ID as argument; if not given, control() will use the $post global 875 * @return string 882 876 */ 883 877 public function Shortcode($atts){ 884 885 $post_id = (isset($atts[0])) ? (int)$atts[0] : ''; 886 887 return $this->Control('', $post_id); 888 } 889 890 891 892 /** 893 * Register the "Top Rated" widget -- @todo 894 * 895 * @since 1.0 896 */ 878 return $this->Control('', (isset($atts[0])) ? (int)$atts[0] : ''); 879 } 880 881 882 883 /* 884 * Register the "Top Rated" widget 885 * 886 * @since 1.0 887 */ 897 888 public function Widget(){ 898 889 require dirname(__FILE__).'/widget.php'; … … 902 893 903 894 } 904 -
post-ratings/trunk/readme.txt
r483864 r486495 73 73 == Changelog == 74 74 75 = 1.6 = 76 * Added a few filter tags (and a javascript event on succesful rate), so the output can be easily changed 77 75 78 = 1.5 = 76 79 * Fixed a js issue with voting introduced by mistake in 1.4 -
post-ratings/trunk/widget.php
r483864 r486495 3 3 4 4 // if this an Atom theme make a special widget for it ;) 5 if(class_exists('Atom ') && (defined('Atom::VERSION'))){6 7 8 /**9 * Atom Top Rated Widget10 *11 * @since 1.012 */5 if(class_exists('AtomWidget') && (defined('Atom::VERSION'))){ 6 7 8 /* 9 * Atom Top Rated Widget 10 * 11 * @since 1.0 12 */ 13 13 class PostRatingsWidget extends AtomWidget{ 14 14 15 15 16 16 17 /**18 * Initialization19 *20 * @see AtomWidget::set and WP_Widget::__construct21 */17 /* 18 * Initialization 19 * 20 * @see AtomWidget::set and WP_Widget::__construct 21 */ 22 22 public function __construct(){ 23 23 … … 92 92 93 93 extract($args); 94 $app = &Atom::app();95 94 96 95 $posts = PostRatings::app()->getTopRated(array( … … 108 107 foreach($posts as $index => $post){ 109 108 110 $app->post = $post;109 atom()->post = $post; 111 110 $output[] = '<li>'; 112 111 113 $avg_rating = $app->post->get('rating');114 $bayesian_rating = $app->post->get('bayesian_rating');112 $avg_rating = atom()->post->get('rating'); 113 $bayesian_rating = atom()->post->get('bayesian_rating'); 115 114 116 115 … … 122 121 123 122 $fields = array( 124 'TITLE' => $app->post->getTitle(),125 'COMMENT_COUNT' => $app->post->getCommentCount(),126 'THUMBNAIL' => $app->post->getThumbnail(str_replace('instance-', '', $id)),127 'URL' => $app->post->getURL(),128 'CONTENT' => convert_smilies( $app->post->getContent(150, array(123 'TITLE' => atom()->post->getTitle(), 124 'COMMENT_COUNT' => atom()->post->getCommentCount(), 125 'THUMBNAIL' => atom()->post->getThumbnail(str_replace('instance-', '', $id)), 126 'URL' => atom()->post->getURL(), 127 'CONTENT' => convert_smilies(atom()->post->getContent(150, array( 129 128 'allowed_tags' => Atom::SAFE_INLINE_TAGS, 130 129 'more' => '[…]', … … 134 133 'BAYESIAN_RATING_BAR' => $bayesian_rating_bar, 135 134 'AVG_RATING_BAR' => $avg_rating_bar, 136 'VOTES' => (int) $app->post->get('votes'),135 'VOTES' => (int)atom()->post->get('votes'), 137 136 'MAX_RATING' => $max_rating, 138 'EXCERPT' => $app->post->getContent('e'),139 'DATE' => $app->post->getDate('relative'),140 'AUTHOR' => $app->post->author->getName(),141 'CATEGORIES' => strip_tags( $app->post->getTerms('category')),142 'TAGS' => strip_tags( $app->post->getTerms()),143 'VIEWS' => number_format_i18n( $app->post->getViews()),137 'EXCERPT' => atom()->post->getContent('e'), 138 'DATE' => atom()->post->getDate('relative'), 139 'AUTHOR' => atom()->post->author->getName(), 140 'CATEGORIES' => strip_tags(atom()->post->getTerms('category')), 141 'TAGS' => strip_tags(atom()->post->getTerms()), 142 'VIEWS' => number_format_i18n(atom()->post->getViews()), 144 143 'INDEX' => isset($posts->current_post) ? ($posts->current_post + 1) : $index, 145 'ID' => $app->post->getID(),144 'ID' => atom()->post->getID(), 146 145 ); 147 146 148 147 149 $fields = apply_filters('atom_widget_top_rated_keywords', $fields, $app->post, $args);148 $fields = apply_filters('atom_widget_top_rated_keywords', $fields, atom()->post, $args); 150 149 151 150 // output template 152 $output[] = $app->getBlockTemplate($template, $fields);151 $output[] = atom()->getBlockTemplate($template, $fields); 153 152 154 153 $output[] = '</li>'; 155 154 } 156 155 157 $app->resetCurrentPost();156 atom()->resetCurrentPost(); 158 157 159 158 return implode("\n", $output); … … 176 175 177 176 if(empty($posts)) 178 return Atom::app()->log("No rated posts found in {$args['widget_id']} ({$args['widget_name']}). Widget marked as inactive");177 return atom()->log("No rated posts found in {$args['widget_id']} ({$args['widget_name']}). Widget marked as inactive"); 179 178 180 179 $output = $before_widget; … … 185 184 $output .= "<ul class=\"menu fadeThis ratings clear-block\">\n{$posts}\n</ul>\n"; 186 185 187 if($instance['more'] && $next && Atom::app()->options('jquery')){186 if($instance['more'] && $next && atom()->options('jquery')){ 188 187 $output .= '<div class="fadeThis clear-block"><a href="#" class="more" data-count="'.$instance['number'].'">'.__('Show More', PostRatings::ID).'</a></div>'; 189 188 $output .= $this->getShowMoreCtrl('get_top_rated'); … … 199 198 200 199 201 /**202 * Saves the widget options203 *204 * @see WP_Widget::update205 */200 /* 201 * Saves the widget options 202 * 203 * @see WP_Widget::update 204 */ 206 205 public function update($new_instance, $old_instance){ 207 206 … … 280 279 </p> 281 280 282 283 281 <p> 284 282 <label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Limit:', PostRatings::ID); ?></label> … … 287 285 288 286 <p> 289 <input <?php if(! Atom::app()->options('jquery')) echo "disabled=\"disabled\""; ?> type="checkbox" id="<?php echo $this->get_field_id('more'); ?>" name="<?php echo $this->get_field_name('more'); ?>"<?php checked($instance['more']); ?> />290 <label for="<?php echo $this->get_field_id('more'); ?>" <?php if(! Atom::app()->options('jquery')) echo "class=\"disabled\""; ?>><?php printf(__('Display %s Link', PostRatings::ID), '<code>'.__('Show More', PostRatings::ID).'</code>'); ?></label>287 <input <?php if(!atom()->options('jquery')) echo "disabled=\"disabled\""; ?> type="checkbox" id="<?php echo $this->get_field_id('more'); ?>" name="<?php echo $this->get_field_name('more'); ?>"<?php checked($instance['more']); ?> /> 288 <label for="<?php echo $this->get_field_id('more'); ?>" <?php if(!atom()->options('jquery')) echo "class=\"disabled\""; ?>><?php printf(__('Display %s Link', PostRatings::ID), '<code>'.__('Show More', PostRatings::ID).'</code>'); ?></label> 291 289 </p> 292 290 … … 325 323 326 324 327 /**328 * Top Rated posts widget329 *330 * @since 1.0331 */325 /* 326 * Top Rated posts widget 327 * 328 * @since 1.0 329 */ 332 330 class PostRatingsWidget extends WP_Widget{ 333 331 334 332 335 333 336 /**337 * @see WP_Widget::__construct338 * @since 1.0339 */334 /* 335 * @since 1.0 336 * @see WP_Widget::__construct 337 */ 340 338 function __construct(){ 341 339 … … 352 350 353 351 354 /**355 * @see WP_Widget::widget356 * @since 1.0357 */352 /* 353 * @since 1.0 354 * @see WP_Widget::widget 355 */ 358 356 public function widget($args, $instance){ 359 357 global $post; 360 358 359 extract($args); 360 361 361 $cache = wp_cache_get('widget_top_rated', 'widget'); 362 $options = PostRatings::app()->options();363 $output = array();364 362 365 363 if(!is_array($cache)) 366 364 $cache = array(); 367 365 368 if(isset($cache[$ args['widget_id']])){369 echo $cache[$ args['widget_id']];366 if(isset($cache[$widget_id])){ 367 echo $cache[$widget_id]; 370 368 return; 371 369 } 372 370 373 extract($args); 371 $output = array(); 372 $options = PostRatings::app()->options(); 374 373 extract($options); 375 374 376 $title = apply_filters('widget_title', empty($instance['title']) ? __('Top Rated', PostRatings::ID) : $instance['title'], $instance, $this->id_base);377 $number = min(max((int)$instance['number'], 1), 20);375 $title = apply_filters('widget_title', empty($instance['title']) ? __('Top Rated', PostRatings::ID) : $instance['title'], $instance, $this->id_base); 376 $number = min(max((int)$instance['number'], 1), 20); 378 377 $date_limit = min(max((int)$instance['date_limit'], 0), 999); 379 $post_type = post_type_exists($instance['post_type']) ? $instance['post_type'] : 'post'; 380 381 // order by / where clauses 382 $sort = isset($instance['sort']) ? esc_attr($instance['sort']) : 'bayesian_rating'; 378 $post_type = post_type_exists($instance['post_type']) ? $instance['post_type'] : 'post'; 379 $sort = isset($instance['sort']) ? esc_attr($instance['sort']) : 'bayesian_rating'; 383 380 384 381 $output[] = $before_widget; … … 426 423 echo $output; 427 424 428 $cache[$ args['widget_id']] = $output;425 $cache[$widget_id] = $output; 429 426 wp_cache_set('widget_top_rated', $cache, 'widget'); 430 427 } … … 432 429 433 430 434 /**435 * @see WP_Widget::update436 * @since 1.0437 */431 /* 432 * @since 1.0 433 * @see WP_Widget::update 434 */ 438 435 public function update($new_instance, $old_instance){ 439 436 … … 456 453 457 454 458 /**459 * Clears widget cache.460 * Should run after a post has been rated, deleted, edited etc...461 *462 * @since 1.0463 */455 /* 456 * Clears widget cache. 457 * Should run after a post has been rated, deleted, edited etc... 458 * 459 * @since 1.0 460 */ 464 461 public function flush_widget_cache(){ 465 462 wp_cache_delete('widget_top_rated', 'widget'); … … 468 465 469 466 470 /**471 * @see WP_Widget::form472 * @since 1.0473 */467 /* 468 * @since 1.0 469 * @see WP_Widget::form 470 */ 474 471 public function form($instance){ 475 472 … … 534 531 <?php 535 532 } 536 } 533 534 } 537 535 538 536
Note: See TracChangeset
for help on using the changeset viewer.