Changeset 1379
- Timestamp:
- 08/10/09 23:33:28 (14 years ago)
- Location:
- plugins/topWriter
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/topWriter/_define.php
r1304 r1379 17 17 /* Description*/ "Widgets to list users who write more posts or comments", 18 18 /* Author */ "JC Denis", 19 /* Version */ '0. 1',19 /* Version */ '0.2', 20 20 /* Permissions */ 'admin' 21 21 ); 22 /* date */ #20090 70522 /* date */ #20090810 23 23 ?> -
plugins/topWriter/_widgets.php
r1304 r1379 11 11 # -- END LICENSE BLOCK ------------------------------------ 12 12 13 if (!defined('DC_RC_PATH')) return;13 if (!defined('DC_RC_PATH')){return;} 14 14 15 15 $core->addBehavior('initWidgets',array('topWriterWidget','init')); … … 17 17 class topWriterWidget 18 18 { 19 public static function init( &$w)19 public static function init($w) 20 20 { 21 21 $w->create('topcom',__('Top comments'), … … 31 31 __('Ascending') => 'asc',__('Descending') => 'desc')); 32 32 $w->topcom->setting('limit',__('Limit:'),'10','text'); 33 $w->topcom->setting('exclude',__('Exclude post writer from list'),0,'check'); 33 34 $w->topcom->setting('homeonly',__('Home page only'),1,'check'); 34 35 … … 48 49 } 49 50 50 public static function topCom( &$w)51 public static function topCom($w) 51 52 { 52 53 global $core; … … 54 55 if ($w->homeonly && $core->url->type != 'default') return; 55 56 56 $rs = $core->con->select( 57 'SELECT COUNT(comment_id) AS comment_count, '. 58 'comment_author, comment_email, comment_site '. 59 "FROM ".$core->prefix."post P, ".$core->prefix."comment C ". 60 'WHERE P.post_id=C.post_id '. 61 "AND blog_id='".$core->con->escape($core->blog->id)."' ". 62 'AND post_status=1 AND comment_status=1 '. 63 self::period('comment_dt',$w->period). 64 'GROUP BY C.comment_email '. 65 'ORDER BY comment_count '.($w->sort == 'asc' ? 'ASC' : 'DESC'). 66 ', comment_dt DESC '. 67 $core->con->limit(abs((integer) $w->limit)) 68 ); 57 $req = 58 'SELECT COUNT(*) AS count, comment_email '. 59 "FROM ".$core->prefix."post P, ".$core->prefix."comment C ". 60 'WHERE P.post_id=C.post_id '. 61 "AND blog_id='".$core->con->escape($core->blog->id)."' ". 62 'AND post_status=1 AND comment_status=1 '. 63 self::period('comment_dt',$w->period); 64 65 if ($w->exclude) { 66 $req .= 67 'AND comment_email NOT IN ('. 68 ' SELECT U.user_email '. 69 ' FROM '.$core->prefix.'user U'. 70 ' INNER JOIN '.$core->prefix.'post P ON P.user_id = U.user_id '. 71 " WHERE blog_id='".$core->con->escape($core->blog->id)."' ". 72 ' GROUP BY U.user_email) '; 73 } 74 75 $req .= 76 'GROUP BY comment_email '. 77 'ORDER BY count '.($w->sort == 'asc' ? 'ASC' : 'DESC').' '. 78 $core->con->limit(abs((integer) $w->limit)); 79 80 $rs = $core->con->select($req); 69 81 70 82 if ($rs->isEmpty()) return; 71 83 72 84 $content = ''; 73 $res = array();74 85 $i = 0; 75 86 while($rs->fetch()){ 87 $user = $core->con->select( 88 "SELECT * FROM ".$core->prefix."comment WHERE comment_email='".$rs->comment_email."' " 89 ); 90 91 if (!$user->comment_author) continue; 92 76 93 $i++; 77 94 $rank = '<span class="topcomments-rank">'.$i.'</span>'; 78 95 79 if ($rs->comment_site) { 80 $author = '<a href="'.$rs->comment_site.'" title="'. 81 __('Author link').'">'.$rs->comment_author.'</a>'; 82 } else 83 $author = $rs->comment_author; 84 85 if ($rs->comment_count == 0) 96 if ($user->comment_site) { 97 $author = '<a href="'.$user->comment_site.'" title="'. 98 __('Author link').'">'.$user->comment_author.'</a>'; 99 } 100 else 101 $author = $user->comment_author; 102 103 if ($rs->count == 0) 86 104 $count = __('no comment'); 87 elseif($rs->comment_count == 1) 105 106 elseif ($rs->count == 1) 88 107 $count = __('one comment'); 108 89 109 else 90 $count = sprintf(__('%s comments'),$rs->co mment_count);110 $count = sprintf(__('%s comments'),$rs->count); 91 111 92 112 $content .= '<li>'.str_replace( … … 97 117 } 98 118 119 if ($i < 1) return; 120 99 121 return 100 122 '<div class="topcomments">'. … … 104 126 } 105 127 106 public static function topPost( &$w)128 public static function topPost($w) 107 129 { 108 130 global $core; … … 111 133 112 134 $rs = $core->con->select( 113 'SELECT COUNT(P.post_id) AS post_count, '. 114 'U.user_id, U.user_name, U.user_firstname, U.user_displayname, U.user_email '. 135 'SELECT COUNT(*) AS count, U.user_id '. 115 136 "FROM ".$core->prefix."post P ". 116 137 'INNER JOIN '.$core->prefix.'user U ON U.user_id = P.user_id '. … … 119 140 self::period('post_dt',$w->period). 120 141 'GROUP BY U.user_id '. 121 'ORDER BY post_count '.($w->sort == 'asc' ? 'ASC' : 'DESC'). 122 ', post_dt DESC '. 142 'ORDER BY count '.($w->sort == 'asc' ? 'ASC' : 'DESC').', U.user_id ASC '. 123 143 $core->con->limit(abs((integer) $w->limit))); 124 144 … … 128 148 $i = 0; 129 149 while($rs->fetch()){ 150 $user = $core->con->select( 151 "SELECT * FROM ".$core->prefix."user WHERE user_id='".$rs->user_id."' " 152 ); 153 154 $author = dcUtils::getUserCN($user->user_id,$user->user_name, 155 $user->user_firstname,$user->user_displayname); 156 157 if (empty($author)) continue; 158 130 159 $i++; 131 160 $rank = '<span class="topentries-rank">'.$i.'</span>'; 132 161 133 $author = dcUtils::getUserCN($rs->user_id,$rs->user_name,134 $rs->user_firstname,$rs->user_displayname);135 136 162 if ($core->blog->settings->authormode_active) { 137 163 $author = '<a href="'. 138 $core->blog->url.$core->url->getBase("author").'/'.$ rs->user_id.'" '.164 $core->blog->url.$core->url->getBase("author").'/'.$user->user_id.'" '. 139 165 'title="'.__('Author posts').'">'.$author.'</a>'; 140 } elseif ($rs->user_url) { 141 $author = '<a href="'.$rs->user_url.'" title="'. 166 } 167 elseif ($user->user_url) { 168 $author = '<a href="'.$user->user_url.'" title="'. 142 169 __('Author link').'">'.$author.'</a>'; 143 170 } 144 171 145 if ($rs-> post_count == 0)172 if ($rs->count == 0) 146 173 $count = __('no post'); 147 elseif($rs->post_count == 1) 174 175 elseif ($rs->count == 1) 148 176 $count = __('one post'); 177 149 178 else 150 $count = sprintf(__('%s posts'),$rs-> post_count);179 $count = sprintf(__('%s posts'),$rs->count); 151 180 152 181 $content .= '<li>'.str_replace( … … 156 185 ).'</li>'; 157 186 } 187 188 if ($i < 1) return; 158 189 159 190 return -
plugins/topWriter/locales/fr/main.lang.php
r1304 r1379 1 1 <?php 2 2 // Language: français 3 // Module: topWriter - 0. 14 // Date: 2009-0 7-05 20:41:315 // Author: JC Denis, http://blog.jcdenis.com3 // Module: topWriter - 0.2 4 // Date: 2009-08-10 21:13:57 5 // Author: JC Denis, jcdenis@gdwd.com 6 6 // Translated with dcTranslater - 0.2.4 7 7 … … 9 9 $GLOBALS['__l10n']['Top comments'] = 'Top commentaires'; 10 10 11 #_widgets.php:4 111 #_widgets.php:42 12 12 $GLOBALS['__l10n']['Period:'] = 'Période :'; 13 13 14 #_widgets.php:4 214 #_widgets.php:43 15 15 $GLOBALS['__l10n']['day'] = 'jour'; 16 16 17 #_widgets.php:4 217 #_widgets.php:43 18 18 $GLOBALS['__l10n']['week'] = 'semaine'; 19 19 20 #_widgets.php:4 220 #_widgets.php:43 21 21 $GLOBALS['__l10n']['month'] = 'mois'; 22 22 23 #_widgets.php:4 323 #_widgets.php:44 24 24 $GLOBALS['__l10n']['year'] = 'année'; 25 25 26 #_widgets.php:4 326 #_widgets.php:44 27 27 $GLOBALS['__l10n']['from begining'] = 'depuis le début'; 28 28 29 #_widgets.php:4 629 #_widgets.php:47 30 30 $GLOBALS['__l10n']['Limit:'] = 'Limite :'; 31 31 32 #_widgets.php:38 32 #_widgets.php:33 33 $GLOBALS['__l10n']['Exclude post writer from list'] = 'Exclure de la liste les auteurs de billets'; 34 35 #_widgets.php:39 33 36 $GLOBALS['__l10n']['Top entries'] = 'Top billets'; 34 37 35 #_widgets.php:1 4238 #_widgets.php:161 36 39 $GLOBALS['__l10n']['Author link'] = 'Lien vers l\'auteur'; 37 40 38 #_widgets.php: 9041 #_widgets.php:106 39 42 $GLOBALS['__l10n']['%s comments'] = '%s commentaires'; 40 43 41 #_widgets.php:1 3944 #_widgets.php:157 42 45 $GLOBALS['__l10n']['Author posts'] = 'Billets de l\'auteur'; 43 46 44 #_widgets.php:1 4647 #_widgets.php:165 45 48 $GLOBALS['__l10n']['no post'] = 'pas de billet'; 46 49 47 #_widgets.php:1 4850 #_widgets.php:167 48 51 $GLOBALS['__l10n']['one post'] = 'un billet'; 49 52 50 #_widgets.php:1 5053 #_widgets.php:169 51 54 $GLOBALS['__l10n']['%s posts'] = '%s billets'; 52 55 -
plugins/topWriter/locales/fr/main.po
r1304 r1379 1 1 # Language: français 2 # Module: topWriter - 0. 13 # Date: 2009-0 7-05 20:41:314 # Author: JC Denis, http://blog.jcdenis.com2 # Module: topWriter - 0.2 3 # Date: 2009-08-10 21:13:57 4 # Author: JC Denis, jcdenis@gdwd.com 5 5 # Translated with dcTranslater - 0.2.4 6 6 … … 12 12 msgstr "Top commentaires" 13 13 14 #: _widgets.php:4 114 #: _widgets.php:42 15 15 msgid "Period:" 16 16 msgstr "Période :" 17 17 18 #: _widgets.php:4 218 #: _widgets.php:43 19 19 msgid "day" 20 20 msgstr "jour" 21 21 22 #: _widgets.php:4 222 #: _widgets.php:43 23 23 msgid "week" 24 24 msgstr "semaine" 25 25 26 #: _widgets.php:4 226 #: _widgets.php:43 27 27 msgid "month" 28 28 msgstr "mois" 29 29 30 #: _widgets.php:4 330 #: _widgets.php:44 31 31 msgid "year" 32 32 msgstr "année" 33 33 34 #: _widgets.php:4 334 #: _widgets.php:44 35 35 msgid "from begining" 36 36 msgstr "depuis le début" 37 37 38 #: _widgets.php:4 638 #: _widgets.php:47 39 39 msgid "Limit:" 40 40 msgstr "Limite :" 41 41 42 #: _widgets.php:38 42 #: _widgets.php:33 43 msgid "Exclude post writer from list" 44 msgstr "Exclure de la liste les auteurs de billets" 45 46 #: _widgets.php:39 43 47 msgid "Top entries" 44 48 msgstr "Top billets" 45 49 46 #: _widgets.php:1 4250 #: _widgets.php:161 47 51 msgid "Author link" 48 52 msgstr "Lien vers l'auteur" 49 53 50 #: _widgets.php: 9054 #: _widgets.php:106 51 55 msgid "%s comments" 52 56 msgstr "%s commentaires" 53 57 54 #: _widgets.php:1 3958 #: _widgets.php:157 55 59 msgid "Author posts" 56 60 msgstr "Billets de l'auteur" 57 61 58 #: _widgets.php:1 4662 #: _widgets.php:165 59 63 msgid "no post" 60 64 msgstr "pas de billet" 61 65 62 #: _widgets.php:1 4866 #: _widgets.php:167 63 67 msgid "one post" 64 68 msgstr "un billet" 65 69 66 #: _widgets.php:1 5070 #: _widgets.php:169 67 71 msgid "%s posts" 68 72 msgstr "%s billets"
Note: See TracChangeset
for help on using the changeset viewer.