Changeset 5122

Show
Ignore:
Timestamp:
02/13/06 11:36:30 (2 years ago)
Author:
GamerZ
Message:

Major Changes

Location:
wp-stats/trunk
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • wp-stats/trunk/readme-install.txt

    r4394 r5122  
    11-> Installation Instructions 
    22-------------------------------------------------- 
     3// Open wp-content/plugins folder 
     4 
     5Put: 
     6------------------------------------------------------------------ 
     7stats.php 
     8------------------------------------------------------------------ 
     9 
     10 
     11// Activate WP-Stats Plugin 
     12 
     13 
    314// Open root Wordpress folder 
    415 
  • wp-stats/trunk/readme-upgrade.txt

    r4818 r5122  
    1 -> Upgrade Instructions For Version 2.00 To Version 2.01 
     1-> Upgrade Instructions For Version 1.0x To Version 2.02 
    22------------------------------------------------------------------ 
     3// Open wp-content/plugins folder 
     4 
     5Overwrite: 
     6------------------------------------------------------------------ 
     7stats.php 
     8------------------------------------------------------------------ 
     9 
     10 
    311// Open root Wordpress folder 
    412 
  • wp-stats/trunk/readme.txt

    r4798 r5122  
    77Documentation     -> http://dev.wp-plugins.org/wiki/wp-stats 
    88Development -> http://dev.wp-plugins.org/browser/wp-stats/ 
    9 Updated           -> 1st February 2006 
     9Updated           -> 1st March 2006 
    1010-------------------------------------------------- 
    1111 
     12 
     13// Version 2.02 (01-03-2006) 
     14- NEW: Added WP-PostRatings, WP-PostViews, WP-UserOnline Stats 
     15- NEW: Slightly Changed The Grouping Of Stats 
     16- NEW: WP-Stats Now Can Be Found ALso On The Dashboard 
     17- FIXED: Moved All Stats Functions To stats.php 
    1218 
    1319// Version 2.01 (01-02-2006) 
  • wp-stats/trunk/wp-stats.php

    r4700 r5122  
    33+----------------------------------------------------------------+ 
    44|                                                                                                                                         | 
    5 |     WordPress 2.0 Plugin: WP-Stats 2.01                                                       | 
     5|     WordPress 2.0 Plugin: WP-Stats 2.02                                                       | 
    66|     Copyright (c) 2005 Lester "GaMerZ" Chan                                                   | 
    77|                                                                                                                                         | 
     
    2424$comment_author = urldecode(strip_tags(stripslashes(trim($_GET['author'])))); 
    2525$page = intval($_GET['page']); 
    26  
    27 ### Function: Get Total Posts 
    28 function get_totalposts() { 
    29       global $wpdb; 
    30       $totalposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = 'publish'"); 
    31       echo $totalposts; 
    32 } 
    33  
    34 ### Function: Get Total Pages 
    35 function get_totalpages() { 
    36       global $wpdb; 
    37       $totalpages = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = 'static'"); 
    38       echo $totalpages; 
    39 } 
    40  
    41 ### Function: Get Total Comments 
    42 function get_totalcomments() { 
    43       global $wpdb; 
    44       $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = '1'"); 
    45       echo $totalcomments; 
    46 } 
    47  
    48 ### Function: Get Total Comments Poster 
    49 function get_totalcommentposters() { 
    50       global $wpdb; 
    51       $totalcommentposters = $wpdb->get_var("SELECT COUNT(DISTINCT comment_author) FROM $wpdb->comments WHERE comment_approved = '1'"); 
    52       echo $totalcommentposters; 
    53 } 
    54  
    55 ### Function: Get Total Links 
    56 function get_totallinks() { 
    57       global $wpdb; 
    58       $totallinks = $wpdb->get_var("SELECT COUNT(link_id) FROM $wpdb->links"); 
    59       echo $totallinks; 
    60 } 
    61  
    62 ### Function: Get Recent Posts 
    63 function get_recentposts($limit = 10) { 
    64     global $wpdb, $post; 
    65     $recentposts = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, post_date, user_login FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_date < '".current_time('mysql')."' AND (post_status = 'publish' OR post_status = 'static') AND post_password = '' ORDER  BY post_date DESC LIMIT $limit"); 
    66       if($recentposts) { 
    67             foreach ($recentposts as $post) { 
    68                         $post_title = htmlspecialchars(stripslashes($post->post_title)); 
    69                         $post_date = mysql2date('d.m.Y', $post->post_date); 
    70                         $user_nickname = htmlspecialchars(stripslashes($post->user_login)); 
    71                         echo "<li>$post_date - <a href=\"".get_permalink()."\">$post_title</a> ($user_nickname)</li>"; 
    72             } 
    73       } else { 
    74             echo '<li>'.__('N/A').'</li>'; 
    75       } 
    76 } 
    77  
    78 ### Function: Get Recent Comments 
    79 function get_recentcomments($limit = 10) { 
    80     global $wpdb, $post; 
    81     $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 (post_status = 'publish' OR post_status = 'static') AND post_password = '' ORDER  BY comment_date DESC LIMIT $limit"); 
    82       if($recentcomments) { 
    83             foreach ($recentcomments as $post) { 
    84                         $post_title = htmlspecialchars(stripslashes($post->post_title)); 
    85                         $comment_author = htmlspecialchars(stripslashes($post->comment_author)); 
    86                         $comment_date = mysql2date('d.m.Y @ H:i', $post->comment_date); 
    87                         echo "<li>$comment_date - $comment_author (<a href=\"".get_permalink()."\">$post_title</a>)</li>"; 
    88             } 
    89       } else { 
    90             echo '<li>'.__('N/A').'</li>'; 
    91       } 
    92 } 
    93  
    94 ### Function: Get Top Commented Posts 
    95 function get_mostcommented($limit = 10) { 
    96     global $wpdb, $post; 
    97     $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 (post_status = 'publish' OR post_status = 'static') AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER  BY comment_total DESC LIMIT $limit"); 
    98       if($mostcommenteds) { 
    99             foreach ($mostcommenteds as $post) { 
    100                         $post_title = htmlspecialchars(stripslashes($post->post_title)); 
    101                         $comment_total = intval($post->comment_total); 
    102                         echo "<li><a href=\"".get_permalink()."\">$post_title</a> - $comment_total ".__('comments')."</li>"; 
    103             } 
    104       } else { 
    105             echo '<li>'.__('N/A').'</li>'; 
    106       } 
    107 } 
    108  
    109 ### Function: Get Comments' Members Stats 
    110 // Treshhold = Number Of Posts User Must Have Before It Will Display His Name Out 
    111 // 5 = Default Treshhold; -1 = Disable Treshhold 
    112 function get_commentmembersstats($threshhold = -1) { 
    113       global $wpdb; 
    114       $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"); 
    115       if($comments) { 
    116             foreach ($comments as $comment) { 
    117                         $comment_author = strip_tags(stripslashes($comment->comment_author)); 
    118                         $comment_author_link = urlencode($comment_author); 
    119                         $comment_total = intval($comment->comment_total); 
    120                         echo "<li><a href=\"wp-stats.php?author=$comment_author_link\">$comment_author</a> ($comment_total)</li>"; 
    121                         // If Total Comments Is Below Threshold 
    122                         if($comment_total <= $threshhold && $threshhold != -1) { 
    123                               return; 
    124                         } 
    125             } 
    126       } else { 
    127             echo '<li>'.__('N/A').'</li>'; 
    128       } 
    129 } 
    130  
    131 ### Function:  Get Links Categories Stats 
    132 function get_linkcats() { 
    133       global $wpdb; 
    134       $linkcats =  $wpdb->get_results("SELECT $wpdb->linkcategories.cat_name, COUNT(*)  AS  'total_links' FROM $wpdb->links INNER JOIN $wpdb->linkcategories ON $wpdb->linkcategories.cat_id = $wpdb->links.link_category GROUP BY $wpdb->linkcategories.cat_id ORDER  BY total_links DESC "); 
    135       if($linkcats) { 
    136             foreach ($linkcats as $linkcat) { 
    137                         $cat_name = htmlspecialchars(stripslashes($linkcat->cat_name)); 
    138                         $total_links = intval($linkcat->total_links); 
    139                         echo "<li>$cat_name ($total_links)</li>\n"; 
    140             } 
    141       } else { 
    142             echo '<li>'.__('N/A').'</li>'; 
    143       } 
    144 } 
    145  
    146 ### Function: Get Poll Total Questions 
    147 function get_pollquestions() { 
    148       global $wpdb; 
    149       if(function_exists('get_poll')) { 
    150             $totalpollq = $wpdb->get_var("SELECT COUNT(pollq_id) FROM $wpdb->pollsq"); 
    151             echo $totalpollq; 
    152       } 
    153 } 
    154  
    155 ### Function: Get Poll Total Answers 
    156 function get_pollanswers() { 
    157       global $wpdb; 
    158       if(function_exists('get_poll')) { 
    159             $totalpolla = $wpdb->get_var("SELECT COUNT(polla_aid) FROM $wpdb->pollsa"); 
    160             echo $totalpolla; 
    161       } 
    162 } 
    163  
    164 ### Function: Get Poll Total Votes 
    165 function get_pollvotes() { 
    166       global $wpdb; 
    167       if(function_exists('get_poll')) { 
    168             $totalpollip = $wpdb->get_var("SELECT COUNT(pollip_id) FROM $wpdb->pollsip"); 
    169             echo $totalpollip; 
    170       } 
    171 } 
    172  
    173 ### Function: Get EMail Total Sent 
    174 function get_emails() { 
    175       global $wpdb; 
    176       if(function_exists('wp_email')) { 
    177             $totalemails = $wpdb->get_var("SELECT COUNT(email_id) FROM $wpdb->email"); 
    178             echo $totalemails; 
    179       } 
    180 } 
    181  
    182 ### Function: Get EMail Total Sent Success 
    183 function get_emails_success() { 
    184       global $wpdb;  
    185       if(function_exists('wp_email')) { 
    186             $totalemails_success = $wpdb->get_var("SELECT COUNT(email_id) FROM $wpdb->email WHERE email_status = '".__('Success')."'"); 
    187             echo $totalemails_success; 
    188       } 
    189 } 
    190  
    191 ### Function: Get EMail Total Sent Failed 
    192 function get_emails_failed() { 
    193       global $wpdb;  
    194       if(function_exists('wp_email')) { 
    195             $totalemails_failed = $wpdb->get_var("SELECT COUNT(email_id) FROM $wpdb->email WHERE email_status = '". __('Failed')."'"); 
    196             echo $totalemails_failed; 
    197       } 
    198 } 
    199  
    200 ### Function: Get Most Emailed Post 
    201 function get_mostemailed($limit = 10) { 
    202       global $wpdb, $post; 
    203       if(function_exists('wp_email')) { 
    204             $mostemailed= $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_date, COUNT($wpdb->email.email_postid) AS 'email_total' FROM $wpdb->email LEFT JOIN $wpdb->posts ON $wpdb->email.email_postid = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND (post_status = 'publish' OR post_status = 'static') AND post_password = '' GROUP BY $wpdb->email.email_postid ORDER  BY email_total DESC LIMIT $limit"); 
    205             if($mostemailed) { 
    206                   foreach ($mostemailed as $post) { 
    207                               $post_title = htmlspecialchars(stripslashes($post->post_title)); 
    208                               $email_total = intval($post->email_total); 
    209                               echo "<li><a href=\"".get_permalink()."\">$post_title</a> - $email_total ".__('Emails')."</li>"; 
    210                   } 
    211             } else { 
    212                   echo '<li>'.__('N/A').'</li>'; 
    213             } 
    214       } 
    215 } 
    21626?> 
    21727<?php get_header(); ?> 
     
    22131      if(empty($comment_author)) { 
    22232?> 
     33            <!-- General Stats --> 
    22334            <h2 class="pagetitle">General Stats</h2> 
    224                   <ul> 
    225                         <li><b><?php get_totalposts(); ?></b> Posts Were Posted</li> 
    226                         <li><b><?php get_totalpages(); ?></b> Pages Were Created</li> 
    227                         <li><b><?php get_totalcomments(); ?></b> Comments Were Posted</li> 
    228                         <li><b><?php get_totalcommentposters(); ?></b> Different Nicks Were Represented In The Comments</li> 
    229                         <li><b><?php get_totallinks(); ?></b> Links Were Added</li> 
    230                   </ul> 
     35            <ul> 
     36                  <li><b><?php get_totalposts(); ?></b> Posts Were Posted.</li> 
     37                  <li><b><?php get_totalpages(); ?></b> Pages Were Created.</li> 
     38                  <li><b><?php get_totalcomments(); ?></b> Comments Were Posted.</li> 
     39                  <li><b><?php get_totalcommentposters(); ?></b> Different Nicks Were Represented In The Comments.</li> 
     40                  <li><b><?php get_totallinks(); ?></b> Links Were Added.</li> 
     41            </ul> 
     42 
     43            <!-- Plugin Stats --> 
     44            <h2 class="pagetitle">Plugins Stats</h2> 
     45            <ul> 
     46            <!-- WP-EMail Stats --> 
     47            <?php if(function_exists('wp_email')): ?> 
     48                  <li><b>WP-EMail</b></li> 
     49                  <ul> 
     50                        <li><b><?php get_emails(); ?></b> Emails Were Sent.</li> 
     51                        <li><b><?php get_emails_success(); ?></b> Emails Were Sent Successfully.</li> 
     52                        <li><b><?php get_emails_failed(); ?></b> Emails Failed To Send.</li>     
     53                  </ul> 
     54                  <br /> 
     55            <?php endif; ?> 
     56            <!-- WP-Polls Stats --> 
    23157            <?php if(function_exists('get_poll')): ?> 
    232                   <h2 class="pagetitle">Poll Stats</h2> 
    233                   <ul> 
    234                         <li><b><?php get_pollquestions(); ?></b> Polls Were Created</li> 
    235                         <li><b><?php get_pollanswers(); ?></b> Polls' Answers Were Given</li> 
    236                         <li><b><?php get_pollvotes(); ?></b> Votes Were Casted</li> 
    237                   </ul> 
    238             <?php endif; ?> 
    239             <?php if(function_exists('wp_email')): ?> 
    240                   <h2 class="pagetitle">Email Stats</h2> 
    241                   <ul> 
    242                         <li><b><?php get_emails(); ?></b> Emails Were Sent</li> 
    243                         <li><b><?php get_emails_success(); ?></b> Emails Were Sent Successfully</li> 
    244                         <li><b><?php get_emails_failed(); ?></b> Emails Failed To Send</li>      
    245                   </ul> 
    246             <?php endif; ?> 
    247             <h2 class="pagetitle">10 Recent Posts</h2> 
    248                   <ul><?php get_recentposts(); ?></ul> 
    249             <h2 class="pagetitle">10 Recent Comments</h2> 
    250                   <ul><?php get_recentcomments(); ?></ul> 
    251             <h2 class="pagetitle">10 Most Commented Post</h2> 
    252                   <ul><?php get_mostcommented(); ?></ul> 
    253             <?php if(function_exists('wp_email')): ?> 
    254                   <h2 class="pagetitle">10 Most Emailed Post</h2> 
    255                         <ul><?php get_mostemailed(); ?></ul> 
    256             <?php endif; ?> 
     58                  <li><b>WP-Polls</b></li> 
     59                  <ul> 
     60                        <li><b><?php get_pollquestions(); ?></b> Polls Were Created.</li> 
     61                        <li><b><?php get_pollanswers(); ?></b> Polls' Answers Were Given.</li> 
     62                        <li><b><?php get_pollvotes(); ?></b> Votes Were Casted.</li> 
     63                  </ul> 
     64                  <br /> 
     65            <?php endif; ?> 
     66            <!-- WP-PostRatings Stats --> 
     67            <?php if(function_exists('the_ratings')): ?> 
     68                  <li><b>WP-PostRatings</b></li> 
     69                  <ul> 
     70                        <li><b><?php get_ratings_votes(); ?></b> Votes Were Casted.</li> 
     71                        <li><b><?php get_ratings_users(); ?></b> Users Casted Their Vote.</li>   
     72                  </ul> 
     73                  <br /> 
     74            <?php endif; ?> 
     75            <!-- WP-PostViews Stats --> 
     76            <?php if(function_exists('the_views')): ?> 
     77                  <li><b>WP-PostViews</b></li> 
     78                  <ul> 
     79                        <li><b><?php get_totalviews(); ?></b> Views Were Generated.</li> 
     80                  </ul> 
     81                  <br /> 
     82            <?php endif; ?> 
     83            <!-- WP-UserOnline Stats --> 
     84            <?php if(function_exists('useronline')): ?> 
     85                  <li><b>WP-UserOnline</b></li> 
     86                  <ul> 
     87                        <li>Most users ever online was <b><?php get_most_useronline(); ?></b>.</li> 
     88                        <li>On <b><?php get_most_useronline_date(); ?></b>.</li> 
     89                  </ul> 
     90                  <br /> 
     91                  <?php endif; ?> 
     92            </ul> 
     93 
     94            <!-- Top 10 Stats--> 
     95            <h2 class="pagetitle">Top 10 Stats</h2> 
     96            <ul> 
     97                        <!-- 10 Recent Posts --> 
     98                        <li><b>10 Recent Posts</b></li> 
     99                        <ul> 
     100                              <?php get_recentposts(); ?> 
     101                        </ul> 
     102                        <br /> 
     103                        <!-- 10 Recent Comments --> 
     104                        <li><b>10 Recent Comments</b></li> 
     105                        <ul> 
     106                              <?php get_recentcomments(); ?> 
     107                        </ul> 
     108                        <br /> 
     109                        <!-- 10 Most Commented Post --> 
     110                        <li><b>10 Most Commented Post</b></li> 
     111                        <ul> 
     112                              <?php get_mostcommented(); ?> 
     113                        </ul> 
     114                        <br /> 
     115                        <!-- WP-EMail (10 Most EMailed Post) --> 
     116                        <?php if(function_exists('wp_email')): ?> 
     117                              <li><b>10 Most Emailed Post</b></li> 
     118                              <ul> 
     119                                    <?php get_mostemailed(); ?> 
     120                              </ul> 
     121                              <br /> 
     122                        <?php endif; ?> 
     123                        <!-- WP-PostRatings (10 Most Rated Post) --> 
     124                        <?php if(function_exists('the_ratings')): ?> 
     125                              <li><b>10 Most Rated Post</b></li> 
     126                              <ul> 
     127                                    <?php get_highest_rated(); ?> 
     128                              </ul> 
     129                              <br /> 
     130                        <?php endif; ?> 
     131                        <!-- WP-PostViews (10 Most Viewed Post) --> 
     132                        <?php if(function_exists('the_views')): ?> 
     133                              <li><b>10 Most Viewed Post</b></li> 
     134                              <ul><?php get_most_viewed(); ?></ul> 
     135                              <br /> 
     136                        <?php endif; ?> 
     137            </ul> 
     138 
     139            <!-- Comments' Members Stats --> 
    257140            <h2 class="pagetitle">Comments' Members Stats</h2> 
    258                   <ol><?php get_commentmembersstats(); ?></ol> 
    259             <h2 class="pagetitle">Post Categories Stats</h2> 
    260                   <ul><?php list_cats(1,'All','name','asc','',true,0,1,0,1,true,0,0,0,'','','',true); ?></ul> 
    261             <h2 class="pagetitle">Link Categories Stats</h2> 
    262                   <ul><?php get_linkcats(); ?></ul> 
     141            <ol> 
     142                  <?php get_commentmembersstats(); ?> 
     143            </ol> 
     144 
     145            <!-- Misc Stats --> 
     146            <h2 class="pagetitle">Misc Stats</h2> 
     147            <ul> 
     148                  <!-- Post Categories --> 
     149                  <li><b>Post Categories</b></li> 
     150                  <ul> 
     151                        <?php list_cats(1,'All','name','asc','',true,0,1,0,1,true,0,0,0,'','','',true); ?> 
     152                  </ul> 
     153                  <br /> 
     154                  <!-- Link Categories --> 
     155                  <li><b>Link Categories</b></li> 
     156                  <ul> 
     157                        <?php get_linkcats(); ?> 
     158                  </ul> 
     159            </ul> 
    263160<?php 
    264161      ### Displaying Comments Posted By User 
     
    370267                  } 
    371268            ?> 
    372             <p><b>&laquo;&laquo;</b> <a href="<?php get_settings('home'); ?>wp-stats.php">Back To Stats Page</a></p> 
     269            <p><b>&laquo;&laquo;</b> <a href="<?php get_settings('home'); ?>/wp-stats.php">Back To Stats Page</a></p> 
    373270<?php 
    374271      } // End If