Dotclear

Changeset 2310 for plugins/topWriter


Ignore:
Timestamp:
06/06/10 01:53:09 (13 years ago)
Author:
JcDenis
Message:

topWriter 0.3

  • Switched to DC 2.2
  • Fixed list order (thanks to Atv')
Location:
plugins/topWriter
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/topWriter/_admin.php

    r1942 r2310  
    33# This file is part of topWriter, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
  • plugins/topWriter/_define.php

    r1942 r2310  
    33# This file is part of topWriter, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1717     /* Description*/         "Widgets to list users who write more posts or comments", 
    1818     /* Author */             "JC Denis", 
    19      /* Version */            '0.2', 
     19     /* Version */            '0.3', 
    2020     /* Permissions */        'admin' 
    2121); 
    22      /* date */          #20090810 
     22     /* date */          #20100605 
    2323?> 
  • plugins/topWriter/_public.php

    r1942 r2310  
    33# This file is part of topWriter, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
  • plugins/topWriter/_widgets.php

    r1942 r2310  
    33# This file is part of topWriter, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    5252     { 
    5353          global $core; 
    54  
     54           
    5555          if ($w->homeonly && $core->url->type != 'default') return; 
    56  
     56           
    5757          $req = 
    5858          'SELECT COUNT(*) AS count, comment_email '. 
     
    6262          'AND post_status=1 AND comment_status=1 '. 
    6363          self::period('comment_dt',$w->period); 
    64  
    65           if ($w->exclude) { 
     64           
     65          if ($w->exclude) 
     66          { 
    6667               $req .=  
    6768               'AND comment_email NOT IN ('. 
     
    7273               ' GROUP BY U.user_email) '; 
    7374          } 
    74  
     75           
    7576          $req .= 
    7677          'GROUP BY comment_email '. 
     
    7980           
    8081          $rs = $core->con->select($req); 
    81  
     82           
    8283          if ($rs->isEmpty()) return; 
    83  
     84           
    8485          $content = ''; 
    8586          $i = 0; 
    86           while($rs->fetch()){ 
     87          while($rs->fetch()) 
     88          { 
    8789               $user = $core->con->select( 
    88                     "SELECT * FROM ".$core->prefix."comment WHERE comment_email='".$rs->comment_email."' " 
     90                    "SELECT * FROM ".$core->prefix."comment ". 
     91                    "WHERE comment_email='".$rs->comment_email."' ". 
     92                    'ORDER BY comment_dt DESC' 
    8993               ); 
    90  
     94                
    9195               if (!$user->comment_author) continue; 
    92  
     96                
    9397               $i++; 
    9498               $rank = '<span class="topcomments-rank">'.$i.'</span>'; 
    95  
    96                if ($user->comment_site) { 
     99                
     100               if ($user->comment_site) 
     101               { 
    97102                    $author = '<a href="'.$user->comment_site.'" title="'. 
    98103                         __('Author link').'">'.$user->comment_author.'</a>'; 
    99104               } 
    100105               else 
     106               { 
    101107                    $author = $user->comment_author; 
    102  
     108               } 
     109               $author = '<span class="topcomments-author">'.$author.'</span>'; 
     110                
    103111               if ($rs->count == 0) 
     112               { 
    104113                    $count = __('no comment'); 
    105  
     114               } 
    106115               elseif ($rs->count == 1) 
     116               { 
    107117                    $count = __('one comment'); 
    108  
     118               } 
    109119               else 
     120               { 
    110121                    $count = sprintf(__('%s comments'),$rs->count); 
    111  
     122               } 
     123                
    112124               $content .= '<li>'.str_replace( 
    113125                    array('%rank%','%author%','%count%'), 
     
    116128               ).'</li>'; 
    117129          } 
    118  
     130           
    119131          if ($i < 1) return; 
    120  
     132           
    121133          return  
    122134          '<div class="topcomments">'. 
     
    125137          '</div>'; 
    126138     } 
    127  
     139      
    128140     public static function topPost($w) 
    129141     { 
    130142          global $core; 
    131  
     143           
    132144          if ($w->homeonly && $core->url->type != 'default') return; 
    133  
     145           
    134146          $rs = $core->con->select( 
    135147          'SELECT COUNT(*) AS count, U.user_id '. 
     
    142154          'ORDER BY count '.($w->sort == 'asc' ? 'ASC' : 'DESC').', U.user_id ASC '. 
    143155          $core->con->limit(abs((integer) $w->limit))); 
    144  
     156           
    145157          if ($rs->isEmpty()) return; 
    146  
     158           
    147159          $content = ''; 
    148160          $i = 0; 
    149           while($rs->fetch()){ 
     161          while($rs->fetch()) 
     162          { 
    150163               $user = $core->con->select( 
    151164                    "SELECT * FROM ".$core->prefix."user WHERE user_id='".$rs->user_id."' " 
    152165               ); 
    153  
     166                
    154167               $author = dcUtils::getUserCN($user->user_id,$user->user_name, 
    155168                    $user->user_firstname,$user->user_displayname); 
    156  
     169                
    157170               if (empty($author)) continue; 
    158  
     171                
    159172               $i++; 
    160173               $rank = '<span class="topentries-rank">'.$i.'</span>'; 
    161  
    162                if ($core->blog->settings->authormode_active) { 
     174                
     175               $core->blog->settings->addNamespace('authormode'); 
     176               if ($core->blog->settings->authormode->authormode_active) 
     177               { 
    163178                    $author = '<a href="'. 
    164179                         $core->blog->url.$core->url->getBase("author").'/'.$user->user_id.'" '. 
    165180                         'title="'.__('Author posts').'">'.$author.'</a>'; 
    166181               } 
    167                elseif ($user->user_url) { 
     182               elseif ($user->user_url) 
     183               { 
    168184                    $author = '<a href="'.$user->user_url.'" title="'. 
    169185                         __('Author link').'">'.$author.'</a>'; 
    170186               } 
    171  
     187               $author = '<span class="topentries-author">'.$author.'</span>'; 
     188                
    172189               if ($rs->count == 0) 
     190               { 
    173191                    $count = __('no post'); 
    174  
     192               } 
    175193               elseif ($rs->count == 1) 
     194               { 
    176195                    $count = __('one post'); 
    177  
     196               } 
    178197               else 
     198               { 
    179199                    $count = sprintf(__('%s posts'),$rs->count); 
    180  
     200               } 
     201                
    181202               $content .= '<li>'.str_replace( 
    182203                    array('%rank%','%author%','%count%'), 
     
    185206               ).'</li>'; 
    186207          } 
    187  
     208           
    188209          if ($i < 1) return; 
    189  
     210           
    190211          return  
    191212          '<div class="topentries">'. 
     
    194215          '</div>'; 
    195216     } 
    196  
     217      
    197218     private static function period($t,$p) 
    198219     { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map