Changeset 8071
- Timestamp:
- 02/26/07 06:05:33 (1 year ago)
- Files:
-
- wp-stats/trunk/readme.html (modified) (1 diff)
- wp-stats/trunk/stats/stats.php (modified) (10 diffs)
- wp-stats/trunk/stats/wp-stats.pot (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wp-stats/trunk/readme.html
r7998 r8071 288 288 <b>Version 2.11 (01-05-2007)</b> 289 289 <ul> 290 <li>NEW: Post Categories Are Now Hierarchical</li> 291 <li>NEW: Used WordPress's Date/Time Format</li> 290 292 <li>FIXED: Missing WHERE in get_authorsstats()</li> 291 293 <li>FIXED: Password Protected Post Comments Viewable On Comment Author Stats</li> 294 <li>FIXED: Wrong URL For Page Under Certain Stat Posts Listing</li> 292 295 </ul> 293 296 </li> wp-stats/trunk/stats/stats.php
r7998 r8071 134 134 $where = '1=1'; 135 135 } 136 $recentposts = $wpdb->get_results("SELECT $wpdb->posts. ID, post_title, post_name, post_status, post_date, user_login, display_nameFROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER BY post_date DESC LIMIT $limit");136 $recentposts = $wpdb->get_results("SELECT $wpdb->posts.*, $wpdb->users.* FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER BY post_date DESC LIMIT $limit"); 137 137 if($recentposts) { 138 138 foreach ($recentposts as $post) { 139 $post_title = htmlspecialchars(stripslashes($post->post_title));140 $post_date = mysql2date('d.m.Y', $post->post_date);141 $display_name = stripslashes($post->display_name);139 $post_title = get_the_title(); 140 $post_date = get_the_time(get_option('date_format').' @ '.get_option('time_format')); 141 $display_name = get_the_author(); 142 142 $temp .= "<li>$post_date - <a href=\"".get_permalink()."\" title=\"".sprintf(__('View post %s', 'wp-stats'), $post_title)."\">$post_title</a> ($display_name)</li>\n"; 143 143 } … … 163 163 $where = '1=1'; 164 164 } 165 $recentcomments = $wpdb->get_results("SELECT $wpdb->posts. ID, post_title, post_name, post_status, comment_author, post_date, comment_date FROM $wpdb->posts INNER JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER BY comment_date DESC LIMIT $limit");165 $recentcomments = $wpdb->get_results("SELECT $wpdb->posts.*, comment_date FROM $wpdb->posts INNER JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER BY comment_date DESC LIMIT $limit"); 166 166 if($recentcomments) { 167 167 foreach ($recentcomments as $post) { 168 $post_title = htmlspecialchars(stripslashes($post->post_title));168 $post_title = get_the_title(); 169 169 $comment_author = htmlspecialchars(stripslashes($post->comment_author)); 170 $comment_date = mysql2date('d.m.Y @ H:i', $post->comment_date);170 $comment_date = get_the_time(get_option('date_format')); 171 171 $temp .= "<li>$comment_date - $comment_author (<a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">$post_title</a>)</li>\n"; 172 172 } … … 192 192 $where = '1=1'; 193 193 } 194 $mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts. ID, post_title, post_name, post_status, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit");194 $mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts.*, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit"); 195 195 if($mostcommenteds) { 196 196 if($chars > 0) { 197 197 foreach ($mostcommenteds as $post) { 198 $post_title = htmlspecialchars(stripslashes($post->post_title));198 $post_title = get_the_title(); 199 199 $comment_total = intval($post->comment_total); 200 200 $temp .= "<li><a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">".snippet_chars($post_title, $chars)."</a> - $comment_total ".__('comments', 'wp-stats')."</li>"; … … 202 202 } else { 203 203 foreach ($mostcommenteds as $post) { 204 $post_title = htmlspecialchars(stripslashes($post->post_title));204 $post_title = get_the_title(); 205 205 $comment_total = intval($post->comment_total); 206 206 $temp .= "<li><a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">$post_title</a> - $comment_total ".__('comments', 'wp-stats')."</li>"; … … 257 257 // Treshhold = Number Of Posts User Must Have Before It Will Display His Name Out 258 258 // 5 = Default Treshhold; -1 = Disable Treshhold 259 function get_commentmembersstats($threshhold = -1, $ display = true) {259 function get_commentmembersstats($threshhold = -1, $limit = 0, $display = true) { 260 260 global $wpdb; 261 261 $temp = ''; 262 $comments = $wpdb->get_results("SELECT comment_author, COUNT(comment_ID) AS 'comment_total' FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_author ORDER BY comment_total DESC"); 262 $limit_sql = ''; 263 if($limit > 0) { 264 $limit_sql = "LIMIT $limit"; 265 } 266 $comments = $wpdb->get_results("SELECT comment_author, COUNT(comment_ID) AS 'comment_total' FROM $wpdb->comments INNER JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' GROUP BY comment_author ORDER BY comment_total DESC $limit_sql"); 263 267 if($comments) { 264 268 foreach ($comments as $comment) { … … 287 291 global $wpdb; 288 292 $temp = ''; 289 $cats = get_categories("type=post"); 290 if ($cats) { 291 foreach ($cats as $cat) { 292 $temp .= '<li><a href="'.get_category_link($cat->cat_ID).'" title="View all posts in '.$cat->cat_name.'">'.$cat->cat_name.'</a> ('.$cat->category_count.")</li>\n"; 293 } 293 $defaults = array('type' => 'post', 'style' => 'list', 'show_count' => 1); 294 $categories = get_categories($defaults); 295 if (empty($categories)){ 296 $temp .= '<li>'.__('No categories', 'wp-stats').'</li>'; 297 } else { 298 $temp .= walk_category_tree($categories, 0, $defaults); 294 299 } 295 300 if($display) { … … 519 524 $temp_stats .= '<p><strong>'.__('Comment Members', 'wp-stats').'</strong></p>'."\n"; 520 525 $temp_stats .= '<ol>'."\n"; 521 $temp_stats .= get_commentmembersstats(-1, false);526 $temp_stats .= get_commentmembersstats(-1, 0, false); 522 527 $temp_stats .= '</ol>'."\n"; 523 528 } … … 555 560 $comment_author_sql = $wpdb->escape($comment_author); 556 561 // Total Comments Posted By User 557 $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_author='$comment_author_sql'");562 $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments INNER JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author = '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = ''"); 558 563 // Checking $page and $offset 559 564 if (empty($page) || $page == 0) { $page = 1; } … … 567 572 $totalpages = ceil($totalcomments/$perpage); 568 573 // Getting The Comments 569 $gmz_comments = $wpdb->get_results("SELECT $wpdb->posts.ID, comment_author, comment_date, comment_content, ID, comment_ID, post_date, post_title, post_name, post_password FROM $wpdb->comments INNER JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author = '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' ORDER BY comment_post_ID DESC, comment_date DESC LIMIT $offset, $perpage"); 570 574 $gmz_comments = $wpdb->get_results("SELECT $wpdb->posts.*, $wpdb->comments.* FROM $wpdb->comments INNER JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author = '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' ORDER BY comment_post_ID DESC, comment_date DESC LIMIT $offset, $perpage"); 571 575 $temp_stats .= '<h2>'.__('Comments Posted By', 'wp-stats').' '.$comment_author.'</h2>'; 572 576 $temp_stats .= '<p>'.sprintf(__('Displaying <strong>%s</strong> To <strong>%s</strong> Of <strong>%s</strong> Comments', 'wp-stats'), $displayonpage, $maxonpage, $totalcomments).'</p>'; … … 575 579 if($gmz_comments) { 576 580 foreach($gmz_comments as $post) { 577 $comment_id = intval($post-> comment_ID);581 $comment_id = intval($post->comment_ID); 578 582 $comment_author2 = htmlspecialchars(stripslashes($post->comment_author)); 579 $comment_date = mysql2date( 'd.m.Y @ H:i', $post->comment_date);583 $comment_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), $post->comment_date); 580 584 $comment_content = wpautop(stripslashes($post->comment_content)); 581 $post_date = mysql2date('d.m.Y @ H:i', $post->post_date);582 $post_title = htmlspecialchars(stripslashes($post->post_title));585 $post_date = get_the_time(get_option('date_format').' @ '.get_option('time_format')); 586 $post_title = get_the_title(); 583 587 584 588 // Check For Password Protected Post wp-stats/trunk/stats/wp-stats.pot
r7998 r8071 3 3 "Project-Id-Version: WP-Stats 2.11\n" 4 4 "POT-Creation-Date: \n" 5 "PO-Revision-Date: 2007-02- 17 23:22+0800\n"5 "PO-Revision-Date: 2007-02-26 14:00+0800\n" 6 6 "Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n" 7 7 "Language-Team: Lester Chan <gamerz84@homtail.com>\n" … … 55 55 56 56 #: stats-options.php:81 57 #: stats.php:38 257 #: stats.php:387 58 58 msgid "General Stats" 59 59 msgstr "" … … 64 64 65 65 #: stats-options.php:88 66 #: stats.php:40 166 #: stats.php:406 67 67 msgid "WP-EMail" 68 68 msgstr "" 69 69 70 70 #: stats-options.php:93 71 #: stats.php:41 171 #: stats.php:416 72 72 msgid "WP-Polls" 73 73 msgstr "" 74 74 75 75 #: stats-options.php:98 76 #: stats.php:42 176 #: stats.php:426 77 77 msgid "WP-PostRatings" 78 78 msgstr "" 79 79 80 80 #: stats-options.php:103 81 #: stats.php:43 081 #: stats.php:435 82 82 msgid "WP-PostViews" 83 83 msgstr "" 84 84 85 85 #: stats-options.php:108 86 #: stats.php:4 3886 #: stats.php:443 87 87 msgid "WP-UserOnline" 88 88 msgstr "" 89 89 90 90 #: stats-options.php:111 91 #: stats.php:4 4891 #: stats.php:453 92 92 #, php-format 93 93 msgid "Top %s Post Stats" … … 128 128 129 129 #: stats-options.php:135 130 #: stats.php:5 09130 #: stats.php:514 131 131 msgid "Authors Stats" 132 132 msgstr "" … … 134 134 #: stats-options.php:136 135 135 #: stats-widget.php:54 136 #: stats.php:51 0136 #: stats.php:515 137 137 msgid "Authors" 138 138 msgstr "" 139 139 140 140 #: stats-options.php:137 141 #: stats.php:5 18141 #: stats.php:523 142 142 msgid "Comments' Members Stats" 143 143 msgstr "" 144 144 145 145 #: stats-options.php:138 146 #: stats.php:5 19146 #: stats.php:524 147 147 msgid "Comment Members" 148 148 msgstr "" 149 149 150 150 #: stats-options.php:139 151 #: stats.php:5 27151 #: stats.php:532 152 152 msgid "Misc Stats" 153 153 msgstr "" 154 154 155 155 #: stats-options.php:140 156 #: stats.php:53 2156 #: stats.php:537 157 157 msgid "Post Categories" 158 158 msgstr "" 159 159 160 160 #: stats-options.php:141 161 #: stats.php:54 0161 #: stats.php:545 162 162 msgid "Link Categories" 163 163 msgstr "" … … 168 168 169 169 #: stats-widget.php:49 170 #: stats.php:38 3170 #: stats.php:388 171 171 msgid "Total Stats" 172 172 msgstr "" … … 289 289 #: stats.php:210 290 290 #: stats.php:246 291 #: stats.php:27 5291 #: stats.php:279 292 292 msgid "N/A" 293 293 msgstr "" … … 311 311 msgstr "" 312 312 313 #: stats.php:2 68313 #: stats.php:272 314 314 #, php-format 315 315 msgid "View all comments posted by %s" 316 316 msgstr "" 317 317 318 #: stats.php:385 318 #: stats.php:296 319 msgid "No categories" 320 msgstr "" 321 322 #: stats.php:390 319 323 msgid "Authors To This Blog." 320 324 msgstr "" 321 325 322 #: stats.php:3 86326 #: stats.php:391 323 327 msgid "Posts Were Posted." 324 328 msgstr "" 325 329 326 #: stats.php:3 87330 #: stats.php:392 327 331 msgid "Pages Were Created." 328 332 msgstr "" 329 333 330 #: stats.php:3 88334 #: stats.php:393 331 335 msgid "Comments Were Posted." 332 336 msgstr "" 333 337 334 #: stats.php:3 89338 #: stats.php:394 335 339 msgid "Different Nicks Were Represented In The Comments." 336 340 msgstr "" 337 341 338 #: stats.php:39 0342 #: stats.php:395 339 343 msgid "Links Were Added" 340 344 msgstr "" 341 345 342 #: stats.php: 396346 #: stats.php:401 343 347 msgid "Plugins Stats" 344 348 msgstr "" 345 349 346 #: stats.php:40 3350 #: stats.php:408 347 351 msgid "Emails Were Sent." 348 352 msgstr "" 349 353 350 #: stats.php:40 4354 #: stats.php:409 351 355 msgid "Emails Were Sent Successfully." 352 356 msgstr "" 353 357 354 #: stats.php:4 05358 #: stats.php:410 355 359 msgid "Emails Failed To Send." 356 360 msgstr "" 357 361 358 #: stats.php:41 3362 #: stats.php:418 359 363 msgid "Polls Were Created." 360 364 msgstr "" 361 365 362 #: stats.php:41 4366 #: stats.php:419 363 367 msgid "Polls' Answers Were Given." 364 368 msgstr "" 365 369 366 #: stats.php:4 15367 #: stats.php:42 3370 #: stats.php:420 371 #: stats.php:428 368 372 msgid "Votes Were Casted." 369 373 msgstr "" 370 374 371 #: stats.php:42 4375 #: stats.php:429 372 376 msgid "Users Casted Their Vote." 373 377 msgstr "" 374 378 375 #: stats.php:43 2379 #: stats.php:437 376 380 msgid "Views Were Generated." 377 381 msgstr "" 378 382 379 #: stats.php:44 0383 #: stats.php:445 380 384 msgid "User(s) Online Now." 381 385 msgstr "" 382 386 383 #: stats.php:44 1387 #: stats.php:446 384 388 msgid "Most users ever online was" 385 389 msgstr "" 386 390 387 #: stats.php:44 2388 #: stats.php: 596391 #: stats.php:447 392 #: stats.php:600 389 393 msgid "On" 390 394 msgstr "" 391 395 392 #: stats.php:45 3396 #: stats.php:458 393 397 msgid "Recent Posts" 394 398 msgstr "" 395 399 396 #: stats.php:46 1400 #: stats.php:466 397 401 msgid "Recent Comments" 398 402 msgstr "" 399 403 400 #: stats.php:4 69404 #: stats.php:474 401 405 msgid "Most Commented Post" 402 406 msgstr "" 403 407 404 #: stats.php:4 77408 #: stats.php:482 405 409 msgid "Most Emailed Post" 406 410 msgstr "" 407 411 408 #: stats.php:4 86412 #: stats.php:491 409 413 msgid "Highest Rated Post" 410 414 msgstr "" 411 415 412 #: stats.php:49 2416 #: stats.php:497 413 417 msgid "Most Rated Post" 414 418 msgstr "" 415 419 416 #: stats.php:50 1420 #: stats.php:506 417 421 msgid "Most Viewed Post" 418 422 msgstr "" 419 423 420 #: stats.php:57 1424 #: stats.php:575 421 425 msgid "Comments Posted By" 422 426 msgstr "" 423 427 424 #: stats.php:57 2428 #: stats.php:576 425 429 #, php-format 426 430 msgid "Displaying <strong>%s</strong> To <strong>%s</strong> Of <strong>%s</strong> Comments" 427 431 msgstr "" 428 432 429 #: stats.php:5 88430 #: stats.php:59 4433 #: stats.php:592 434 #: stats.php:598 431 435 msgid "Posted On" 432 436 msgstr "" 433 437 434 #: stats.php:5 88438 #: stats.php:592 435 439 msgid "Protected" 436 440 msgstr "" 437 441 438 #: stats.php:5 89442 #: stats.php:593 439 443 msgid "Comments Protected" 440 444 msgstr "" 441 445 442 #: stats.php: 596446 #: stats.php:600 443 447 #, php-format 444 448 msgid "View the comment posted by %s" 445 449 msgstr "" 446 450 447 #: stats.php: 596451 #: stats.php:600 448 452 msgid "Posted By" 449 453 msgstr "" 450 454 451 #: stats.php:60 1455 #: stats.php:605 452 456 msgid "has not made any comments yet." 453 457 msgstr "" 454 458 455 #: stats.php:61 0459 #: stats.php:614 456 460 msgid "Previous Page" 457 461 msgstr "" 458 462 459 #: stats.php:6 18463 #: stats.php:622 460 464 msgid "Next Page" 461 465 msgstr "" 462 466 463 #: stats.php:6 27467 #: stats.php:631 464 468 #, php-format 465 469 msgid "Pages (%s)" 466 470 msgstr "" 467 471 468 #: stats.php:6 29472 #: stats.php:633 469 473 msgid "Go to First Page" 470 474 msgstr "" 471 475 472 #: stats.php:6 29476 #: stats.php:633 473 477 msgid "First" 474 478 msgstr "" 475 479 476 #: stats.php:63 2477 #: stats.php:64 4480 #: stats.php:636 481 #: stats.php:648 478 482 msgid "Go to Page" 479 483 msgstr "" 480 484 481 #: stats.php:6 39485 #: stats.php:643 482 486 msgid "Page" 483 487 msgstr "" 484 488 485 #: stats.php:6 47489 #: stats.php:651 486 490 msgid "Go to Last Page" 487 491 msgstr "" 488 492 489 #: stats.php:6 47493 #: stats.php:651 490 494 msgid "Last" 491 495 msgstr "" 492 496 493 #: stats.php:65 1497 #: stats.php:655 494 498 msgid "Back To Stats Page" 495 499 msgstr ""
