Changeset 2032 for trunk

Show
Ignore:
Timestamp:
07/11/10 09:25:49 (23 months ago)
Author:
nick_ramsay
Message:

[TRUNK] Updating core plugins with admin stats feature reverted for 1.3.

Location:
trunk/content/plugins
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/content/plugins

  • trunk/content/plugins/bookmarking/bookmarking.php

    r2027 r2032  
    77 * class: Bookmarking 
    88 * type: base 
    9  * hooks: install_plugin, theme_index_top, header_meta, header_include, navigation, breadcrumbs, theme_index_main, admin_plugin_settings, admin_sidebar_plugin_settings, user_settings_pre_save, user_settings_fill_form, user_settings_extra_settings, theme_index_pre_main, profile_navigation, post_rss_feed_items 
     9 * hooks: install_plugin, theme_index_top, header_meta, header_include, navigation, breadcrumbs, theme_index_main, admin_plugin_settings, admin_sidebar_plugin_settings, user_settings_pre_save, user_settings_fill_form, user_settings_extra_settings, theme_index_pre_main, profile_navigation, post_rss_feed_items, admin_theme_main_stats 
    1010 * author: Nick Ramsay 
    1111 * authorurl: http://hotarucms.org/member.php?1-Nick 
     
    675675        $h->vars['post_rss_item'] = $item; 
    676676    } 
     677     
     678     
     679    /** 
     680     * Show stats on Admin home page 
     681     */ 
     682    public function admin_theme_main_stats($h, $vars) 
     683    { 
     684                echo "<li>&nbsp;</li>"; 
     685                foreach ($vars as $key => $value) { 
     686                        echo "<li class='title'>" . $key . "</li>"; 
     687                        foreach ($value as $stat_type) { 
     688                                $posts = $h->post->stats($h, $stat_type); 
     689                                if (!$posts) { $posts = 0; } 
     690                                $lang_name = 'bookmarking_admin_stats_' . $stat_type; 
     691                                echo "<li>" . $h->lang[$lang_name] . ": " . $posts . "</li>"; 
     692                        } 
     693                } 
     694        } 
    677695} 
    678696?> 
  • trunk/content/plugins/comments/comments.php

    r2030 r2032  
    808808    public function admin_theme_main_stats($h, $vars) 
    809809    { 
    810             $c = new Comment(); 
    811             $stats = $c->stats($h); 
    812             $stats_archived = $c->stats($h, 'archived'); 
    813              
    814             echo "<li>&nbsp;</li>"; 
    815             if ($stats) { 
    816                 foreach ($stats as $stat) { 
    817                     $comments[$stat[0]] = $stat[1]; 
     810        echo "<li>&nbsp;</li>"; 
     811                foreach ($vars as $key => $value) { 
     812                    echo "<li class='title'>" . $key . "</li>"; 
     813                    foreach ($value as $stat_type) { 
     814                        require_once(LIBS . 'Comment.php'); 
     815                        $c = new Comment(); 
     816                        $comments = $c->stats($h, $stat_type); 
     817                        if (!$comments) { $comments = 0; } 
     818                        $lang_name = 'comments_admin_stats_' . $stat_type; 
     819                        echo "<li>" . $h->lang[$lang_name] . ": " . $comments . "</li>"; 
     820                    } 
    818821                } 
    819             } 
    820  
    821             if (isset($vars) && (!empty($vars))) { 
    822                 foreach ($vars as $key => $value) { 
    823                         echo "<li class='title'>" . $key . "</li>"; 
    824                         foreach ($value as $stat_type) { 
    825                                 if (isset($value) && !empty($value)) { 
    826  
    827                                         switch ($stat_type) { 
    828                                             case 'all': 
    829                                                 if (isset($comments)) { $comment_count = array_sum($comments); } else { $comment_count = 0; } 
    830                                                 break; 
    831                                             case 'archived': 
    832                                                 if (isset($stats_archived)) { $comment_count = $stats_archived; } else { $comment_count = 0; } 
    833                                                 break; 
    834                                             default: 
    835                                                 if (isset($comments[$stat_type])) { $comment_count = $comments[$stat_type]; } else { $comment_count = 0; } 
    836                                                 break; 
    837                                         }                                                                                
    838  
    839                                         $link = "archived"; 
    840                                         $dontlink = array('');                                   
    841                                         if (!in_array($stat_type, $dontlink)) { 
    842                                             $link = BASEURL . "admin_index.php?comment_status_filter=$stat_type&plugin=comment_manager&page=plugin_settings&type=filter&csrf=" . $h->csrfToken; 
    843                                         } 
    844                                          
    845                                         $lang_name = 'comments_admin_stats_' . $stat_type; 
    846                                         echo "<li>"; 
    847                                         if ($link) { echo "<a href='" . $link . "'>"; } 
    848                                         echo $h->lang[$lang_name] . ": " . $comment_count; 
    849                                         if ($link) { echo "</a>"; } 
    850                                         echo "</li>"; 
    851                                 } 
    852                         } 
    853                 } 
    854             } 
    855822    } 
    856823     
  • trunk/content/plugins/comments/languages/comments_language.php

    r2027 r2032  
    111111 
    112112/* Admin Stats */ 
    113 $lang["comments_admin_stats_all"] = "Total"; 
    114 $lang["comments_admin_stats_approved"] = "Approved"; 
    115 $lang["comments_admin_stats_pending"] = "Pending"; 
    116 $lang["comments_admin_stats_archived"] = "Archived"; 
     113$lang["comments_admin_stats_total_comments"] = "Total"; 
     114$lang["comments_admin_stats_approved_comments"] = "Approved"; 
     115$lang["comments_admin_stats_pending_comments"] = "Pending"; 
     116$lang["comments_admin_stats_archived_comments"] = "Archived"; 
    117117 
    118118/* Email to comment subscribers */ 
  • trunk/content/plugins/post_manager/post_manager.php

    r2030 r2032  
    66 * folder: post_manager 
    77 * class: PostManager 
    8  * hooks: hotaru_header, install_plugin, admin_header_include, admin_plugin_settings, admin_sidebar_plugin_settings, user_manager_role, user_manager_details, admin_theme_main_stats 
     8 * hooks: hotaru_header, install_plugin, admin_header_include, admin_plugin_settings, admin_sidebar_plugin_settings, user_manager_role, user_manager_details 
    99 * author: Nick Ramsay 
    1010 * authorurl: http://hotarucms.org/member.php?1-Nick 
     
    9090        } 
    9191    } 
    92  
    93     /** 
    94      * Show stats on Admin home page 
    95      */ 
    96     public function admin_theme_main_stats($h, $vars) 
    97     { 
    98             $stats = $h->post->stats($h); 
    99             $stats_archived = $h->post->stats($h, 'archived'); 
    100  
    101             echo "<li>&nbsp;</li>"; 
    102             if ($stats) { 
    103                 foreach ($stats as $stat) { 
    104                     $posts[$stat[0]] = $stat[1]; 
    105                 } 
    106             } 
    107  
    108             if (isset($vars) && (!empty($vars))) { 
    109                 foreach ($vars as $key => $value) { 
    110                         echo "<li class='title'>" . $key . "</li>"; 
    111                         foreach ($value as $stat_type) { 
    112                                 if (isset($value) && !empty($value)) { 
    113  
    114                                         switch ($stat_type) { 
    115                                             case 'all': 
    116                                                 $post_count = array_sum($posts); 
    117                                                 break; 
    118                                             case 'approved':                                             
    119                                                 $post_count = 0; 
    120                                                 $array = array('top', 'new'); 
    121                                                 foreach ($array as $item) { 
    122                                                     if (isset($posts[$item])) { $post_count += $posts[$item]; } 
    123                                                 } 
    124                                                 break; 
    125                                             case 'archived' : 
    126                                                 if (isset($stats_archived)) { $post_count = $stats_archived; } else { $post_count = 0; } 
    127                                                 break; 
    128                                             default: 
    129                                                 if (isset($posts[$stat_type])) { $post_count = $posts[$stat_type]; } else { $post_count = 0; } 
    130                                                 break; 
    131                                         }                                        
    132  
    133                                         $link = ""; 
    134                                         $dontlink = array('archived'); 
    135                                         if (!in_array($stat_type, $dontlink)) { 
    136                                             $link = BASEURL . "admin_index.php?post_status_filter=$stat_type&plugin=post_manager&page=plugin_settings&type=filter&csrf=" . $h->csrfToken; 
    137                                         } 
    138                                          
    139                                         $lang_name = 'post_man_admin_stats_' . $stat_type; 
    140                                         echo "<li>"; 
    141                                         if ($link) { echo "<a href='" . $link . "'>"; } 
    142                                         echo $h->lang[$lang_name] . ": " . $post_count; 
    143                                         if ($link) { echo "</a>"; } 
    144                                         echo "</li>"; 
    145                                 } 
    146                         } 
    147                 } 
    148             } 
    149     } 
    15092} 
    15193 
  • trunk/content/plugins/users/languages/users_language.php

    r2027 r2032  
    6969 
    7070/* Admin Stats */ 
    71 $lang["users_admin_stats_all"] = "Total users"; 
    72 $lang["users_admin_stats_admin"] = "Admins"; 
    73 $lang["users_admin_stats_supermod"] = "Super Mods"; 
    74 $lang["users_admin_stats_moderator"] = "Moderators"; 
    75 $lang["users_admin_stats_approved"] = "Approved"; 
    76 $lang["users_admin_stats_pending"] = "Pending"; 
    77 $lang["users_admin_stats_undermod"] = "Under moderation"; 
    78 $lang["users_admin_stats_banned"] = "Banned"; 
    79 $lang["users_admin_stats_killspammed"] = "Killspammed"; 
     71$lang["users_admin_stats_total_users"] = "Total users"; 
     72$lang["users_admin_stats_admins"] = "Admins"; 
     73$lang["users_admin_stats_supermods"] = "Super Mods"; 
     74$lang["users_admin_stats_moderators"] = "Moderators"; 
     75$lang["users_admin_stats_approved_users"] = "Approved"; 
     76$lang["users_admin_stats_pending_users"] = "Pending"; 
     77$lang["users_admin_stats_undermod_users"] = "Under moderation"; 
     78$lang["users_admin_stats_banned_users"] = "Banned"; 
     79$lang["users_admin_stats_killspammed_users"] = "Killspammed"; 
    8080 
    8181/* UserFunctions CLASS: */ 
  • trunk/content/plugins/users/users.php

    r2030 r2032  
    432432     */ 
    433433    public function admin_theme_main_stats($h, $vars) 
    434     {         
     434    { 
     435        require_once(LIBS . 'UserInfo.php'); 
    435436        $ui = new UserInfo(); 
    436         $stats = $ui->stats($h); 
    437  
    438         //var_dump($stats); 
    439  
    440         echo "<li>&nbsp;</li>"; 
    441         if ($stats) { 
    442             foreach ($stats as $stat) { 
    443                 //var_dump($stat); 
    444                 $users[$stat[0]] = $stat[1]; 
    445             } 
    446         } 
    447   
    448         if (isset($vars) && (!empty($vars))) { 
    449                 foreach ($vars as $key => $value) { 
    450                         echo "<li class='title'>" . $key . "</li>"; 
    451                         foreach ($value as $stat_type) { 
    452                                 if (isset($value) && !empty($value)) { 
    453  
    454                                         switch ($stat_type) { 
    455                                             case 'all': 
    456                                                 $user_count = array_sum($users);                                                 
    457                                                 break; 
    458                                             case 'approved': 
    459                                                 $user_count = 0; 
    460                                                 $array = array('admin', 'supermod', 'moderator', 'member'); 
    461                                                 foreach ($array as $item) { 
    462                                                     if (isset($users[$item])) {$user_count += $users[$item];} 
    463                                                 } 
    464                                                 break; 
    465                                             default: 
    466                                                 if (isset($users[$stat_type])) { $user_count = $users[$stat_type]; } else { $user_count = 0; } 
    467                                                 break; 
     437         
     438        echo "<li>&nbsp;</li>"; 
     439                if (isset($vars) && (!empty($vars))) {       
     440                        foreach ($vars as $key => $value) { 
     441                                echo "<li class='title'>" . $key . "</li>"; 
     442                                foreach ($value as $stat_type) {                     
     443                                        if (isset($value) && !empty($value)) { 
     444                                                $users = $ui->stats($h, $stat_type); 
     445                                                if (!$users) { $users = 0; } 
     446                                                $lang_name = 'users_admin_stats_' . $stat_type; 
     447                                                echo "<li>" . $h->lang[$lang_name] . ": " . $users . "</li>"; 
    468448                                        } 
    469                                          
    470                                         $link = ""; 
    471                                         $dontlink = array('approved'); 
    472                                         if ($h->isActive('user_manager')) { 
    473                                             if (!in_array($stat_type, $dontlink)) { 
    474                                                 $link = BASEURL . "admin_index.php?user_filter=$stat_type&plugin=user_manager&page=plugin_settings&type=filter&csrf=" . $h->csrfToken; 
    475                                             } 
    476                                         } 
    477                                          
    478                                         $lang_name = 'users_admin_stats_' . $stat_type; 
    479                                         echo "<li>"; 
    480                                         if ($link) { echo "<a href='" . $link . "'>"; } 
    481                                         echo $h->lang[$lang_name] . ": " . $user_count; 
    482                                         if ($link) { echo "</a>"; } 
    483                                         echo "</li>"; 
    484449                                } 
    485450                        } 
    486451                } 
    487         } 
    488452    } 
    489453